1
SUBROUTINE DLASD5( I, D, Z, DELTA, RHO, DSIGMA, WORK )
3
* -- LAPACK auxiliary routine (version 3.1) --
4
* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
7
* .. Scalar Arguments ..
9
DOUBLE PRECISION DSIGMA, RHO
11
* .. Array Arguments ..
12
DOUBLE PRECISION D( 2 ), DELTA( 2 ), WORK( 2 ), Z( 2 )
18
* This subroutine computes the square root of the I-th eigenvalue
19
* of a positive symmetric rank-one modification of a 2-by-2 diagonal
22
* diag( D ) * diag( D ) + RHO * Z * transpose(Z) .
24
* The diagonal entries in the array D are assumed to satisfy
26
* 0 <= D(i) < D(j) for i < j .
28
* We also assume RHO > 0 and that the Euclidean norm of the vector
35
* The index of the eigenvalue to be computed. I = 1 or I = 2.
37
* D (input) DOUBLE PRECISION array, dimension ( 2 )
38
* The original eigenvalues. We assume 0 <= D(1) < D(2).
40
* Z (input) DOUBLE PRECISION array, dimension ( 2 )
41
* The components of the updating vector.
43
* DELTA (output) DOUBLE PRECISION array, dimension ( 2 )
44
* Contains (D(j) - sigma_I) in its j-th component.
45
* The vector DELTA contains the information necessary
46
* to construct the eigenvectors.
48
* RHO (input) DOUBLE PRECISION
49
* The scalar in the symmetric updating formula.
51
* DSIGMA (output) DOUBLE PRECISION
52
* The computed sigma_I, the I-th updated eigenvalue.
54
* WORK (workspace) DOUBLE PRECISION array, dimension ( 2 )
55
* WORK contains (D(j) + sigma_I) in its j-th component.
60
* Based on contributions by
61
* Ren-Cang Li, Computer Science Division, University of California
64
* =====================================================================
67
DOUBLE PRECISION ZERO, ONE, TWO, THREE, FOUR
68
PARAMETER ( ZERO = 0.0D+0, ONE = 1.0D+0, TWO = 2.0D+0,
69
$ THREE = 3.0D+0, FOUR = 4.0D+0 )
72
DOUBLE PRECISION B, C, DEL, DELSQ, TAU, W
74
* .. Intrinsic Functions ..
77
* .. Executable Statements ..
80
DELSQ = DEL*( D( 2 )+D( 1 ) )
82
W = ONE + FOUR*RHO*( Z( 2 )*Z( 2 ) / ( D( 1 )+THREE*D( 2 ) )-
83
$ Z( 1 )*Z( 1 ) / ( THREE*D( 1 )+D( 2 ) ) ) / DEL
85
B = DELSQ + RHO*( Z( 1 )*Z( 1 )+Z( 2 )*Z( 2 ) )
86
C = RHO*Z( 1 )*Z( 1 )*DELSQ
90
* The following TAU is DSIGMA * DSIGMA - D( 1 ) * D( 1 )
92
TAU = TWO*C / ( B+SQRT( ABS( B*B-FOUR*C ) ) )
94
* The following TAU is DSIGMA - D( 1 )
96
TAU = TAU / ( D( 1 )+SQRT( D( 1 )*D( 1 )+TAU ) )
99
DELTA( 2 ) = DEL - TAU
100
WORK( 1 ) = TWO*D( 1 ) + TAU
101
WORK( 2 ) = ( D( 1 )+TAU ) + D( 2 )
102
* DELTA( 1 ) = -Z( 1 ) / TAU
103
* DELTA( 2 ) = Z( 2 ) / ( DEL-TAU )
105
B = -DELSQ + RHO*( Z( 1 )*Z( 1 )+Z( 2 )*Z( 2 ) )
106
C = RHO*Z( 2 )*Z( 2 )*DELSQ
108
* The following TAU is DSIGMA * DSIGMA - D( 2 ) * D( 2 )
111
TAU = -TWO*C / ( B+SQRT( B*B+FOUR*C ) )
113
TAU = ( B-SQRT( B*B+FOUR*C ) ) / TWO
116
* The following TAU is DSIGMA - D( 2 )
118
TAU = TAU / ( D( 2 )+SQRT( ABS( D( 2 )*D( 2 )+TAU ) ) )
119
DSIGMA = D( 2 ) + TAU
120
DELTA( 1 ) = -( DEL+TAU )
122
WORK( 1 ) = D( 1 ) + TAU + D( 2 )
123
WORK( 2 ) = TWO*D( 2 ) + TAU
124
* DELTA( 1 ) = -Z( 1 ) / ( DEL+TAU )
125
* DELTA( 2 ) = -Z( 2 ) / TAU
127
* TEMP = SQRT( DELTA( 1 )*DELTA( 1 )+DELTA( 2 )*DELTA( 2 ) )
128
* DELTA( 1 ) = DELTA( 1 ) / TEMP
129
* DELTA( 2 ) = DELTA( 2 ) / TEMP
134
B = -DELSQ + RHO*( Z( 1 )*Z( 1 )+Z( 2 )*Z( 2 ) )
135
C = RHO*Z( 2 )*Z( 2 )*DELSQ
137
* The following TAU is DSIGMA * DSIGMA - D( 2 ) * D( 2 )
140
TAU = ( B+SQRT( B*B+FOUR*C ) ) / TWO
142
TAU = TWO*C / ( -B+SQRT( B*B+FOUR*C ) )
145
* The following TAU is DSIGMA - D( 2 )
147
TAU = TAU / ( D( 2 )+SQRT( D( 2 )*D( 2 )+TAU ) )
148
DSIGMA = D( 2 ) + TAU
149
DELTA( 1 ) = -( DEL+TAU )
151
WORK( 1 ) = D( 1 ) + TAU + D( 2 )
152
WORK( 2 ) = TWO*D( 2 ) + TAU
153
* DELTA( 1 ) = -Z( 1 ) / ( DEL+TAU )
154
* DELTA( 2 ) = -Z( 2 ) / TAU
155
* TEMP = SQRT( DELTA( 1 )*DELTA( 1 )+DELTA( 2 )*DELTA( 2 ) )
156
* DELTA( 1 ) = DELTA( 1 ) / TEMP
157
* DELTA( 2 ) = DELTA( 2 ) / TEMP