LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ dlartgs()

subroutine dlartgs ( double precision x,
double precision y,
double precision sigma,
double precision cs,
double precision sn )

DLARTGS generates a plane rotation designed to introduce a bulge in implicit QR iteration for the bidiagonal SVD problem.

Download DLARTGS + dependencies [TGZ] [ZIP] [TXT]

Purpose:
!>
!> DLARTGS generates a plane rotation designed to introduce a bulge in
!> Golub-Reinsch-style implicit QR iteration for the bidiagonal SVD
!> problem. X and Y are the top-row entries, and SIGMA is the shift.
!> The computed CS and SN define a plane rotation satisfying
!>
!>    [  CS  SN  ]  .  [ X^2 - SIGMA ]  =  [ R ],
!>    [ -SN  CS  ]     [    X * Y    ]     [ 0 ]
!>
!> with R nonnegative.  If X^2 - SIGMA and X * Y are 0, then the
!> rotation is by PI/2.
!> 
Parameters
[in]X
!>          X is DOUBLE PRECISION
!>          The (1,1) entry of an upper bidiagonal matrix.
!> 
[in]Y
!>          Y is DOUBLE PRECISION
!>          The (1,2) entry of an upper bidiagonal matrix.
!> 
[in]SIGMA
!>          SIGMA is DOUBLE PRECISION
!>          The shift.
!> 
[out]CS
!>          CS is DOUBLE PRECISION
!>          The cosine of the rotation.
!> 
[out]SN
!>          SN is DOUBLE PRECISION
!>          The sine of the rotation.
!> 
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 87 of file dlartgs.f.

88*
89* -- LAPACK computational routine --
90* -- LAPACK is a software package provided by Univ. of Tennessee, --
91* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
92*
93* .. Scalar Arguments ..
94 DOUBLE PRECISION CS, SIGMA, SN, X, Y
95* ..
96*
97* ===================================================================
98*
99* .. Parameters ..
100 DOUBLE PRECISION NEGONE, ONE, ZERO
101 parameter( negone = -1.0d0, one = 1.0d0, zero = 0.0d0 )
102* ..
103* .. Local Scalars ..
104 DOUBLE PRECISION R, S, THRESH, W, Z
105* ..
106* .. External Subroutines ..
107 EXTERNAL dlartgp
108* ..
109* .. External Functions ..
110 DOUBLE PRECISION DLAMCH
111 EXTERNAL dlamch
112* .. Executable Statements ..
113*
114 thresh = dlamch('E')
115*
116* Compute the first column of B**T*B - SIGMA^2*I, up to a scale
117* factor.
118*
119 IF( (sigma .EQ. zero .AND. abs(x) .LT. thresh) .OR.
120 $ (abs(x) .EQ. sigma .AND. y .EQ. zero) ) THEN
121 z = zero
122 w = zero
123 ELSE IF( sigma .EQ. zero ) THEN
124 IF( x .GE. zero ) THEN
125 z = x
126 w = y
127 ELSE
128 z = -x
129 w = -y
130 END IF
131 ELSE IF( abs(x) .LT. thresh ) THEN
132 z = -sigma*sigma
133 w = zero
134 ELSE
135 IF( x .GE. zero ) THEN
136 s = one
137 ELSE
138 s = negone
139 END IF
140 z = s * (abs(x)-sigma) * (s+sigma/x)
141 w = s * y
142 END IF
143*
144* Generate the rotation.
145* CALL DLARTGP( Z, W, CS, SN, R ) might seem more natural;
146* reordering the arguments ensures that if Z = 0 then the rotation
147* is by PI/2.
148*
149 CALL dlartgp( w, z, sn, cs, r )
150*
151 RETURN
152*
153* End DLARTGS
154*
double precision function dlamch(cmach)
DLAMCH
Definition dlamch.f:69
subroutine dlartgp(f, g, cs, sn, r)
DLARTGP generates a plane rotation so that the diagonal is nonnegative.
Definition dlartgp.f:93
Here is the call graph for this function:
Here is the caller graph for this function: