LAPACK  3.7.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] DA
30 *> \verbatim
31 *> DA is DOUBLE PRECISION
32 *> \endverbatim
33 *>
34 *> \param[in] 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 *> \date December 2016
58 *
59 *> \ingroup double_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 drotg(DA,DB,C,S)
71 *
72 * -- Reference BLAS level1 routine (version 3.7.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 * December 2016
76 *
77 * .. Scalar Arguments ..
78  DOUBLE PRECISION C,DA,DB,S
79 * ..
80 *
81 * =====================================================================
82 *
83 * .. Local Scalars ..
84  DOUBLE PRECISION R,ROE,SCALE,Z
85 * ..
86 * .. Intrinsic Functions ..
87  INTRINSIC dabs,dsign,dsqrt
88 * ..
89  roe = db
90  IF (dabs(da).GT.dabs(db)) roe = da
91  scale = dabs(da) + dabs(db)
92  IF (scale.EQ.0.0d0) THEN
93  c = 1.0d0
94  s = 0.0d0
95  r = 0.0d0
96  z = 0.0d0
97  ELSE
98  r = scale*dsqrt((da/scale)**2+ (db/scale)**2)
99  r = dsign(1.0d0,roe)*r
100  c = da/r
101  s = db/r
102  z = 1.0d0
103  IF (dabs(da).GT.dabs(db)) z = s
104  IF (dabs(db).GE.dabs(da) .AND. c.NE.0.0d0) z = 1.0d0/c
105  END IF
106  da = r
107  db = z
108  RETURN
109  END
subroutine drotg(DA, DB, C, S)
DROTG
Definition: drotg.f:71