1 *> \brief \b SLASQ4 computes an approximation to the smallest eigenvalue using values of d from the previous transform. Used by sbdsqr.
3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download SLASQ4 + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/slasq4.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/slasq4.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/slasq4.f">
21 * SUBROUTINE SLASQ4( I0, N0, Z, PP, N0IN, DMIN, DMIN1, DMIN2, DN,
22 * DN1, DN2, TAU, TTYPE, G )
24 * .. Scalar Arguments ..
25 * INTEGER I0, N0, N0IN, PP, TTYPE
26 * REAL DMIN, DMIN1, DMIN2, DN, DN1, DN2, G, TAU
28 * .. Array Arguments ..
38 *> SLASQ4 computes an approximation TAU to the smallest eigenvalue
39 *> using values of d from the previous transform.
59 *> Z is REAL array, dimension ( 4*N0 )
60 *> Z holds the qd array.
66 *> PP=0 for ping, PP=1 for pong.
72 *> The value of N0 at start of EIGTEST.
78 *> Minimum value of d.
84 *> Minimum value of d, excluding D( N0 ).
90 *> Minimum value of d, excluding D( N0 ) and D( N0-1 ).
114 *> This is the shift.
126 *> G is passed as an argument in order to save its value between
133 *> \author Univ. of Tennessee
134 *> \author Univ. of California Berkeley
135 *> \author Univ. of Colorado Denver
140 *> \ingroup auxOTHERcomputational
142 *> \par Further Details:
143 * =====================
150 * =====================================================================
151 SUBROUTINE SLASQ4( I0, N0, Z, PP, N0IN, DMIN, DMIN1, DMIN2, DN,
152 $ DN1, DN2, TAU, TTYPE, G )
154 * -- LAPACK computational routine (version 3.6.1) --
155 * -- LAPACK is a software package provided by Univ. of Tennessee, --
156 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
159 * .. Scalar Arguments ..
160 INTEGER I0, N0, N0IN, PP, TTYPE
161 REAL DMIN, DMIN1, DMIN2, DN, DN1, DN2, G, TAU
163 * .. Array Arguments ..
167 * =====================================================================
170 REAL CNST1, CNST2, CNST3
171 PARAMETER ( CNST1 = 0.5630E0, CNST2 = 1.010E0,
173 REAL QURTR, THIRD, HALF, ZERO, ONE, TWO, HUNDRD
174 PARAMETER ( QURTR = 0.250E0, THIRD = 0.3330E0,
175 $ HALF = 0.50E0, ZERO = 0.0E0, ONE = 1.0E0,
176 $ TWO = 2.0E0, HUNDRD = 100.0E0 )
178 * .. Local Scalars ..
180 REAL A2, B1, B2, GAM, GAP1, GAP2, S
182 * .. Intrinsic Functions ..
183 INTRINSIC MAX, MIN, SQRT
185 * .. Executable Statements ..
187 * A negative DMIN forces the shift to take that absolute value
188 * TTYPE records the type of shift.
190 IF( DMIN.LE.ZERO ) THEN
197 IF( N0IN.EQ.N0 ) THEN
199 * No eigenvalues deflated.
201 IF( DMIN.EQ.DN .OR. DMIN.EQ.DN1 ) THEN
203 B1 = SQRT( Z( NN-3 ) )*SQRT( Z( NN-5 ) )
204 B2 = SQRT( Z( NN-7 ) )*SQRT( Z( NN-9 ) )
205 A2 = Z( NN-7 ) + Z( NN-5 )
209 IF( DMIN.EQ.DN .AND. DMIN1.EQ.DN1 ) THEN
210 GAP2 = DMIN2 - A2 - DMIN2*QURTR
211 IF( GAP2.GT.ZERO .AND. GAP2.GT.B2 ) THEN
212 GAP1 = A2 - DN - ( B2 / GAP2 )*B2
214 GAP1 = A2 - DN - ( B1+B2 )
216 IF( GAP1.GT.ZERO .AND. GAP1.GT.B1 ) THEN
217 S = MAX( DN-( B1 / GAP1 )*B1, HALF*DMIN )
223 IF( A2.GT.( B1+B2 ) )
224 $ S = MIN( S, A2-( B1+B2 ) )
225 S = MAX( S, THIRD*DMIN )
234 IF( DMIN.EQ.DN ) THEN
237 IF( Z( NN-5 ) .GT. Z( NN-7 ) )
239 B2 = Z( NN-5 ) / Z( NN-7 )
245 IF( Z( NP-4 ) .GT. Z( NP-2 ) )
247 A2 = Z( NP-4 ) / Z( NP-2 )
248 IF( Z( NN-9 ) .GT. Z( NN-11 ) )
250 B2 = Z( NN-9 ) / Z( NN-11 )
254 * Approximate contribution to norm squared from I < NN-1.
257 DO 10 I4 = NP, 4*I0 - 1 + PP, -4
261 IF( Z( I4 ) .GT. Z( I4-2 ) )
263 B2 = B2*( Z( I4 ) / Z( I4-2 ) )
265 IF( HUNDRD*MAX( B2, B1 ).LT.A2 .OR. CNST1.LT.A2 )
271 * Rayleigh quotient residual bound.
274 $ S = GAM*( ONE-SQRT( A2 ) ) / ( ONE+A2 )
276 ELSE IF( DMIN.EQ.DN2 ) THEN
283 * Compute contribution to norm squared from I > NN-2.
289 IF( Z( NP-8 ).GT.B2 .OR. Z( NP-4 ).GT.B1 )
291 A2 = ( Z( NP-8 ) / B2 )*( ONE+Z( NP-4 ) / B1 )
293 * Approximate contribution to norm squared from I < NN-2.
295 IF( N0-I0.GT.2 ) THEN
296 B2 = Z( NN-13 ) / Z( NN-15 )
298 DO 30 I4 = NN - 17, 4*I0 - 1 + PP, -4
302 IF( Z( I4 ) .GT. Z( I4-2 ) )
304 B2 = B2*( Z( I4 ) / Z( I4-2 ) )
306 IF( HUNDRD*MAX( B2, B1 ).LT.A2 .OR. CNST1.LT.A2 )
314 $ S = GAM*( ONE-SQRT( A2 ) ) / ( ONE+A2 )
317 * Case 6, no information to guide us.
319 IF( TTYPE.EQ.-6 ) THEN
320 G = G + THIRD*( ONE-G )
321 ELSE IF( TTYPE.EQ.-18 ) THEN
330 ELSE IF( N0IN.EQ.( N0+1 ) ) THEN
332 * One eigenvalue just deflated. Use DMIN1, DN1 for DMIN and DN.
334 IF( DMIN1.EQ.DN1 .AND. DMIN2.EQ.DN2 ) THEN
340 IF( Z( NN-5 ).GT.Z( NN-7 ) )
342 B1 = Z( NN-5 ) / Z( NN-7 )
346 DO 50 I4 = 4*N0 - 9 + PP, 4*I0 - 1 + PP, -4
348 IF( Z( I4 ).GT.Z( I4-2 ) )
350 B1 = B1*( Z( I4 ) / Z( I4-2 ) )
352 IF( HUNDRD*MAX( B1, A2 ).LT.B2 )
356 B2 = SQRT( CNST3*B2 )
357 A2 = DMIN1 / ( ONE+B2**2 )
358 GAP2 = HALF*DMIN2 - A2
359 IF( GAP2.GT.ZERO .AND. GAP2.GT.B2*A2 ) THEN
360 S = MAX( S, A2*( ONE-CNST2*A2*( B2 / GAP2 )*B2 ) )
362 S = MAX( S, A2*( ONE-CNST2*B2 ) )
375 ELSE IF( N0IN.EQ.( N0+2 ) ) THEN
377 * Two eigenvalues deflated. Use DMIN2, DN2 for DMIN and DN.
381 IF( DMIN2.EQ.DN2 .AND. TWO*Z( NN-5 ).LT.Z( NN-7 ) ) THEN
384 IF( Z( NN-5 ).GT.Z( NN-7 ) )
386 B1 = Z( NN-5 ) / Z( NN-7 )
390 DO 70 I4 = 4*N0 - 9 + PP, 4*I0 - 1 + PP, -4
391 IF( Z( I4 ).GT.Z( I4-2 ) )
393 B1 = B1*( Z( I4 ) / Z( I4-2 ) )
395 IF( HUNDRD*B1.LT.B2 )
399 B2 = SQRT( CNST3*B2 )
400 A2 = DMIN2 / ( ONE+B2**2 )
401 GAP2 = Z( NN-7 ) + Z( NN-9 ) -
402 $ SQRT( Z( NN-11 ) )*SQRT( Z( NN-9 ) ) - A2
403 IF( GAP2.GT.ZERO .AND. GAP2.GT.B2*A2 ) THEN
404 S = MAX( S, A2*( ONE-CNST2*A2*( B2 / GAP2 )*B2 ) )
406 S = MAX( S, A2*( ONE-CNST2*B2 ) )
412 ELSE IF( N0IN.GT.( N0+2 ) ) THEN
414 * Case 12, more than two eigenvalues deflated. No information.