LAPACK 3.12.0
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 89 of file slartgs.f.

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