126 parameter( cbias = 1.50e0 )
127 REAL ZERO, HALF, ONE, TWO, FOUR, HUNDRD
128 parameter( zero = 0.0e0, half = 0.5e0, one = 1.0e0,
129 $ two = 2.0e0, four = 4.0e0, hundrd = 100.0e0 )
133 INTEGER I0, I4, IINFO, IPN4, ITER, IWHILA, IWHILB, K,
134 $ KMIN, N0, NBIG, NDIV, NFAIL, PP, SPLT, TTYPE,
136 REAL D, DEE, DEEMIN, DESIG, DMIN, DMIN1, DMIN2, DN,
137 $ DN1, DN2, E, EMAX, EMIN, EPS, G, OLDEMN, QMAX,
138 $ QMIN, S, SAFMIN, SIGMA, T, TAU, TEMP, TOL,
139 $ TOL2, TRACE, ZMAX, TEMPE, TEMPQ
149 INTRINSIC abs, max, min, real, sqrt
157 eps = slamch(
'Precision' )
158 safmin = slamch(
'Safe minimum' )
164 CALL xerbla(
'SLASQ2', 1 )
166 ELSE IF( n.EQ.0 )
THEN
168 ELSE IF( n.EQ.1 )
THEN
172 IF( z( 1 ).LT.zero )
THEN
174 CALL xerbla(
'SLASQ2', 2 )
177 ELSE IF( n.EQ.2 )
THEN
181 IF( z( 1 ).LT.zero )
THEN
183 CALL xerbla(
'SLASQ2', 2 )
185 ELSE IF( z( 2 ).LT.zero )
THEN
187 CALL xerbla(
'SLASQ2', 2 )
189 ELSE IF( z( 3 ).LT.zero )
THEN
191 CALL xerbla(
'SLASQ2', 2 )
193 ELSE IF( z( 3 ).GT.z( 1 ) )
THEN
198 z( 5 ) = z( 1 ) + z( 2 ) + z( 3 )
199 IF( z( 2 ).GT.z( 3 )*tol2 )
THEN
200 t = half*( ( z( 1 )-z( 3 ) )+z( 2 ) )
201 s = z( 3 )*( z( 2 ) / t )
203 s = z( 3 )*( z( 2 ) / ( t*( one+sqrt( one+s / t ) ) ) )
205 s = z( 3 )*( z( 2 ) / ( t+sqrt( t )*sqrt( t+s ) ) )
207 t = z( 1 ) + ( s+z( 2 ) )
208 z( 3 ) = z( 3 )*( z( 1 ) / t )
212 z( 6 ) = z( 2 ) + z( 1 )
225 DO 10 k = 1, 2*( n-1 ), 2
226 IF( z( k ).LT.zero )
THEN
228 CALL xerbla(
'SLASQ2', 2 )
230 ELSE IF( z( k+1 ).LT.zero )
THEN
232 CALL xerbla(
'SLASQ2', 2 )
237 qmax = max( qmax, z( k ) )
238 emin = min( emin, z( k+1 ) )
239 zmax = max( qmax, zmax, z( k+1 ) )
241 IF( z( 2*n-1 ).LT.zero )
THEN
242 info = -( 200+2*n-1 )
243 CALL xerbla(
'SLASQ2', 2 )
247 qmax = max( qmax, z( 2*n-1 ) )
248 zmax = max( qmax, zmax )
256 CALL slasrt(
'D', n, z, iinfo )
265 IF( trace.EQ.zero )
THEN
285 z( 2*k-3 ) = z( k-1 )
293 IF( cbias*z( 4*i0-3 ).LT.z( 4*n0-3 ) )
THEN
295 DO 40 i4 = 4*i0, 2*( i0+n0-1 ), 4
297 z( i4-3 ) = z( ipn4-i4-3 )
298 z( ipn4-i4-3 ) = temp
300 z( i4-1 ) = z( ipn4-i4-5 )
301 z( ipn4-i4-5 ) = temp
312 DO 50 i4 = 4*( n0-1 ) + pp, 4*i0 + pp, -4
313 IF( z( i4-1 ).LE.tol2*d )
THEN
317 d = z( i4-3 )*( d / ( d+z( i4-1 ) ) )
323 emin = z( 4*i0+pp+1 )
325 DO 60 i4 = 4*i0 + pp, 4*( n0-1 ) + pp, 4
326 z( i4-2*pp-2 ) = d + z( i4-1 )
327 IF( z( i4-1 ).LE.tol2*d )
THEN
332 ELSE IF( safmin*z( i4+1 ).LT.z( i4-2*pp-2 ) .AND.
333 $ safmin*z( i4-2*pp-2 ).LT.z( i4+1 ) )
THEN
334 temp = z( i4+1 ) / z( i4-2*pp-2 )
335 z( i4-2*pp ) = z( i4-1 )*temp
338 z( i4-2*pp ) = z( i4+1 )*( z( i4-1 ) / z( i4-2*pp-2 ) )
339 d = z( i4+1 )*( d / z( i4-2*pp-2 ) )
341 emin = min( emin, z( i4-2*pp ) )
347 qmax = z( 4*i0-pp-2 )
348 DO 70 i4 = 4*i0 - pp + 2, 4*n0 - pp - 2, 4
349 qmax = max( qmax, z( i4 ) )
372 DO 160 iwhila = 1, n + 1
387 IF( sigma.LT.zero )
THEN
397 emin = abs( z( 4*n0-5 ) )
403 DO 90 i4 = 4*n0, 8, -4
404 IF( z( i4-5 ).LE.zero )
406 IF( qmin.GE.four*emax )
THEN
407 qmin = min( qmin, z( i4-3 ) )
408 emax = max( emax, z( i4-5 ) )
410 qmax = max( qmax, z( i4-7 )+z( i4-5 ) )
411 emin = min( emin, z( i4-5 ) )
419 IF( n0-i0.GT.1 )
THEN
423 DO 110 i4 = 4*i0+1, 4*n0-3, 4
424 dee = z( i4 )*( dee /( dee+z( i4-2 ) ) )
425 IF( dee.LE.deemin )
THEN
430 IF( (kmin-i0)*2.LT.n0-kmin .AND.
431 $ deemin.LE.half*z(4*n0-3) )
THEN
434 DO 120 i4 = 4*i0, 2*( i0+n0-1 ), 4
436 z( i4-3 ) = z( ipn4-i4-3 )
437 z( ipn4-i4-3 ) = temp
439 z( i4-2 ) = z( ipn4-i4-2 )
440 z( ipn4-i4-2 ) = temp
442 z( i4-1 ) = z( ipn4-i4-5 )
443 z( ipn4-i4-5 ) = temp
445 z( i4 ) = z( ipn4-i4-4 )
446 z( ipn4-i4-4 ) = temp
453 dmin = -max( zero, qmin-two*sqrt( qmin )*sqrt( emax ) )
461 nbig = 100*( n0-i0+1 )
462 DO 140 iwhilb = 1, nbig
468 CALL slasq3( i0, n0, z, pp, dmin, sigma, desig, qmax,
470 $ iter, ndiv, ieee, ttype, dmin1, dmin2, dn, dn1,
477 IF( pp.EQ.0 .AND. n0-i0.GE.3 )
THEN
478 IF( z( 4*n0 ).LE.tol2*qmax .OR.
479 $ z( 4*n0-1 ).LE.tol2*sigma )
THEN
484 DO 130 i4 = 4*i0, 4*( n0-3 ), 4
485 IF( z( i4 ).LE.tol2*z( i4-3 ) .OR.
486 $ z( i4-1 ).LE.tol2*sigma )
THEN
493 qmax = max( qmax, z( i4+1 ) )
494 emin = min( emin, z( i4-1 ) )
495 oldemn = min( oldemn, z( i4 ) )
516 z( 4*i0-3 ) = z( 4*i0-3 ) + sigma
519 z( 4*k-5 ) = z( 4*k-5 ) * (tempq / z( 4*k-7 ))
521 z( 4*k-3 ) = z( 4*k-3 ) + sigma + tempe - z( 4*k-5 )
528 DO WHILE( ( i1.GE.2 ) .AND. ( z(4*i1-5).GE.zero ) )
538 z( 2*k-1 ) = z( 4*k-3 )
545 z( 2*k ) = z( 4*k-1 )
573 CALL slasrt(
'D', n, z, iinfo )
584 z( 2*n+3 ) = real( iter )
585 z( 2*n+4 ) = real( ndiv ) / real( n**2 )
586 z( 2*n+5 ) = hundrd*real( nfail / iter )
subroutine slasq3(i0, n0, z, pp, dmin, sigma, desig, qmax, nfail, iter, ndiv, ieee, ttype, dmin1, dmin2, dn, dn1, dn2, g, tau)
SLASQ3 checks for deflation, computes a shift and calls dqds. Used by sbdsqr.