3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download ZHGEQZ + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zhgeqz.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zhgeqz.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zhgeqz.f">
21 * SUBROUTINE ZHGEQZ( JOB, COMPQ, COMPZ, N, ILO, IHI, H, LDH, T, LDT,
22 * ALPHA, BETA, Q, LDQ, Z, LDZ, WORK, LWORK,
25 * .. Scalar Arguments ..
26 * CHARACTER COMPQ, COMPZ, JOB
27 * INTEGER IHI, ILO, INFO, LDH, LDQ, LDT, LDZ, LWORK, N
29 * .. Array Arguments ..
30 * DOUBLE PRECISION RWORK( * )
31 * COMPLEX*16 ALPHA( * ), BETA( * ), H( LDH, * ),
32 * $ Q( LDQ, * ), T( LDT, * ), WORK( * ),
42 *> ZHGEQZ computes the eigenvalues of a complex matrix pair (H,T),
43 *> where H is an upper Hessenberg matrix and T is upper triangular,
44 *> using the single-shift QZ method.
45 *> Matrix pairs of this type are produced by the reduction to
46 *> generalized upper Hessenberg form of a complex matrix pair (A,B):
48 *> A = Q1*H*Z1**H, B = Q1*T*Z1**H,
50 *> as computed by ZGGHRD.
52 *> If JOB='S', then the Hessenberg-triangular pair (H,T) is
53 *> also reduced to generalized Schur form,
55 *> H = Q*S*Z**H, T = Q*P*Z**H,
57 *> where Q and Z are unitary matrices and S and P are upper triangular.
59 *> Optionally, the unitary matrix Q from the generalized Schur
60 *> factorization may be postmultiplied into an input matrix Q1, and the
61 *> unitary matrix Z may be postmultiplied into an input matrix Z1.
62 *> If Q1 and Z1 are the unitary matrices from ZGGHRD that reduced
63 *> the matrix pair (A,B) to generalized Hessenberg form, then the output
64 *> matrices Q1*Q and Z1*Z are the unitary factors from the generalized
65 *> Schur factorization of (A,B):
67 *> A = (Q1*Q)*S*(Z1*Z)**H, B = (Q1*Q)*P*(Z1*Z)**H.
69 *> To avoid overflow, eigenvalues of the matrix pair (H,T)
70 *> (equivalently, of (A,B)) are computed as a pair of complex values
71 *> (alpha,beta). If beta is nonzero, lambda = alpha / beta is an
72 *> eigenvalue of the generalized nonsymmetric eigenvalue problem (GNEP)
74 *> and if alpha is nonzero, mu = beta / alpha is an eigenvalue of the
75 *> alternate form of the GNEP
77 *> The values of alpha and beta for the i-th eigenvalue can be read
78 *> directly from the generalized Schur form: alpha = S(i,i),
81 *> Ref: C.B. Moler & G.W. Stewart, "An Algorithm for Generalized Matrix
82 *> Eigenvalue Problems", SIAM J. Numer. Anal., 10(1973),
92 *> = 'E': Compute eigenvalues only;
93 *> = 'S': Computer eigenvalues and the Schur form.
98 *> COMPQ is CHARACTER*1
99 *> = 'N': Left Schur vectors (Q) are not computed;
100 *> = 'I': Q is initialized to the unit matrix and the matrix Q
101 *> of left Schur vectors of (H,T) is returned;
102 *> = 'V': Q must contain a unitary matrix Q1 on entry and
103 *> the product Q1*Q is returned.
108 *> COMPZ is CHARACTER*1
109 *> = 'N': Right Schur vectors (Z) are not computed;
110 *> = 'I': Q is initialized to the unit matrix and the matrix Z
111 *> of right Schur vectors of (H,T) is returned;
112 *> = 'V': Z must contain a unitary matrix Z1 on entry and
113 *> the product Z1*Z is returned.
119 *> The order of the matrices H, T, Q, and Z. N >= 0.
130 *> ILO and IHI mark the rows and columns of H which are in
131 *> Hessenberg form. It is assumed that A is already upper
132 *> triangular in rows and columns 1:ILO-1 and IHI+1:N.
133 *> If N > 0, 1 <= ILO <= IHI <= N; if N = 0, ILO=1 and IHI=0.
138 *> H is COMPLEX*16 array, dimension (LDH, N)
139 *> On entry, the N-by-N upper Hessenberg matrix H.
140 *> On exit, if JOB = 'S', H contains the upper triangular
141 *> matrix S from the generalized Schur factorization.
142 *> If JOB = 'E', the diagonal of H matches that of S, but
143 *> the rest of H is unspecified.
149 *> The leading dimension of the array H. LDH >= max( 1, N ).
154 *> T is COMPLEX*16 array, dimension (LDT, N)
155 *> On entry, the N-by-N upper triangular matrix T.
156 *> On exit, if JOB = 'S', T contains the upper triangular
157 *> matrix P from the generalized Schur factorization.
158 *> If JOB = 'E', the diagonal of T matches that of P, but
159 *> the rest of T is unspecified.
165 *> The leading dimension of the array T. LDT >= max( 1, N ).
170 *> ALPHA is COMPLEX*16 array, dimension (N)
171 *> The complex scalars alpha that define the eigenvalues of
172 *> GNEP. ALPHA(i) = S(i,i) in the generalized Schur
178 *> BETA is COMPLEX*16 array, dimension (N)
179 *> The real non-negative scalars beta that define the
180 *> eigenvalues of GNEP. BETA(i) = P(i,i) in the generalized
181 *> Schur factorization.
183 *> Together, the quantities alpha = ALPHA(j) and beta = BETA(j)
184 *> represent the j-th eigenvalue of the matrix pair (A,B), in
185 *> one of the forms lambda = alpha/beta or mu = beta/alpha.
186 *> Since either lambda or mu may overflow, they should not,
187 *> in general, be computed.
192 *> Q is COMPLEX*16 array, dimension (LDQ, N)
193 *> On entry, if COMPQ = 'V', the unitary matrix Q1 used in the
194 *> reduction of (A,B) to generalized Hessenberg form.
195 *> On exit, if COMPQ = 'I', the unitary matrix of left Schur
196 *> vectors of (H,T), and if COMPQ = 'V', the unitary matrix of
197 *> left Schur vectors of (A,B).
198 *> Not referenced if COMPQ = 'N'.
204 *> The leading dimension of the array Q. LDQ >= 1.
205 *> If COMPQ='V' or 'I', then LDQ >= N.
210 *> Z is COMPLEX*16 array, dimension (LDZ, N)
211 *> On entry, if COMPZ = 'V', the unitary matrix Z1 used in the
212 *> reduction of (A,B) to generalized Hessenberg form.
213 *> On exit, if COMPZ = 'I', the unitary matrix of right Schur
214 *> vectors of (H,T), and if COMPZ = 'V', the unitary matrix of
215 *> right Schur vectors of (A,B).
216 *> Not referenced if COMPZ = 'N'.
222 *> The leading dimension of the array Z. LDZ >= 1.
223 *> If COMPZ='V' or 'I', then LDZ >= N.
228 *> WORK is COMPLEX*16 array, dimension (MAX(1,LWORK))
229 *> On exit, if INFO >= 0, WORK(1) returns the optimal LWORK.
235 *> The dimension of the array WORK. LWORK >= max(1,N).
237 *> If LWORK = -1, then a workspace query is assumed; the routine
238 *> only calculates the optimal size of the WORK array, returns
239 *> this value as the first entry of the WORK array, and no error
240 *> message related to LWORK is issued by XERBLA.
245 *> RWORK is DOUBLE PRECISION array, dimension (N)
251 *> = 0: successful exit
252 *> < 0: if INFO = -i, the i-th argument had an illegal value
253 *> = 1,...,N: the QZ iteration did not converge. (H,T) is not
254 *> in Schur form, but ALPHA(i) and BETA(i),
255 *> i=INFO+1,...,N should be correct.
256 *> = N+1,...,2*N: the shift calculation failed. (H,T) is not
257 *> in Schur form, but ALPHA(i) and BETA(i),
258 *> i=INFO-N+1,...,N should be correct.
264 *> \author Univ. of Tennessee
265 *> \author Univ. of California Berkeley
266 *> \author Univ. of Colorado Denver
271 *> \ingroup complex16GEcomputational
273 *> \par Further Details:
274 * =====================
278 *> We assume that complex ABS works as long as its value is less than
282 * =====================================================================
283 SUBROUTINE ZHGEQZ( JOB, COMPQ, COMPZ, N, ILO, IHI, H, LDH, T, LDT,
284 $ ALPHA, BETA, Q, LDQ, Z, LDZ, WORK, LWORK,
287 * -- LAPACK computational routine (version 3.6.1) --
288 * -- LAPACK is a software package provided by Univ. of Tennessee, --
289 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
292 * .. Scalar Arguments ..
293 CHARACTER COMPQ, COMPZ, JOB
294 INTEGER IHI, ILO, INFO, LDH, LDQ, LDT, LDZ, LWORK, N
296 * .. Array Arguments ..
297 DOUBLE PRECISION RWORK( * )
298 COMPLEX*16 ALPHA( * ), BETA( * ), H( LDH, * ),
299 $ Q( LDQ, * ), T( LDT, * ), WORK( * ),
303 * =====================================================================
306 COMPLEX*16 CZERO, CONE
307 PARAMETER ( CZERO = ( 0.0D+0, 0.0D+0 ),
308 $ CONE = ( 1.0D+0, 0.0D+0 ) )
309 DOUBLE PRECISION ZERO, ONE
310 PARAMETER ( ZERO = 0.0D+0, ONE = 1.0D+0 )
311 DOUBLE PRECISION HALF
312 PARAMETER ( HALF = 0.5D+0 )
314 * .. Local Scalars ..
315 LOGICAL ILAZR2, ILAZRO, ILQ, ILSCHR, ILZ, LQUERY
316 INTEGER ICOMPQ, ICOMPZ, IFIRST, IFRSTM, IITER, ILAST,
317 $ ILASTM, IN, ISCHUR, ISTART, J, JC, JCH, JITER,
319 DOUBLE PRECISION ABSB, ANORM, ASCALE, ATOL, BNORM, BSCALE, BTOL,
320 $ C, SAFMIN, TEMP, TEMP2, TEMPR, ULP
321 COMPLEX*16 ABI22, AD11, AD12, AD21, AD22, CTEMP, CTEMP2,
322 $ CTEMP3, ESHIFT, RTDISC, S, SHIFT, SIGNBC, T1,
325 * .. External Functions ..
327 DOUBLE PRECISION DLAMCH, ZLANHS
328 EXTERNAL LSAME, DLAMCH, ZLANHS
330 * .. External Subroutines ..
331 EXTERNAL XERBLA, ZLARTG, ZLASET, ZROT, ZSCAL
333 * .. Intrinsic Functions ..
334 INTRINSIC ABS, DBLE, DCMPLX, DCONJG, DIMAG, MAX, MIN,
337 * .. Statement Functions ..
338 DOUBLE PRECISION ABS1
340 * .. Statement Function definitions ..
341 ABS1( X ) = ABS( DBLE( X ) ) + ABS( DIMAG( X ) )
343 * .. Executable Statements ..
345 * Decode JOB, COMPQ, COMPZ
347 IF( LSAME( JOB, 'E' ) ) THEN
350 ELSE IF( LSAME( JOB, 'S' ) ) THEN
357 IF( LSAME( COMPQ, 'N' ) ) THEN
360 ELSE IF( LSAME( COMPQ, 'V' ) ) THEN
363 ELSE IF( LSAME( COMPQ, 'I' ) ) THEN
370 IF( LSAME( COMPZ, 'N' ) ) THEN
373 ELSE IF( LSAME( COMPZ, 'V' ) ) THEN
376 ELSE IF( LSAME( COMPZ, 'I' ) ) THEN
383 * Check Argument Values
386 WORK( 1 ) = MAX( 1, N )
387 LQUERY = ( LWORK.EQ.-1 )
388 IF( ISCHUR.EQ.0 ) THEN
390 ELSE IF( ICOMPQ.EQ.0 ) THEN
392 ELSE IF( ICOMPZ.EQ.0 ) THEN
394 ELSE IF( N.LT.0 ) THEN
396 ELSE IF( ILO.LT.1 ) THEN
398 ELSE IF( IHI.GT.N .OR. IHI.LT.ILO-1 ) THEN
400 ELSE IF( LDH.LT.N ) THEN
402 ELSE IF( LDT.LT.N ) THEN
404 ELSE IF( LDQ.LT.1 .OR. ( ILQ .AND. LDQ.LT.N ) ) THEN
406 ELSE IF( LDZ.LT.1 .OR. ( ILZ .AND. LDZ.LT.N ) ) THEN
408 ELSE IF( LWORK.LT.MAX( 1, N ) .AND. .NOT.LQUERY ) THEN
412 CALL XERBLA( 'ZHGEQZ', -INFO )
414 ELSE IF( LQUERY ) THEN
418 * Quick return if possible
420 * WORK( 1 ) = CMPLX( 1 )
422 WORK( 1 ) = DCMPLX( 1 )
429 $ CALL ZLASET( 'Full', N, N, CZERO, CONE, Q, LDQ )
431 $ CALL ZLASET( 'Full', N, N, CZERO, CONE, Z, LDZ )
436 SAFMIN = DLAMCH( 'S' )
437 ULP = DLAMCH( 'E' )*DLAMCH( 'B' )
438 ANORM = ZLANHS( 'F', IN, H( ILO, ILO ), LDH, RWORK )
439 BNORM = ZLANHS( 'F', IN, T( ILO, ILO ), LDT, RWORK )
440 ATOL = MAX( SAFMIN, ULP*ANORM )
441 BTOL = MAX( SAFMIN, ULP*BNORM )
442 ASCALE = ONE / MAX( SAFMIN, ANORM )
443 BSCALE = ONE / MAX( SAFMIN, BNORM )
446 * Set Eigenvalues IHI+1:N
449 ABSB = ABS( T( J, J ) )
450 IF( ABSB.GT.SAFMIN ) THEN
451 SIGNBC = DCONJG( T( J, J ) / ABSB )
454 CALL ZSCAL( J-1, SIGNBC, T( 1, J ), 1 )
455 CALL ZSCAL( J, SIGNBC, H( 1, J ), 1 )
457 CALL ZSCAL( 1, SIGNBC, H( J, J ), 1 )
460 $ CALL ZSCAL( N, SIGNBC, Z( 1, J ), 1 )
464 ALPHA( J ) = H( J, J )
465 BETA( J ) = T( J, J )
468 * If IHI < ILO, skip QZ steps
473 * MAIN QZ ITERATION LOOP
475 * Initialize dynamic indices
477 * Eigenvalues ILAST+1:N have been found.
478 * Column operations modify rows IFRSTM:whatever
479 * Row operations modify columns whatever:ILASTM
481 * If only eigenvalues are being computed, then
482 * IFRSTM is the row of the last splitting row above row ILAST;
483 * this is always at least ILO.
484 * IITER counts iterations since the last eigenvalue was found,
485 * to tell when to use an extraordinary shift.
486 * MAXIT is the maximum number of QZ sweeps allowed.
498 MAXIT = 30*( IHI-ILO+1 )
500 DO 170 JITER = 1, MAXIT
502 * Check for too many iterations.
507 * Split the matrix if possible.
510 * 1: H(j,j-1)=0 or j=ILO
513 * Special case: j=ILAST
515 IF( ILAST.EQ.ILO ) THEN
518 IF( ABS1( H( ILAST, ILAST-1 ) ).LE.ATOL ) THEN
519 H( ILAST, ILAST-1 ) = CZERO
524 IF( ABS( T( ILAST, ILAST ) ).LE.BTOL ) THEN
525 T( ILAST, ILAST ) = CZERO
529 * General case: j<ILAST
531 DO 40 J = ILAST - 1, ILO, -1
533 * Test 1: for H(j,j-1)=0 or j=ILO
538 IF( ABS1( H( J, J-1 ) ).LE.ATOL ) THEN
546 * Test 2: for T(j,j)=0
548 IF( ABS( T( J, J ) ).LT.BTOL ) THEN
551 * Test 1a: Check for 2 consecutive small subdiagonals in A
554 IF( .NOT.ILAZRO ) THEN
555 IF( ABS1( H( J, J-1 ) )*( ASCALE*ABS1( H( J+1,
556 $ J ) ) ).LE.ABS1( H( J, J ) )*( ASCALE*ATOL ) )
560 * If both tests pass (1 & 2), i.e., the leading diagonal
561 * element of B in the block is zero, split a 1x1 block off
562 * at the top. (I.e., at the J-th row/column) The leading
563 * diagonal element of the remainder can also be zero, so
564 * this may have to be done repeatedly.
566 IF( ILAZRO .OR. ILAZR2 ) THEN
567 DO 20 JCH = J, ILAST - 1
568 CTEMP = H( JCH, JCH )
569 CALL ZLARTG( CTEMP, H( JCH+1, JCH ), C, S,
571 H( JCH+1, JCH ) = CZERO
572 CALL ZROT( ILASTM-JCH, H( JCH, JCH+1 ), LDH,
573 $ H( JCH+1, JCH+1 ), LDH, C, S )
574 CALL ZROT( ILASTM-JCH, T( JCH, JCH+1 ), LDT,
575 $ T( JCH+1, JCH+1 ), LDT, C, S )
577 $ CALL ZROT( N, Q( 1, JCH ), 1, Q( 1, JCH+1 ), 1,
580 $ H( JCH, JCH-1 ) = H( JCH, JCH-1 )*C
582 IF( ABS1( T( JCH+1, JCH+1 ) ).GE.BTOL ) THEN
583 IF( JCH+1.GE.ILAST ) THEN
590 T( JCH+1, JCH+1 ) = CZERO
595 * Only test 2 passed -- chase the zero to T(ILAST,ILAST)
596 * Then process as in the case T(ILAST,ILAST)=0
598 DO 30 JCH = J, ILAST - 1
599 CTEMP = T( JCH, JCH+1 )
600 CALL ZLARTG( CTEMP, T( JCH+1, JCH+1 ), C, S,
602 T( JCH+1, JCH+1 ) = CZERO
603 IF( JCH.LT.ILASTM-1 )
604 $ CALL ZROT( ILASTM-JCH-1, T( JCH, JCH+2 ), LDT,
605 $ T( JCH+1, JCH+2 ), LDT, C, S )
606 CALL ZROT( ILASTM-JCH+2, H( JCH, JCH-1 ), LDH,
607 $ H( JCH+1, JCH-1 ), LDH, C, S )
609 $ CALL ZROT( N, Q( 1, JCH ), 1, Q( 1, JCH+1 ), 1,
611 CTEMP = H( JCH+1, JCH )
612 CALL ZLARTG( CTEMP, H( JCH+1, JCH-1 ), C, S,
614 H( JCH+1, JCH-1 ) = CZERO
615 CALL ZROT( JCH+1-IFRSTM, H( IFRSTM, JCH ), 1,
616 $ H( IFRSTM, JCH-1 ), 1, C, S )
617 CALL ZROT( JCH-IFRSTM, T( IFRSTM, JCH ), 1,
618 $ T( IFRSTM, JCH-1 ), 1, C, S )
620 $ CALL ZROT( N, Z( 1, JCH ), 1, Z( 1, JCH-1 ), 1,
625 ELSE IF( ILAZRO ) THEN
627 * Only test 1 passed -- work on J:ILAST
633 * Neither test passed -- try next J
637 * (Drop-through is "impossible")
642 * T(ILAST,ILAST)=0 -- clear H(ILAST,ILAST-1) to split off a
646 CTEMP = H( ILAST, ILAST )
647 CALL ZLARTG( CTEMP, H( ILAST, ILAST-1 ), C, S,
648 $ H( ILAST, ILAST ) )
649 H( ILAST, ILAST-1 ) = CZERO
650 CALL ZROT( ILAST-IFRSTM, H( IFRSTM, ILAST ), 1,
651 $ H( IFRSTM, ILAST-1 ), 1, C, S )
652 CALL ZROT( ILAST-IFRSTM, T( IFRSTM, ILAST ), 1,
653 $ T( IFRSTM, ILAST-1 ), 1, C, S )
655 $ CALL ZROT( N, Z( 1, ILAST ), 1, Z( 1, ILAST-1 ), 1, C, S )
657 * H(ILAST,ILAST-1)=0 -- Standardize B, set ALPHA and BETA
660 ABSB = ABS( T( ILAST, ILAST ) )
661 IF( ABSB.GT.SAFMIN ) THEN
662 SIGNBC = DCONJG( T( ILAST, ILAST ) / ABSB )
663 T( ILAST, ILAST ) = ABSB
665 CALL ZSCAL( ILAST-IFRSTM, SIGNBC, T( IFRSTM, ILAST ), 1 )
666 CALL ZSCAL( ILAST+1-IFRSTM, SIGNBC, H( IFRSTM, ILAST ),
669 CALL ZSCAL( 1, SIGNBC, H( ILAST, ILAST ), 1 )
672 $ CALL ZSCAL( N, SIGNBC, Z( 1, ILAST ), 1 )
674 T( ILAST, ILAST ) = CZERO
676 ALPHA( ILAST ) = H( ILAST, ILAST )
677 BETA( ILAST ) = T( ILAST, ILAST )
679 * Go to next block -- exit if finished.
689 IF( .NOT.ILSCHR ) THEN
691 IF( IFRSTM.GT.ILAST )
698 * This iteration only involves rows/columns IFIRST:ILAST. We
699 * assume IFIRST < ILAST, and that the diagonal of B is non-zero.
703 IF( .NOT.ILSCHR ) THEN
709 * At this point, IFIRST < ILAST, and the diagonal elements of
710 * T(IFIRST:ILAST,IFIRST,ILAST) are larger than BTOL (in
713 IF( ( IITER / 10 )*10.NE.IITER ) THEN
715 * The Wilkinson shift (AEP p.512), i.e., the eigenvalue of
716 * the bottom-right 2x2 block of A inv(B) which is nearest to
717 * the bottom-right element.
719 * We factor B as U*D, where U has unit diagonals, and
720 * compute (A*inv(D))*inv(U).
722 U12 = ( BSCALE*T( ILAST-1, ILAST ) ) /
723 $ ( BSCALE*T( ILAST, ILAST ) )
724 AD11 = ( ASCALE*H( ILAST-1, ILAST-1 ) ) /
725 $ ( BSCALE*T( ILAST-1, ILAST-1 ) )
726 AD21 = ( ASCALE*H( ILAST, ILAST-1 ) ) /
727 $ ( BSCALE*T( ILAST-1, ILAST-1 ) )
728 AD12 = ( ASCALE*H( ILAST-1, ILAST ) ) /
729 $ ( BSCALE*T( ILAST, ILAST ) )
730 AD22 = ( ASCALE*H( ILAST, ILAST ) ) /
731 $ ( BSCALE*T( ILAST, ILAST ) )
732 ABI22 = AD22 - U12*AD21
734 T1 = HALF*( AD11+ABI22 )
735 RTDISC = SQRT( T1**2+AD12*AD21-AD11*AD22 )
736 TEMP = DBLE( T1-ABI22 )*DBLE( RTDISC ) +
737 $ DIMAG( T1-ABI22 )*DIMAG( RTDISC )
738 IF( TEMP.LE.ZERO ) THEN
745 * Exceptional shift. Chosen for no particularly good reason.
747 ESHIFT = ESHIFT + (ASCALE*H(ILAST,ILAST-1))/
748 $ (BSCALE*T(ILAST-1,ILAST-1))
752 * Now check for two consecutive small subdiagonals.
754 DO 80 J = ILAST - 1, IFIRST + 1, -1
756 CTEMP = ASCALE*H( J, J ) - SHIFT*( BSCALE*T( J, J ) )
758 TEMP2 = ASCALE*ABS1( H( J+1, J ) )
759 TEMPR = MAX( TEMP, TEMP2 )
760 IF( TEMPR.LT.ONE .AND. TEMPR.NE.ZERO ) THEN
762 TEMP2 = TEMP2 / TEMPR
764 IF( ABS1( H( J, J-1 ) )*TEMP2.LE.TEMP*ATOL )
769 CTEMP = ASCALE*H( IFIRST, IFIRST ) -
770 $ SHIFT*( BSCALE*T( IFIRST, IFIRST ) )
773 * Do an implicit-shift QZ sweep.
777 CTEMP2 = ASCALE*H( ISTART+1, ISTART )
778 CALL ZLARTG( CTEMP, CTEMP2, C, S, CTEMP3 )
782 DO 150 J = ISTART, ILAST - 1
783 IF( J.GT.ISTART ) THEN
785 CALL ZLARTG( CTEMP, H( J+1, J-1 ), C, S, H( J, J-1 ) )
786 H( J+1, J-1 ) = CZERO
789 DO 100 JC = J, ILASTM
790 CTEMP = C*H( J, JC ) + S*H( J+1, JC )
791 H( J+1, JC ) = -DCONJG( S )*H( J, JC ) + C*H( J+1, JC )
793 CTEMP2 = C*T( J, JC ) + S*T( J+1, JC )
794 T( J+1, JC ) = -DCONJG( S )*T( J, JC ) + C*T( J+1, JC )
799 CTEMP = C*Q( JR, J ) + DCONJG( S )*Q( JR, J+1 )
800 Q( JR, J+1 ) = -S*Q( JR, J ) + C*Q( JR, J+1 )
805 CTEMP = T( J+1, J+1 )
806 CALL ZLARTG( CTEMP, T( J+1, J ), C, S, T( J+1, J+1 ) )
809 DO 120 JR = IFRSTM, MIN( J+2, ILAST )
810 CTEMP = C*H( JR, J+1 ) + S*H( JR, J )
811 H( JR, J ) = -DCONJG( S )*H( JR, J+1 ) + C*H( JR, J )
814 DO 130 JR = IFRSTM, J
815 CTEMP = C*T( JR, J+1 ) + S*T( JR, J )
816 T( JR, J ) = -DCONJG( S )*T( JR, J+1 ) + C*T( JR, J )
821 CTEMP = C*Z( JR, J+1 ) + S*Z( JR, J )
822 Z( JR, J ) = -DCONJG( S )*Z( JR, J+1 ) + C*Z( JR, J )
832 * Drop-through = non-convergence
838 * Successful completion of all QZ steps
842 * Set Eigenvalues 1:ILO-1
844 DO 200 J = 1, ILO - 1
845 ABSB = ABS( T( J, J ) )
846 IF( ABSB.GT.SAFMIN ) THEN
847 SIGNBC = DCONJG( T( J, J ) / ABSB )
850 CALL ZSCAL( J-1, SIGNBC, T( 1, J ), 1 )
851 CALL ZSCAL( J, SIGNBC, H( 1, J ), 1 )
853 CALL ZSCAL( 1, SIGNBC, H( J, J ), 1 )
856 $ CALL ZSCAL( N, SIGNBC, Z( 1, J ), 1 )
860 ALPHA( J ) = H( J, J )
861 BETA( J ) = T( J, J )
868 * Exit (other than argument error) -- return optimal workspace size
871 WORK( 1 ) = DCMPLX( N )