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

◆ slartgs()

subroutine slartgs ( real x,
real y,
real sigma,
real cs,
real sn )

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

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

Purpose:
!>
!> SLARTGS 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 REAL
!>          The (1,1) entry of an upper bidiagonal matrix.
!> 
[in]Y
!>          Y is REAL
!>          The (1,2) entry of an upper bidiagonal matrix.
!> 
[in]SIGMA
!>          SIGMA is REAL
!>          The shift.
!> 
[out]CS
!>          CS is REAL
!>          The cosine of the rotation.
!> 
[out]SN
!>          SN is REAL
!>          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 slartgs.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 REAL CS, SIGMA, SN, X, Y
95* ..
96*
97* ===================================================================
98*
99* .. Parameters ..
100 REAL NEGONE, ONE, ZERO
101 parameter( negone = -1.0e0, one = 1.0e0, zero = 0.0e0 )
102* ..
103* .. Local Scalars ..
104 REAL R, S, THRESH, W, Z
105* ..
106* .. External Subroutines ..
107 EXTERNAL slartgp
108* ..
109* .. External Functions ..
110 REAL SLAMCH
111 EXTERNAL slamch
112* .. Executable Statements ..
113*
114 thresh = slamch('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 SLARTGP( 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 slartgp( w, z, sn, cs, r )
150*
151 RETURN
152*
153* End SLARTGS
154*
real function slamch(cmach)
SLAMCH
Definition slamch.f:68
subroutine slartgp(f, g, cs, sn, r)
SLARTGP generates a plane rotation so that the diagonal is nonnegative.
Definition slartgp.f:93
Here is the call graph for this function:
Here is the caller graph for this function: