121 DOUBLE PRECISION Z( * )
127 DOUBLE PRECISION CBIAS
128 parameter( cbias = 1.50d0 )
129 DOUBLE PRECISION ZERO, HALF, ONE, TWO, FOUR, HUNDRD
130 parameter( zero = 0.0d0, half = 0.5d0, one = 1.0d0,
131 $ two = 2.0d0, four = 4.0d0, hundrd = 100.0d0 )
135 INTEGER I0, I1, I4, IINFO, IPN4, ITER, IWHILA, IWHILB,
136 $ K, KMIN, N0, N1, NBIG, NDIV, NFAIL, PP, SPLT,
138 DOUBLE PRECISION D, DEE, DEEMIN, DESIG, DMIN, DMIN1, DMIN2, DN,
139 $ DN1, DN2, E, EMAX, EMIN, EPS, G, OLDEMN, QMAX,
140 $ QMIN, S, SAFMIN, SIGMA, T, TAU, TEMP, TOL,
141 $ TOL2, TRACE, ZMAX, TEMPE, TEMPQ
148 DOUBLE PRECISION DLAMCH
149 EXTERNAL dlamch, ilaenv
152 INTRINSIC abs, dble, max, min, sqrt
160 eps = dlamch(
'Precision' )
161 safmin = dlamch(
'Safe minimum' )
167 CALL xerbla(
'DLASQ2', 1 )
169 ELSE IF( n.EQ.0 )
THEN
171 ELSE IF( n.EQ.1 )
THEN
175 IF( z( 1 ).LT.zero )
THEN
177 CALL xerbla(
'DLASQ2', 2 )
180 ELSE IF( n.EQ.2 )
THEN
184 IF( z( 1 ).LT.zero )
THEN
186 CALL xerbla(
'DLASQ2', 2 )
188 ELSE IF( z( 2 ).LT.zero )
THEN
190 CALL xerbla(
'DLASQ2', 2 )
192 ELSE IF( z( 3 ).LT.zero )
THEN
194 CALL xerbla(
'DLASQ2', 2 )
196 ELSE IF( z( 3 ).GT.z( 1 ) )
THEN
201 z( 5 ) = z( 1 ) + z( 2 ) + z( 3 )
202 IF( z( 2 ).GT.z( 3 )*tol2 )
THEN
203 t = half*( ( z( 1 )-z( 3 ) )+z( 2 ) )
204 s = z( 3 )*( z( 2 ) / t )
206 s = z( 3 )*( z( 2 ) / ( t*( one+sqrt( one+s / t ) ) ) )
208 s = z( 3 )*( z( 2 ) / ( t+sqrt( t )*sqrt( t+s ) ) )
210 t = z( 1 ) + ( s+z( 2 ) )
211 z( 3 ) = z( 3 )*( z( 1 ) / t )
215 z( 6 ) = z( 2 ) + z( 1 )
228 DO 10 k = 1, 2*( n-1 ), 2
229 IF( z( k ).LT.zero )
THEN
231 CALL xerbla(
'DLASQ2', 2 )
233 ELSE IF( z( k+1 ).LT.zero )
THEN
235 CALL xerbla(
'DLASQ2', 2 )
240 qmax = max( qmax, z( k ) )
241 emin = min( emin, z( k+1 ) )
242 zmax = max( qmax, zmax, z( k+1 ) )
244 IF( z( 2*n-1 ).LT.zero )
THEN
245 info = -( 200+2*n-1 )
246 CALL xerbla(
'DLASQ2', 2 )
250 qmax = max( qmax, z( 2*n-1 ) )
251 zmax = max( qmax, zmax )
259 CALL dlasrt(
'D', n, z, iinfo )
268 IF( trace.EQ.zero )
THEN
275 ieee = ( ilaenv( 10,
'DLASQ2',
'N', 1, 2, 3, 4 ).EQ.1 )
283 z( 2*k-3 ) = z( k-1 )
291 IF( cbias*z( 4*i0-3 ).LT.z( 4*n0-3 ) )
THEN
293 DO 40 i4 = 4*i0, 2*( i0+n0-1 ), 4
295 z( i4-3 ) = z( ipn4-i4-3 )
296 z( ipn4-i4-3 ) = temp
298 z( i4-1 ) = z( ipn4-i4-5 )
299 z( ipn4-i4-5 ) = temp
310 DO 50 i4 = 4*( n0-1 ) + pp, 4*i0 + pp, -4
311 IF( z( i4-1 ).LE.tol2*d )
THEN
315 d = z( i4-3 )*( d / ( d+z( i4-1 ) ) )
321 emin = z( 4*i0+pp+1 )
323 DO 60 i4 = 4*i0 + pp, 4*( n0-1 ) + pp, 4
324 z( i4-2*pp-2 ) = d + z( i4-1 )
325 IF( z( i4-1 ).LE.tol2*d )
THEN
330 ELSE IF( safmin*z( i4+1 ).LT.z( i4-2*pp-2 ) .AND.
331 $ safmin*z( i4-2*pp-2 ).LT.z( i4+1 ) )
THEN
332 temp = z( i4+1 ) / z( i4-2*pp-2 )
333 z( i4-2*pp ) = z( i4-1 )*temp
336 z( i4-2*pp ) = z( i4+1 )*( z( i4-1 ) / z( i4-2*pp-2 ) )
337 d = z( i4+1 )*( d / z( i4-2*pp-2 ) )
339 emin = min( emin, z( i4-2*pp ) )
345 qmax = z( 4*i0-pp-2 )
346 DO 70 i4 = 4*i0 - pp + 2, 4*n0 - pp - 2, 4
347 qmax = max( qmax, z( i4 ) )
370 DO 160 iwhila = 1, n + 1
385 IF( sigma.LT.zero )
THEN
395 emin = abs( z( 4*n0-5 ) )
401 DO 90 i4 = 4*n0, 8, -4
402 IF( z( i4-5 ).LE.zero )
404 IF( qmin.GE.four*emax )
THEN
405 qmin = min( qmin, z( i4-3 ) )
406 emax = max( emax, z( i4-5 ) )
408 qmax = max( qmax, z( i4-7 )+z( i4-5 ) )
409 emin = min( emin, z( i4-5 ) )
417 IF( n0-i0.GT.1 )
THEN
421 DO 110 i4 = 4*i0+1, 4*n0-3, 4
422 dee = z( i4 )*( dee /( dee+z( i4-2 ) ) )
423 IF( dee.LE.deemin )
THEN
428 IF( (kmin-i0)*2.LT.n0-kmin .AND.
429 $ deemin.LE.half*z(4*n0-3) )
THEN
432 DO 120 i4 = 4*i0, 2*( i0+n0-1 ), 4
434 z( i4-3 ) = z( ipn4-i4-3 )
435 z( ipn4-i4-3 ) = temp
437 z( i4-2 ) = z( ipn4-i4-2 )
438 z( ipn4-i4-2 ) = temp
440 z( i4-1 ) = z( ipn4-i4-5 )
441 z( ipn4-i4-5 ) = temp
443 z( i4 ) = z( ipn4-i4-4 )
444 z( ipn4-i4-4 ) = temp
451 dmin = -max( zero, qmin-two*sqrt( qmin )*sqrt( emax ) )
459 nbig = 100*( n0-i0+1 )
460 DO 140 iwhilb = 1, nbig
466 CALL dlasq3( i0, n0, z, pp, dmin, sigma, desig, qmax, nfail,
467 $ iter, ndiv, ieee, ttype, dmin1, dmin2, dn, dn1,
474 IF( pp.EQ.0 .AND. n0-i0.GE.3 )
THEN
475 IF( z( 4*n0 ).LE.tol2*qmax .OR.
476 $ z( 4*n0-1 ).LE.tol2*sigma )
THEN
481 DO 130 i4 = 4*i0, 4*( n0-3 ), 4
482 IF( z( i4 ).LE.tol2*z( i4-3 ) .OR.
483 $ z( i4-1 ).LE.tol2*sigma )
THEN
490 qmax = max( qmax, z( i4+1 ) )
491 emin = min( emin, z( i4-1 ) )
492 oldemn = min( oldemn, z( i4 ) )
513 z( 4*i0-3 ) = z( 4*i0-3 ) + sigma
516 z( 4*k-5 ) = z( 4*k-5 ) * (tempq / z( 4*k-7 ))
518 z( 4*k-3 ) = z( 4*k-3 ) + sigma + tempe - z( 4*k-5 )
525 DO WHILE( ( i1.GE.2 ) .AND. ( z(4*i1-5).GE.zero ) )
533 z( 2*k-1 ) = z( 4*k-3 )
540 z( 2*k ) = z( 4*k-1 )
568 CALL dlasrt(
'D', n, z, iinfo )
579 z( 2*n+3 ) = dble( iter )
580 z( 2*n+4 ) = dble( ndiv ) / dble( n**2 )
581 z( 2*n+5 ) = hundrd*nfail / dble( iter )
subroutine xerbla(srname, info)
subroutine dlasq2(n, z, info)
DLASQ2 computes all the eigenvalues of the symmetric positive definite tridiagonal matrix associated ...
subroutine dlasq3(i0, n0, z, pp, dmin, sigma, desig, qmax, nfail, iter, ndiv, ieee, ttype, dmin1, dmin2, dn, dn1, dn2, g, tau)
DLASQ3 checks for deflation, computes a shift and calls dqds. Used by sbdsqr.
subroutine dlasrt(id, n, d, info)
DLASRT sorts numbers in increasing or decreasing order.