205 SUBROUTINE slahqr( WANTT, WANTZ, N, ILO, IHI, H, LDH, WR, WI,
206 $ ILOZ, IHIZ, Z, LDZ, INFO )
214 INTEGER IHI, IHIZ, ILO, ILOZ, INFO, LDH, LDZ, N
218 REAL H( LDH, * ), WI( * ), WR( * ), Z( LDZ, * )
225 parameter( zero = 0.0e0, one = 1.0e0, two = 2.0e0 )
227 parameter( dat1 = 3.0e0 / 4.0e0, dat2 = -0.4375e0 )
229 parameter( kexsh = 10 )
232 REAL AA, AB, BA, BB, CS, DET, H11, H12, H21, H21S,
233 $ h22, rt1i, rt1r, rt2i, rt2r, rtdisc, s, safmax,
234 $ safmin, smlnum, sn, sum, t1, t2, t3, tr, tst,
236 INTEGER I, I1, I2, ITS, ITMAX, J, K, L, M, NH, NR, NZ,
250 INTRINSIC abs, max, min, real, sqrt
260 IF( ilo.EQ.ihi )
THEN
261 wr( ilo ) = h( ilo, ilo )
267 DO 10 j = ilo, ihi - 3
272 $ h( ihi, ihi-2 ) = zero
279 safmin = slamch(
'SAFE MINIMUM' )
280 safmax = one / safmin
281 ulp = slamch(
'PRECISION' )
282 smlnum = safmin*( real( nh ) / ulp )
295 itmax = 30 * max( 10, nh )
317 DO 140 its = 0, itmax
321 DO 30 k = i, l + 1, -1
322 IF( abs( h( k, k-1 ) ).LE.smlnum )
324 tst = abs( h( k-1, k-1 ) ) + abs( h( k, k ) )
325 IF( tst.EQ.zero )
THEN
327 $ tst = tst + abs( h( k-1, k-2 ) )
329 $ tst = tst + abs( h( k+1, k ) )
335 IF( abs( h( k, k-1 ) ).LE.ulp*tst )
THEN
336 ab = max( abs( h( k, k-1 ) ), abs( h( k-1, k ) ) )
337 ba = min( abs( h( k, k-1 ) ), abs( h( k-1, k ) ) )
338 aa = max( abs( h( k, k ) ),
339 $ abs( h( k-1, k-1 )-h( k, k ) ) )
340 bb = min( abs( h( k, k ) ),
341 $ abs( h( k-1, k-1 )-h( k, k ) ) )
343 IF( ba*( ab / s ).LE.max( smlnum,
344 $ ulp*( bb*( aa / s ) ) ) )
GO TO 40
366 IF( .NOT.wantt )
THEN
371 IF( mod(kdefl,2*kexsh).EQ.0 )
THEN
375 s = abs( h( i, i-1 ) ) + abs( h( i-1, i-2 ) )
376 h11 = dat1*s + h( i, i )
380 ELSE IF( mod(kdefl,kexsh).EQ.0 )
THEN
384 s = abs( h( l+1, l ) ) + abs( h( l+2, l+1 ) )
385 h11 = dat1*s + h( l, l )
399 s = abs( h11 ) + abs( h12 ) + abs( h21 ) + abs( h22 )
410 tr = ( h11+h22 ) / two
411 det = ( h11-tr )*( h22-tr ) - h12*h21
412 rtdisc = sqrt( abs( det ) )
413 IF( det.GE.zero )
THEN
427 IF( abs( rt1r-h22 ).LE.abs( rt2r-h22 ) )
THEN
441 DO 50 m = i - 2, l, -1
448 s = abs( h( m, m )-rt2r ) + abs( rt2i ) + abs( h21s )
449 h21s = h( m+1, m ) / s
450 v( 1 ) = h21s*h( m, m+1 ) + ( h( m, m )-rt1r )*
451 $ ( ( h( m, m )-rt2r ) / s ) - rt1i*( rt2i / s )
452 v( 2 ) = h21s*( h( m, m )+h( m+1, m+1 )-rt1r-rt2r )
453 v( 3 ) = h21s*h( m+2, m+1 )
454 s = abs( v( 1 ) ) + abs( v( 2 ) ) + abs( v( 3 ) )
460 IF( abs( h( m, m-1 ) )*( abs( v( 2 ) )+abs( v( 3 ) ) ).LE.
461 $ ulp*abs( v( 1 ) )*( abs( h( m-1, m-1 ) )+abs( h( m,
462 $ m ) )+abs( h( m+1, m+1 ) ) ) )
GO TO 60
481 $
CALL scopy( nr, h( k, k-1 ), 1, v, 1 )
482 CALL slarfg( nr, v( 1 ), v( 2 ), 1, t1 )
487 $ h( k+2, k-1 ) = zero
488 ELSE IF( m.GT.l )
THEN
493 h( k, k-1 ) = h( k, k-1 )*( one-t1 )
505 sum = h( k, j ) + v2*h( k+1, j ) + v3*h( k+2, j )
506 h( k, j ) = h( k, j ) - sum*t1
507 h( k+1, j ) = h( k+1, j ) - sum*t2
508 h( k+2, j ) = h( k+2, j ) - sum*t3
514 DO 80 j = i1, min( k+3, i )
515 sum = h( j, k ) + v2*h( j, k+1 ) + v3*h( j, k+2 )
516 h( j, k ) = h( j, k ) - sum*t1
517 h( j, k+1 ) = h( j, k+1 ) - sum*t2
518 h( j, k+2 ) = h( j, k+2 ) - sum*t3
526 sum = z( j, k ) + v2*z( j, k+1 ) + v3*z( j, k+2 )
527 z( j, k ) = z( j, k ) - sum*t1
528 z( j, k+1 ) = z( j, k+1 ) - sum*t2
529 z( j, k+2 ) = z( j, k+2 ) - sum*t3
532 ELSE IF( nr.EQ.2 )
THEN
538 sum = h( k, j ) + v2*h( k+1, j )
539 h( k, j ) = h( k, j ) - sum*t1
540 h( k+1, j ) = h( k+1, j ) - sum*t2
547 sum = h( j, k ) + v2*h( j, k+1 )
548 h( j, k ) = h( j, k ) - sum*t1
549 h( j, k+1 ) = h( j, k+1 ) - sum*t2
556 DO 120 j = iloz, ihiz
557 sum = z( j, k ) + v2*z( j, k+1 )
558 z( j, k ) = z( j, k ) - sum*t1
559 z( j, k+1 ) = z( j, k+1 ) - sum*t2
580 ELSE IF( l.EQ.i-1 )
THEN
587 CALL slanv2( h( i-1, i-1 ), h( i-1, i ), h( i, i-1 ),
588 $ h( i, i ), wr( i-1 ), wi( i-1 ), wr( i ), wi( i ),
596 $
CALL srot( i2-i, h( i-1, i+1 ), ldh, h( i, i+1 ), ldh,
598 CALL srot( i-i1-1, h( i1, i-1 ), 1, h( i1, i ), 1, cs, sn )
604 CALL srot( nz, z( iloz, i-1 ), 1, z( iloz, i ), 1, cs, sn )
subroutine scopy(n, sx, incx, sy, incy)
SCOPY
subroutine slahqr(wantt, wantz, n, ilo, ihi, h, ldh, wr, wi, iloz, ihiz, z, ldz, info)
SLAHQR computes the eigenvalues and Schur factorization of an upper Hessenberg matrix,...
subroutine slanv2(a, b, c, d, rt1r, rt1i, rt2r, rt2i, cs, sn)
SLANV2 computes the Schur factorization of a real 2-by-2 nonsymmetric matrix in standard form.
subroutine slarfg(n, alpha, x, incx, tau)
SLARFG generates an elementary reflector (Householder matrix).
subroutine srot(n, sx, incx, sy, incy, c, s)
SROT