LAPACK  3.9.1
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,out] SA
30 *> \verbatim
31 *> SA is REAL
32 *> \endverbatim
33 *>
34 *> \param[in,out] 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 *> \ingroup single_blas_level1
58 *
59 *> \par Further Details:
60 * =====================
61 *>
62 *> \verbatim
63 *>
64 *> jack dongarra, linpack, 3/11/78.
65 *> \endverbatim
66 *>
67 * =====================================================================
68  SUBROUTINE srotg(SA,SB,C,S)
69 *
70 * -- Reference BLAS level1 routine --
71 * -- Reference BLAS is a software package provided by Univ. of Tennessee, --
72 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
73 *
74 * .. Scalar Arguments ..
75  REAL C,S,SA,SB
76 * ..
77 *
78 * =====================================================================
79 *
80 * .. Local Scalars ..
81  REAL R,ROE,SCALE,Z
82 * ..
83 * .. Intrinsic Functions ..
84  INTRINSIC abs,sign,sqrt
85 * ..
86  scale = abs(sa) + abs(sb)
87  IF (scale.EQ.0.0) THEN
88  c = 1.0
89  s = 0.0
90  r = 0.0
91  z = 0.0
92  ELSE
93  roe = sb
94  IF (abs(sa).GT.abs(sb)) roe = sa
95  r = scale*sqrt((sa/scale)**2+ (sb/scale)**2)
96  r = sign(1.0,roe)*r
97  c = sa/r
98  s = sb/r
99  z = 1.0
100  IF (abs(sa).GT.abs(sb)) z = s
101  IF (abs(sb).GE.abs(sa) .AND. c.NE.0.0) z = 1.0/c
102  END IF
103  sa = r
104  sb = z
105  RETURN
106  END
subroutine srotg(SA, SB, C, S)
SROTG
Definition: srotg.f:69