254 SUBROUTINE dlaqr0( WANTT, WANTZ, N, ILO, IHI, H, LDH, WR, WI,
255 $ ILOZ, IHIZ, Z, LDZ, WORK, LWORK, INFO )
262 INTEGER IHI, IHIZ, ILO, ILOZ, INFO, LDH, LDZ, LWORK, N
266 DOUBLE PRECISION H( LDH, * ), WI( * ), WORK( * ), WR( * ),
278 parameter( ntiny = 15 )
284 parameter( kexnw = 5 )
290 parameter( kexsh = 6 )
294 DOUBLE PRECISION WILK1, WILK2
295 parameter( wilk1 = 0.75d0, wilk2 = -0.4375d0 )
296 DOUBLE PRECISION ZERO, ONE
297 parameter( zero = 0.0d0, one = 1.0d0 )
300 DOUBLE PRECISION AA, BB, CC, CS, DD, SN, SS, SWAP
301 INTEGER I, INF, IT, ITMAX, K, KACC22, KBOT, KDU, KS,
302 $ kt, ktop, ku, kv, kwh, kwtop, kwv, ld, ls,
303 $ lwkopt, ndec, ndfl, nh, nho, nibble, nmin, ns,
304 $ nsmax, nsr, nve, nw, nwmax, nwr, nwupbd
313 DOUBLE PRECISION ZDUM( 1, 1 )
319 INTRINSIC abs, dble, int, max, min, mod
331 IF( n.LE.ntiny )
THEN
337 $
CALL dlahqr( wantt, wantz, n, ilo, ihi, h, ldh, wr, wi,
338 $ iloz, ihiz, z, ldz, info )
367 nwr = ilaenv( 13,
'DLAQR0', jbcmpz, n, ilo, ihi, lwork )
369 nwr = min( ihi-ilo+1, ( n-1 ) / 3, nwr )
376 nsr = ilaenv( 15,
'DLAQR0', jbcmpz, n, ilo, ihi, lwork )
377 nsr = min( nsr, ( n-3 ) / 6, ihi-ilo )
378 nsr = max( 2, nsr-mod( nsr, 2 ) )
384 CALL dlaqr3( wantt, wantz, n, ilo, ihi, nwr+1, h, ldh, iloz,
385 $ ihiz, z, ldz, ls, ld, wr, wi, h, ldh, n, h, ldh,
386 $ n, h, ldh, work, -1 )
390 lwkopt = max( 3*nsr / 2, int( work( 1 ) ) )
394 IF( lwork.EQ.-1 )
THEN
395 work( 1 ) = dble( lwkopt )
401 nmin = ilaenv( 12,
'DLAQR0', jbcmpz, n, ilo, ihi, lwork )
402 nmin = max( ntiny, nmin )
406 nibble = ilaenv( 14,
'DLAQR0', jbcmpz, n, ilo, ihi, lwork )
407 nibble = max( 0, nibble )
412 kacc22 = ilaenv( 16,
'DLAQR0', jbcmpz, n, ilo, ihi, lwork )
413 kacc22 = max( 0, kacc22 )
414 kacc22 = min( 2, kacc22 )
419 nwmax = min( ( n-1 ) / 3, lwork / 2 )
425 nsmax = min( ( n-3 ) / 6, 2*lwork / 3 )
426 nsmax = nsmax - mod( nsmax, 2 )
434 itmax = max( 30, 2*kexsh )*max( 10, ( ihi-ilo+1 ) )
451 DO 10 k = kbot, ilo + 1, -1
452 IF( h( k, k-1 ).EQ.zero )
476 nwupbd = min( nh, nwmax )
477 IF( ndfl.LT.kexnw )
THEN
478 nw = min( nwupbd, nwr )
480 nw = min( nwupbd, 2*nw )
482 IF( nw.LT.nwmax )
THEN
483 IF( nw.GE.nh-1 )
THEN
486 kwtop = kbot - nw + 1
487 IF( abs( h( kwtop, kwtop-1 ) ).GT.
488 $ abs( h( kwtop-1, kwtop-2 ) ) )nw = nw + 1
491 IF( ndfl.LT.kexnw )
THEN
493 ELSE IF( ndec.GE.0 .OR. nw.GE.nwupbd )
THEN
513 nho = ( n-nw-1 ) - kt + 1
515 nve = ( n-nw ) - kwv + 1
519 CALL dlaqr3( wantt, wantz, n, ktop, kbot, nw, h, ldh, iloz,
520 $ ihiz, z, ldz, ls, ld, wr, wi, h( kv, 1 ), ldh,
521 $ nho, h( kv, kt ), ldh, nve, h( kwv, 1 ), ldh,
538 IF( ( ld.EQ.0 ) .OR. ( ( 100*ld.LE.nw*nibble ) .AND. ( kbot-
539 $ ktop+1.GT.min( nmin, nwmax ) ) ) )
THEN
545 ns = min( nsmax, nsr, max( 2, kbot-ktop ) )
546 ns = ns - mod( ns, 2 )
555 IF( mod( ndfl, kexsh ).EQ.0 )
THEN
557 DO 30 i = kbot, max( ks+1, ktop+2 ), -2
558 ss = abs( h( i, i-1 ) ) + abs( h( i-1, i-2 ) )
559 aa = wilk1*ss + h( i, i )
563 CALL dlanv2( aa, bb, cc, dd, wr( i-1 ), wi( i-1 ),
564 $ wr( i ), wi( i ), cs, sn )
566 IF( ks.EQ.ktop )
THEN
567 wr( ks+1 ) = h( ks+1, ks+1 )
569 wr( ks ) = wr( ks+1 )
570 wi( ks ) = wi( ks+1 )
580 IF( kbot-ks+1.LE.ns / 2 )
THEN
583 CALL dlacpy(
'A', ns, ns, h( ks, ks ), ldh,
585 IF( ns.GT.nmin )
THEN
586 CALL dlaqr4( .false., .false., ns, 1, ns,
587 $ h( kt, 1 ), ldh, wr( ks ),
588 $ wi( ks ), 1, 1, zdum, 1, work,
591 CALL dlahqr( .false., .false., ns, 1, ns,
592 $ h( kt, 1 ), ldh, wr( ks ),
593 $ wi( ks ), 1, 1, zdum, 1, inf )
601 IF( ks.GE.kbot )
THEN
602 aa = h( kbot-1, kbot-1 )
603 cc = h( kbot, kbot-1 )
604 bb = h( kbot-1, kbot )
606 CALL dlanv2( aa, bb, cc, dd, wr( kbot-1 ),
607 $ wi( kbot-1 ), wr( kbot ),
608 $ wi( kbot ), cs, sn )
613 IF( kbot-ks+1.GT.ns )
THEN
620 DO 50 k = kbot, ks + 1, -1
625 IF( abs( wr( i ) )+abs( wi( i ) ).LT.
626 $ abs( wr( i+1 ) )+abs( wi( i+1 ) ) )
THEN
648 DO 70 i = kbot, ks + 2, -2
649 IF( wi( i ).NE.-wi( i-1 ) )
THEN
653 wr( i-1 ) = wr( i-2 )
658 wi( i-1 ) = wi( i-2 )
667 IF( kbot-ks+1.EQ.2 )
THEN
668 IF( wi( kbot ).EQ.zero )
THEN
669 IF( abs( wr( kbot )-h( kbot, kbot ) ).LT.
670 $ abs( wr( kbot-1 )-h( kbot, kbot ) ) )
THEN
671 wr( kbot-1 ) = wr( kbot )
673 wr( kbot ) = wr( kbot-1 )
683 ns = min( ns, kbot-ks+1 )
684 ns = ns - mod( ns, 2 )
701 nho = ( n-kdu+1-4 ) - ( kdu+1 ) + 1
703 nve = n - kdu - kwv + 1
707 CALL dlaqr5( wantt, wantz, kacc22, n, ktop, kbot, ns,
708 $ wr( ks ), wi( ks ), h, ldh, iloz, ihiz, z,
709 $ ldz, work, 3, h( ku, 1 ), ldh, nve,
710 $ h( kwv, 1 ), ldh, nho, h( ku, kwh ), ldh )
733 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 dlaqr0(wantt, wantz, n, ilo, ihi, h, ldh, wr, wi, iloz, ihiz, z, ldz, work, lwork, info)
DLAQR0 computes the eigenvalues of a Hessenberg matrix, and optionally the matrices from the Schur de...
subroutine dlaqr3(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)
DLAQR3 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.