LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
slaed5.f
Go to the documentation of this file.
1*> \brief \b SLAED5 used by SSTEDC. Solves the 2-by-2 secular equation.
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8*> Download SLAED5 + dependencies
9*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/slaed5.f">
10*> [TGZ]</a>
11*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/slaed5.f">
12*> [ZIP]</a>
13*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/slaed5.f">
14*> [TXT]</a>
15*
16* Definition:
17* ===========
18*
19* SUBROUTINE SLAED5( I, D, Z, DELTA, RHO, DLAM )
20*
21* .. Scalar Arguments ..
22* INTEGER I
23* REAL DLAM, RHO
24* ..
25* .. Array Arguments ..
26* REAL D( 2 ), DELTA( 2 ), Z( 2 )
27* ..
28*
29*
30*> \par Purpose:
31* =============
32*>
33*> \verbatim
34*>
35*> This subroutine computes the I-th eigenvalue of a symmetric rank-one
36*> modification of a 2-by-2 diagonal matrix
37*>
38*> diag( D ) + RHO * Z * transpose(Z) .
39*>
40*> The diagonal elements in the array D are assumed to satisfy
41*>
42*> D(i) < D(j) for i < j .
43*>
44*> We also assume RHO > 0 and that the Euclidean norm of the vector
45*> Z is one.
46*> \endverbatim
47*
48* Arguments:
49* ==========
50*
51*> \param[in] I
52*> \verbatim
53*> I is INTEGER
54*> The index of the eigenvalue to be computed. I = 1 or I = 2.
55*> \endverbatim
56*>
57*> \param[in] D
58*> \verbatim
59*> D is REAL array, dimension (2)
60*> The original eigenvalues. We assume D(1) < D(2).
61*> \endverbatim
62*>
63*> \param[in] Z
64*> \verbatim
65*> Z is REAL array, dimension (2)
66*> The components of the updating vector.
67*> \endverbatim
68*>
69*> \param[out] DELTA
70*> \verbatim
71*> DELTA is REAL array, dimension (2)
72*> The vector DELTA contains the information necessary
73*> to construct the eigenvectors.
74*> \endverbatim
75*>
76*> \param[in] RHO
77*> \verbatim
78*> RHO is REAL
79*> The scalar in the symmetric updating formula.
80*> \endverbatim
81*>
82*> \param[out] DLAM
83*> \verbatim
84*> DLAM is REAL
85*> The computed lambda_I, the I-th updated eigenvalue.
86*> \endverbatim
87*
88* Authors:
89* ========
90*
91*> \author Univ. of Tennessee
92*> \author Univ. of California Berkeley
93*> \author Univ. of Colorado Denver
94*> \author NAG Ltd.
95*
96*> \ingroup laed5
97*
98*> \par Contributors:
99* ==================
100*>
101*> Ren-Cang Li, Computer Science Division, University of California
102*> at Berkeley, USA
103*>
104* =====================================================================
105 SUBROUTINE slaed5( I, D, Z, DELTA, RHO, DLAM )
106*
107* -- LAPACK computational routine --
108* -- LAPACK is a software package provided by Univ. of Tennessee, --
109* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
110*
111* .. Scalar Arguments ..
112 INTEGER I
113 REAL DLAM, RHO
114* ..
115* .. Array Arguments ..
116 REAL D( 2 ), DELTA( 2 ), Z( 2 )
117* ..
118*
119* =====================================================================
120*
121* .. Parameters ..
122 REAL ZERO, ONE, TWO, FOUR
123 parameter( zero = 0.0e0, one = 1.0e0, two = 2.0e0,
124 $ four = 4.0e0 )
125* ..
126* .. Local Scalars ..
127 REAL B, C, DEL, TAU, TEMP, W
128* ..
129* .. Intrinsic Functions ..
130 INTRINSIC abs, sqrt
131* ..
132* .. Executable Statements ..
133*
134 del = d( 2 ) - d( 1 )
135 IF( i.EQ.1 ) THEN
136 w = one + two*rho*( z( 2 )*z( 2 )-z( 1 )*z( 1 ) ) / del
137 IF( w.GT.zero ) THEN
138 b = del + rho*( z( 1 )*z( 1 )+z( 2 )*z( 2 ) )
139 c = rho*z( 1 )*z( 1 )*del
140*
141* B > ZERO, always
142*
143 tau = two*c / ( b+sqrt( abs( b*b-four*c ) ) )
144 dlam = d( 1 ) + tau
145 delta( 1 ) = -z( 1 ) / tau
146 delta( 2 ) = z( 2 ) / ( del-tau )
147 ELSE
148 b = -del + rho*( z( 1 )*z( 1 )+z( 2 )*z( 2 ) )
149 c = rho*z( 2 )*z( 2 )*del
150 IF( b.GT.zero ) THEN
151 tau = -two*c / ( b+sqrt( b*b+four*c ) )
152 ELSE
153 tau = ( b-sqrt( b*b+four*c ) ) / two
154 END IF
155 dlam = d( 2 ) + tau
156 delta( 1 ) = -z( 1 ) / ( del+tau )
157 delta( 2 ) = -z( 2 ) / tau
158 END IF
159 temp = sqrt( delta( 1 )*delta( 1 )+delta( 2 )*delta( 2 ) )
160 delta( 1 ) = delta( 1 ) / temp
161 delta( 2 ) = delta( 2 ) / temp
162 ELSE
163*
164* Now I=2
165*
166 b = -del + rho*( z( 1 )*z( 1 )+z( 2 )*z( 2 ) )
167 c = rho*z( 2 )*z( 2 )*del
168 IF( b.GT.zero ) THEN
169 tau = ( b+sqrt( b*b+four*c ) ) / two
170 ELSE
171 tau = two*c / ( -b+sqrt( b*b+four*c ) )
172 END IF
173 dlam = d( 2 ) + tau
174 delta( 1 ) = -z( 1 ) / ( del+tau )
175 delta( 2 ) = -z( 2 ) / tau
176 temp = sqrt( delta( 1 )*delta( 1 )+delta( 2 )*delta( 2 ) )
177 delta( 1 ) = delta( 1 ) / temp
178 delta( 2 ) = delta( 2 ) / temp
179 END IF
180 RETURN
181*
182* End of SLAED5
183*
184 END
subroutine slaed5(i, d, z, delta, rho, dlam)
SLAED5 used by SSTEDC. Solves the 2-by-2 secular equation.
Definition slaed5.f:106