256 SUBROUTINE slaqr0( WANTT, WANTZ, N, ILO, IHI, H, LDH, WR, WI,
257 $ iloz, ihiz, z, ldz, work, lwork, info )
265 INTEGER IHI, IHIZ, ILO, ILOZ, INFO, LDH, LDZ, LWORK, N
269 REAL H( ldh, * ), WI( * ), WORK( * ), WR( * ),
280 parameter ( ntiny = 11 )
286 parameter ( kexnw = 5 )
292 parameter ( kexsh = 6 )
297 parameter ( wilk1 = 0.75e0, wilk2 = -0.4375e0 )
299 parameter ( zero = 0.0e0, one = 1.0e0 )
302 REAL AA, BB, CC, CS, DD, SN, SS, SWAP
303 INTEGER I, INF, IT, ITMAX, K, KACC22, KBOT, KDU, KS,
304 $ kt, ktop, ku, kv, kwh, kwtop, kwv, ld, ls,
305 $ lwkopt, ndec, ndfl, nh, nho, nibble, nmin, ns,
306 $ nsmax, nsr, nve, nw, nwmax, nwr, nwupbd
321 INTRINSIC abs, int, max, min, mod, real
333 IF( n.LE.ntiny )
THEN
339 $
CALL slahqr( wantt, wantz, n, ilo, ihi, h, ldh, wr, wi,
340 $ iloz, ihiz, z, ldz, info )
369 nwr = ilaenv( 13,
'SLAQR0', jbcmpz, n, ilo, ihi, lwork )
371 nwr = min( ihi-ilo+1, ( n-1 ) / 3, nwr )
378 nsr = ilaenv( 15,
'SLAQR0', jbcmpz, n, ilo, ihi, lwork )
379 nsr = min( nsr, ( n+6 ) / 9, ihi-ilo )
380 nsr = max( 2, nsr-mod( nsr, 2 ) )
386 CALL slaqr3( wantt, wantz, n, ilo, ihi, nwr+1, h, ldh, iloz,
387 $ ihiz, z, ldz, ls, ld, wr, wi, h, ldh, n, h, ldh,
388 $ n, h, ldh, work, -1 )
392 lwkopt = max( 3*nsr / 2, int( work( 1 ) ) )
396 IF( lwork.EQ.-1 )
THEN
397 work( 1 ) =
REAL( lwkopt )
403 nmin = ilaenv( 12,
'SLAQR0', jbcmpz, n, ilo, ihi, lwork )
404 nmin = max( ntiny, nmin )
408 nibble = ilaenv( 14,
'SLAQR0', jbcmpz, n, ilo, ihi, lwork )
409 nibble = max( 0, nibble )
414 kacc22 = ilaenv( 16,
'SLAQR0', jbcmpz, n, ilo, ihi, lwork )
415 kacc22 = max( 0, kacc22 )
416 kacc22 = min( 2, kacc22 )
421 nwmax = min( ( n-1 ) / 3, lwork / 2 )
427 nsmax = min( ( n+6 ) / 9, 2*lwork / 3 )
428 nsmax = nsmax - mod( nsmax, 2 )
436 itmax = max( 30, 2*kexsh )*max( 10, ( ihi-ilo+1 ) )
453 DO 10 k = kbot, ilo + 1, -1
454 IF( h( k, k-1 ).EQ.zero )
478 nwupbd = min( nh, nwmax )
479 IF( ndfl.LT.kexnw )
THEN
480 nw = min( nwupbd, nwr )
482 nw = min( nwupbd, 2*nw )
484 IF( nw.LT.nwmax )
THEN
485 IF( nw.GE.nh-1 )
THEN
488 kwtop = kbot - nw + 1
489 IF( abs( h( kwtop, kwtop-1 ) ).GT.
490 $ abs( h( kwtop-1, kwtop-2 ) ) )nw = nw + 1
493 IF( ndfl.LT.kexnw )
THEN
495 ELSE IF( ndec.GE.0 .OR. nw.GE.nwupbd )
THEN
515 nho = ( n-nw-1 ) - kt + 1
517 nve = ( n-nw ) - kwv + 1
521 CALL slaqr3( wantt, wantz, n, ktop, kbot, nw, h, ldh, iloz,
522 $ ihiz, z, ldz, ls, ld, wr, wi, h( kv, 1 ), ldh,
523 $ nho, h( kv, kt ), ldh, nve, h( kwv, 1 ), ldh,
540 IF( ( ld.EQ.0 ) .OR. ( ( 100*ld.LE.nw*nibble ) .AND. ( kbot-
541 $ ktop+1.GT.min( nmin, nwmax ) ) ) )
THEN
547 ns = min( nsmax, nsr, max( 2, kbot-ktop ) )
548 ns = ns - mod( ns, 2 )
557 IF( mod( ndfl, kexsh ).EQ.0 )
THEN
559 DO 30 i = kbot, max( ks+1, ktop+2 ), -2
560 ss = abs( h( i, i-1 ) ) + abs( h( i-1, i-2 ) )
561 aa = wilk1*ss + h( i, i )
565 CALL slanv2( aa, bb, cc, dd, wr( i-1 ), wi( i-1 ),
566 $ wr( i ), wi( i ), cs, sn )
568 IF( ks.EQ.ktop )
THEN
569 wr( ks+1 ) = h( ks+1, ks+1 )
571 wr( ks ) = wr( ks+1 )
572 wi( ks ) = wi( ks+1 )
582 IF( kbot-ks+1.LE.ns / 2 )
THEN
585 CALL slacpy(
'A', ns, ns, h( ks, ks ), ldh,
587 IF( ns.GT.nmin )
THEN
588 CALL slaqr4( .false., .false., ns, 1, ns,
589 $ h( kt, 1 ), ldh, wr( ks ),
590 $ wi( ks ), 1, 1, zdum, 1, work,
593 CALL slahqr( .false., .false., ns, 1, ns,
594 $ h( kt, 1 ), ldh, wr( ks ),
595 $ wi( ks ), 1, 1, zdum, 1, inf )
603 IF( ks.GE.kbot )
THEN
604 aa = h( kbot-1, kbot-1 )
605 cc = h( kbot, kbot-1 )
606 bb = h( kbot-1, kbot )
608 CALL slanv2( aa, bb, cc, dd, wr( kbot-1 ),
609 $ wi( kbot-1 ), wr( kbot ),
610 $ wi( kbot ), cs, sn )
615 IF( kbot-ks+1.GT.ns )
THEN
622 DO 50 k = kbot, ks + 1, -1
627 IF( abs( wr( i ) )+abs( wi( i ) ).LT.
628 $ abs( wr( i+1 ) )+abs( wi( i+1 ) ) )
THEN
650 DO 70 i = kbot, ks + 2, -2
651 IF( wi( i ).NE.-wi( i-1 ) )
THEN
655 wr( i-1 ) = wr( i-2 )
660 wi( i-1 ) = wi( i-2 )
669 IF( kbot-ks+1.EQ.2 )
THEN
670 IF( wi( kbot ).EQ.zero )
THEN
671 IF( abs( wr( kbot )-h( kbot, kbot ) ).LT.
672 $ abs( wr( kbot-1 )-h( kbot, kbot ) ) )
THEN
673 wr( kbot-1 ) = wr( kbot )
675 wr( kbot ) = wr( kbot-1 )
685 ns = min( ns, kbot-ks+1 )
686 ns = ns - mod( ns, 2 )
703 nho = ( n-kdu+1-4 ) - ( kdu+1 ) + 1
705 nve = n - kdu - kwv + 1
709 CALL slaqr5( wantt, wantz, kacc22, n, ktop, kbot, ns,
710 $ wr( ks ), wi( ks ), h, ldh, iloz, ihiz, z,
711 $ ldz, work, 3, h( ku, 1 ), ldh, nve,
712 $ h( kwv, 1 ), ldh, nho, h( ku, kwh ), ldh )
735 work( 1 ) =
REAL( lwkopt )
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, using the double-shift/single-shift QR algorithm.
subroutine slaqr0(WANTT, WANTZ, N, ILO, IHI, H, LDH, WR, WI, ILOZ, IHIZ, Z, LDZ, WORK, LWORK, INFO)
SLAQR0 computes the eigenvalues of a Hessenberg matrix, and optionally the matrices from the Schur de...
subroutine slaqr3(WANTT, WANTZ, N, KTOP, KBOT, NW, H, LDH, ILOZ, IHIZ, Z, LDZ, NS, ND, SR, SI, V, LDV, NH, T, LDT, NV, WV, LDWV, WORK, LWORK)
SLAQR3 performs the orthogonal similarity transformation of a Hessenberg matrix to detect and deflate...
subroutine slacpy(UPLO, M, N, A, LDA, B, LDB)
SLACPY copies all or part of one two-dimensional array to another.
subroutine slaqr5(WANTT, WANTZ, KACC22, N, KTOP, KBOT, NSHFTS, SR, SI, H, LDH, ILOZ, IHIZ, Z, LDZ, V, LDV, U, LDU, NV, WV, LDWV, NH, WH, LDWH)
SLAQR5 performs a single small-bulge multi-shift QR sweep.
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 slaqr4(WANTT, WANTZ, N, ILO, IHI, H, LDH, WR, WI, ILOZ, IHIZ, Z, LDZ, WORK, LWORK, INFO)
SLAQR4 computes the eigenvalues of a Hessenberg matrix, and optionally the matrices from the Schur de...