LAPACK  3.8.0
LAPACK: Linear Algebra PACKage
srotg.f
Go to the documentation of this file.
1 *> \brief \b SROTG
2 *
3 * =========== DOCUMENTATION ===========
4 *
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
7 *
8 * Definition:
9 * ===========
10 *
11 * SUBROUTINE SROTG(SA,SB,C,S)
12 *
13 * .. Scalar Arguments ..
14 * REAL C,S,SA,SB
15 * ..
16 *
17 *
18 *> \par Purpose:
19 * =============
20 *>
21 *> \verbatim
22 *>
23 *> SROTG construct givens plane rotation.
24 *> \endverbatim
25 *
26 * Arguments:
27 * ==========
28 *
29 *> \param[in] SA
30 *> \verbatim
31 *> SA is REAL
32 *> \endverbatim
33 *>
34 *> \param[in] SB
35 *> \verbatim
36 *> SB is REAL
37 *> \endverbatim
38 *>
39 *> \param[out] C
40 *> \verbatim
41 *> C is REAL
42 *> \endverbatim
43 *>
44 *> \param[out] S
45 *> \verbatim
46 *> S is REAL
47 *> \endverbatim
48 *
49 * Authors:
50 * ========
51 *
52 *> \author Univ. of Tennessee
53 *> \author Univ. of California Berkeley
54 *> \author Univ. of Colorado Denver
55 *> \author NAG Ltd.
56 *
57 *> \date November 2017
58 *
59 *> \ingroup single_blas_level1
60 *
61 *> \par Further Details:
62 * =====================
63 *>
64 *> \verbatim
65 *>
66 *> jack dongarra, linpack, 3/11/78.
67 *> \endverbatim
68 *>
69 * =====================================================================
70  SUBROUTINE srotg(SA,SB,C,S)
71 *
72 * -- Reference BLAS level1 routine (version 3.8.0) --
73 * -- Reference BLAS is a software package provided by Univ. of Tennessee, --
74 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
75 * November 2017
76 *
77 * .. Scalar Arguments ..
78  REAL C,S,SA,SB
79 * ..
80 *
81 * =====================================================================
82 *
83 * .. Local Scalars ..
84  REAL R,ROE,SCALE,Z
85 * ..
86 * .. Intrinsic Functions ..
87  INTRINSIC abs,sign,sqrt
88 * ..
89  roe = sb
90  IF (abs(sa).GT.abs(sb)) roe = sa
91  scale = abs(sa) + abs(sb)
92  IF (scale.EQ.0.0) THEN
93  c = 1.0
94  s = 0.0
95  r = 0.0
96  z = 0.0
97  ELSE
98  r = scale*sqrt((sa/scale)**2+ (sb/scale)**2)
99  r = sign(1.0,roe)*r
100  c = sa/r
101  s = sb/r
102  z = 1.0
103  IF (abs(sa).GT.abs(sb)) z = s
104  IF (abs(sb).GE.abs(sa) .AND. c.NE.0.0) z = 1.0/c
105  END IF
106  sa = r
107  sb = z
108  RETURN
109  END
subroutine srotg(SA, SB, C, S)
SROTG
Definition: srotg.f:71