LAPACK  3.9.0
LAPACK: Linear Algebra PACKage

◆ 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.
Date
November 2017

Definition at line 92 of file dlartgs.f.

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