LAPACK  3.9.1
LAPACK: Linear Algebra PACKage
drotg.f
Go to the documentation of this file.
1 *> \brief \b DROTG
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 DROTG(DA,DB,C,S)
12 *
13 * .. Scalar Arguments ..
14 * DOUBLE PRECISION C,DA,DB,S
15 * ..
16 *
17 *
18 *> \par Purpose:
19 * =============
20 *>
21 *> \verbatim
22 *>
23 *> DROTG construct givens plane rotation.
24 *> \endverbatim
25 *
26 * Arguments:
27 * ==========
28 *
29 *> \param[in,out] DA
30 *> \verbatim
31 *> DA is DOUBLE PRECISION
32 *> \endverbatim
33 *>
34 *> \param[in,out] DB
35 *> \verbatim
36 *> DB is DOUBLE PRECISION
37 *> \endverbatim
38 *>
39 *> \param[out] C
40 *> \verbatim
41 *> C is DOUBLE PRECISION
42 *> \endverbatim
43 *>
44 *> \param[out] S
45 *> \verbatim
46 *> S is DOUBLE PRECISION
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 double_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 drotg(DA,DB,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  DOUBLE PRECISION C,DA,DB,S
76 * ..
77 *
78 * =====================================================================
79 *
80 * .. Local Scalars ..
81  DOUBLE PRECISION R,ROE,SCALE,Z
82 * ..
83 * .. Intrinsic Functions ..
84  INTRINSIC dabs,dsign,dsqrt
85 * ..
86  scale = dabs(da) + dabs(db)
87  IF (scale.EQ.0.0d0) THEN
88  c = 1.0d0
89  s = 0.0d0
90  r = 0.0d0
91  z = 0.0d0
92  ELSE
93  roe = db
94  IF (dabs(da).GT.dabs(db)) roe = da
95  r = scale*dsqrt((da/scale)**2+ (db/scale)**2)
96  r = dsign(1.0d0,roe)*r
97  c = da/r
98  s = db/r
99  z = 1.0d0
100  IF (dabs(da).GT.dabs(db)) z = s
101  IF (dabs(db).GE.dabs(da) .AND. c.NE.0.0d0) z = 1.0d0/c
102  END IF
103  da = r
104  db = z
105  RETURN
106  END
subroutine drotg(DA, DB, C, S)
DROTG
Definition: drotg.f:69