261 SUBROUTINE dlaqr4( WANTT, WANTZ, N, ILO, IHI, H, LDH, WR, WI,
262 $ ILOZ, IHIZ, Z, LDZ, WORK, LWORK, INFO )
269 INTEGER IHI, IHIZ, ILO, ILOZ, INFO, LDH, LDZ, LWORK, N
273 DOUBLE PRECISION H( LDH, * ), WI( * ), WORK( * ), WR( * ),
284 parameter( ntiny = 15 )
290 parameter( kexnw = 5 )
296 parameter( kexsh = 6 )
300 DOUBLE PRECISION WILK1, WILK2
301 parameter( wilk1 = 0.75d0, wilk2 = -0.4375d0 )
302 DOUBLE PRECISION ZERO, ONE
303 parameter( zero = 0.0d0, one = 1.0d0 )
306 DOUBLE PRECISION AA, BB, CC, CS, DD, SN, SS, SWAP
307 INTEGER I, INF, IT, ITMAX, K, KACC22, KBOT, KDU, KS,
308 $ kt, ktop, ku, kv, kwh, kwtop, kwv, ld, ls,
309 $ lwkopt, ndec, ndfl, nh, nho, nibble, nmin, ns,
310 $ nsmax, nsr, nve, nw, nwmax, nwr, nwupbd
319 DOUBLE PRECISION ZDUM( 1, 1 )
325 INTRINSIC abs, dble, int, max, min, mod
337 IF( n.LE.ntiny )
THEN
343 $
CALL dlahqr( wantt, wantz, n, ilo, ihi, h, ldh, wr, wi,
344 $ iloz, ihiz, z, ldz, info )
373 nwr = ilaenv( 13,
'DLAQR4', jbcmpz, n, ilo, ihi, lwork )
375 nwr = min( ihi-ilo+1, ( n-1 ) / 3, nwr )
382 nsr = ilaenv( 15,
'DLAQR4', jbcmpz, n, ilo, ihi, lwork )
383 nsr = min( nsr, ( n-3 ) / 6, ihi-ilo )
384 nsr = max( 2, nsr-mod( nsr, 2 ) )
390 CALL dlaqr2( wantt, wantz, n, ilo, ihi, nwr+1, h, ldh, iloz,
391 $ ihiz, z, ldz, ls, ld, wr, wi, h, ldh, n, h, ldh,
392 $ n, h, ldh, work, -1 )
396 lwkopt = max( 3*nsr / 2, int( work( 1 ) ) )
400 IF( lwork.EQ.-1 )
THEN
401 work( 1 ) = dble( lwkopt )
407 nmin = ilaenv( 12,
'DLAQR4', jbcmpz, n, ilo, ihi, lwork )
408 nmin = max( ntiny, nmin )
412 nibble = ilaenv( 14,
'DLAQR4', jbcmpz, n, ilo, ihi, lwork )
413 nibble = max( 0, nibble )
418 kacc22 = ilaenv( 16,
'DLAQR4', jbcmpz, n, ilo, ihi, lwork )
419 kacc22 = max( 0, kacc22 )
420 kacc22 = min( 2, kacc22 )
425 nwmax = min( ( n-1 ) / 3, lwork / 2 )
431 nsmax = min( ( n-3 ) / 6, 2*lwork / 3 )
432 nsmax = nsmax - mod( nsmax, 2 )
440 itmax = max( 30, 2*kexsh )*max( 10, ( ihi-ilo+1 ) )
457 DO 10 k = kbot, ilo + 1, -1
458 IF( h( k, k-1 ).EQ.zero )
482 nwupbd = min( nh, nwmax )
483 IF( ndfl.LT.kexnw )
THEN
484 nw = min( nwupbd, nwr )
486 nw = min( nwupbd, 2*nw )
488 IF( nw.LT.nwmax )
THEN
489 IF( nw.GE.nh-1 )
THEN
492 kwtop = kbot - nw + 1
493 IF( abs( h( kwtop, kwtop-1 ) ).GT.
494 $ abs( h( kwtop-1, kwtop-2 ) ) )nw = nw + 1
497 IF( ndfl.LT.kexnw )
THEN
499 ELSE IF( ndec.GE.0 .OR. nw.GE.nwupbd )
THEN
519 nho = ( n-nw-1 ) - kt + 1
521 nve = ( n-nw ) - kwv + 1
525 CALL dlaqr2( wantt, wantz, n, ktop, kbot, nw, h, ldh, iloz,
526 $ ihiz, z, ldz, ls, ld, wr, wi, h( kv, 1 ), ldh,
527 $ nho, h( kv, kt ), ldh, nve, h( kwv, 1 ), ldh,
544 IF( ( ld.EQ.0 ) .OR. ( ( 100*ld.LE.nw*nibble ) .AND. ( kbot-
545 $ ktop+1.GT.min( nmin, nwmax ) ) ) )
THEN
551 ns = min( nsmax, nsr, max( 2, kbot-ktop ) )
552 ns = ns - mod( ns, 2 )
561 IF( mod( ndfl, kexsh ).EQ.0 )
THEN
563 DO 30 i = kbot, max( ks+1, ktop+2 ), -2
564 ss = abs( h( i, i-1 ) ) + abs( h( i-1, i-2 ) )
565 aa = wilk1*ss + h( i, i )
569 CALL dlanv2( aa, bb, cc, dd, wr( i-1 ), wi( i-1 ),
570 $ wr( i ), wi( i ), cs, sn )
572 IF( ks.EQ.ktop )
THEN
573 wr( ks+1 ) = h( ks+1, ks+1 )
575 wr( ks ) = wr( ks+1 )
576 wi( ks ) = wi( ks+1 )
586 IF( kbot-ks+1.LE.ns / 2 )
THEN
589 CALL dlacpy(
'A', ns, ns, h( ks, ks ), ldh,
591 CALL dlahqr( .false., .false., ns, 1, ns,
592 $ h( kt, 1 ), ldh, wr( ks ), wi( ks ),
593 $ 1, 1, zdum, 1, inf )
600 IF( ks.GE.kbot )
THEN
601 aa = h( kbot-1, kbot-1 )
602 cc = h( kbot, kbot-1 )
603 bb = h( kbot-1, kbot )
605 CALL dlanv2( aa, bb, cc, dd, wr( kbot-1 ),
606 $ wi( kbot-1 ), wr( kbot ),
607 $ wi( kbot ), cs, sn )
612 IF( kbot-ks+1.GT.ns )
THEN
619 DO 50 k = kbot, ks + 1, -1
624 IF( abs( wr( i ) )+abs( wi( i ) ).LT.
625 $ abs( wr( i+1 ) )+abs( wi( i+1 ) ) )
THEN
647 DO 70 i = kbot, ks + 2, -2
648 IF( wi( i ).NE.-wi( i-1 ) )
THEN
652 wr( i-1 ) = wr( i-2 )
657 wi( i-1 ) = wi( i-2 )
666 IF( kbot-ks+1.EQ.2 )
THEN
667 IF( wi( kbot ).EQ.zero )
THEN
668 IF( abs( wr( kbot )-h( kbot, kbot ) ).LT.
669 $ abs( wr( kbot-1 )-h( kbot, kbot ) ) )
THEN
670 wr( kbot-1 ) = wr( kbot )
672 wr( kbot ) = wr( kbot-1 )
682 ns = min( ns, kbot-ks+1 )
683 ns = ns - mod( ns, 2 )
700 nho = ( n-kdu+1-4 ) - ( kdu+1 ) + 1
702 nve = n - kdu - kwv + 1
706 CALL dlaqr5( wantt, wantz, kacc22, n, ktop, kbot, ns,
707 $ wr( ks ), wi( ks ), h, ldh, iloz, ihiz, z,
708 $ ldz, work, 3, h( ku, 1 ), ldh, nve,
709 $ h( kwv, 1 ), ldh, nho, h( ku, kwh ), ldh )
732 work( 1 ) = dble( lwkopt )
subroutine dlacpy(uplo, m, n, a, lda, b, ldb)
DLACPY copies all or part of one two-dimensional array to another.
subroutine dlahqr(wantt, wantz, n, ilo, ihi, h, ldh, wr, wi, iloz, ihiz, z, ldz, info)
DLAHQR computes the eigenvalues and Schur factorization of an upper Hessenberg matrix,...
subroutine dlanv2(a, b, c, d, rt1r, rt1i, rt2r, rt2i, cs, sn)
DLANV2 computes the Schur factorization of a real 2-by-2 nonsymmetric matrix in standard form.
subroutine dlaqr2(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)
DLAQR2 performs the orthogonal similarity transformation of a Hessenberg matrix to detect and deflate...
subroutine dlaqr4(wantt, wantz, n, ilo, ihi, h, ldh, wr, wi, iloz, ihiz, z, ldz, work, lwork, info)
DLAQR4 computes the eigenvalues of a Hessenberg matrix, and optionally the matrices from the Schur de...
subroutine dlaqr5(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)
DLAQR5 performs a single small-bulge multi-shift QR sweep.