comparison libcruft/lapack/zlaqr4.f @ 7034:68db500cb558

[project @ 2007-10-16 18:54:19 by jwe]
author jwe
date Tue, 16 Oct 2007 18:54:23 +0000
parents
children
comparison
equal deleted inserted replaced
7033:f0142f2afdc6 7034:68db500cb558
1 SUBROUTINE ZLAQR4( WANTT, WANTZ, N, ILO, IHI, H, LDH, W, ILOZ,
2 $ IHIZ, Z, LDZ, WORK, LWORK, INFO )
3 *
4 * -- LAPACK auxiliary routine (version 3.1) --
5 * Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
6 * November 2006
7 *
8 * .. Scalar Arguments ..
9 INTEGER IHI, IHIZ, ILO, ILOZ, INFO, LDH, LDZ, LWORK, N
10 LOGICAL WANTT, WANTZ
11 * ..
12 * .. Array Arguments ..
13 COMPLEX*16 H( LDH, * ), W( * ), WORK( * ), Z( LDZ, * )
14 * ..
15 *
16 * This subroutine implements one level of recursion for ZLAQR0.
17 * It is a complete implementation of the small bulge multi-shift
18 * QR algorithm. It may be called by ZLAQR0 and, for large enough
19 * deflation window size, it may be called by ZLAQR3. This
20 * subroutine is identical to ZLAQR0 except that it calls ZLAQR2
21 * instead of ZLAQR3.
22 *
23 * Purpose
24 * =======
25 *
26 * ZLAQR4 computes the eigenvalues of a Hessenberg matrix H
27 * and, optionally, the matrices T and Z from the Schur decomposition
28 * H = Z T Z**H, where T is an upper triangular matrix (the
29 * Schur form), and Z is the unitary matrix of Schur vectors.
30 *
31 * Optionally Z may be postmultiplied into an input unitary
32 * matrix Q so that this routine can give the Schur factorization
33 * of a matrix A which has been reduced to the Hessenberg form H
34 * by the unitary matrix Q: A = Q*H*Q**H = (QZ)*H*(QZ)**H.
35 *
36 * Arguments
37 * =========
38 *
39 * WANTT (input) LOGICAL
40 * = .TRUE. : the full Schur form T is required;
41 * = .FALSE.: only eigenvalues are required.
42 *
43 * WANTZ (input) LOGICAL
44 * = .TRUE. : the matrix of Schur vectors Z is required;
45 * = .FALSE.: Schur vectors are not required.
46 *
47 * N (input) INTEGER
48 * The order of the matrix H. N .GE. 0.
49 *
50 * ILO (input) INTEGER
51 * IHI (input) INTEGER
52 * It is assumed that H is already upper triangular in rows
53 * and columns 1:ILO-1 and IHI+1:N and, if ILO.GT.1,
54 * H(ILO,ILO-1) is zero. ILO and IHI are normally set by a
55 * previous call to ZGEBAL, and then passed to ZGEHRD when the
56 * matrix output by ZGEBAL is reduced to Hessenberg form.
57 * Otherwise, ILO and IHI should be set to 1 and N,
58 * respectively. If N.GT.0, then 1.LE.ILO.LE.IHI.LE.N.
59 * If N = 0, then ILO = 1 and IHI = 0.
60 *
61 * H (input/output) COMPLEX*16 array, dimension (LDH,N)
62 * On entry, the upper Hessenberg matrix H.
63 * On exit, if INFO = 0 and WANTT is .TRUE., then H
64 * contains the upper triangular matrix T from the Schur
65 * decomposition (the Schur form). If INFO = 0 and WANT is
66 * .FALSE., then the contents of H are unspecified on exit.
67 * (The output value of H when INFO.GT.0 is given under the
68 * description of INFO below.)
69 *
70 * This subroutine may explicitly set H(i,j) = 0 for i.GT.j and
71 * j = 1, 2, ... ILO-1 or j = IHI+1, IHI+2, ... N.
72 *
73 * LDH (input) INTEGER
74 * The leading dimension of the array H. LDH .GE. max(1,N).
75 *
76 * W (output) COMPLEX*16 array, dimension (N)
77 * The computed eigenvalues of H(ILO:IHI,ILO:IHI) are stored
78 * in W(ILO:IHI). If WANTT is .TRUE., then the eigenvalues are
79 * stored in the same order as on the diagonal of the Schur
80 * form returned in H, with W(i) = H(i,i).
81 *
82 * Z (input/output) COMPLEX*16 array, dimension (LDZ,IHI)
83 * If WANTZ is .FALSE., then Z is not referenced.
84 * If WANTZ is .TRUE., then Z(ILO:IHI,ILOZ:IHIZ) is
85 * replaced by Z(ILO:IHI,ILOZ:IHIZ)*U where U is the
86 * orthogonal Schur factor of H(ILO:IHI,ILO:IHI).
87 * (The output value of Z when INFO.GT.0 is given under
88 * the description of INFO below.)
89 *
90 * LDZ (input) INTEGER
91 * The leading dimension of the array Z. if WANTZ is .TRUE.
92 * then LDZ.GE.MAX(1,IHIZ). Otherwize, LDZ.GE.1.
93 *
94 * WORK (workspace/output) COMPLEX*16 array, dimension LWORK
95 * On exit, if LWORK = -1, WORK(1) returns an estimate of
96 * the optimal value for LWORK.
97 *
98 * LWORK (input) INTEGER
99 * The dimension of the array WORK. LWORK .GE. max(1,N)
100 * is sufficient, but LWORK typically as large as 6*N may
101 * be required for optimal performance. A workspace query
102 * to determine the optimal workspace size is recommended.
103 *
104 * If LWORK = -1, then ZLAQR4 does a workspace query.
105 * In this case, ZLAQR4 checks the input parameters and
106 * estimates the optimal workspace size for the given
107 * values of N, ILO and IHI. The estimate is returned
108 * in WORK(1). No error message related to LWORK is
109 * issued by XERBLA. Neither H nor Z are accessed.
110 *
111 *
112 * INFO (output) INTEGER
113 * = 0: successful exit
114 * .GT. 0: if INFO = i, ZLAQR4 failed to compute all of
115 * the eigenvalues. Elements 1:ilo-1 and i+1:n of WR
116 * and WI contain those eigenvalues which have been
117 * successfully computed. (Failures are rare.)
118 *
119 * If INFO .GT. 0 and WANT is .FALSE., then on exit,
120 * the remaining unconverged eigenvalues are the eigen-
121 * values of the upper Hessenberg matrix rows and
122 * columns ILO through INFO of the final, output
123 * value of H.
124 *
125 * If INFO .GT. 0 and WANTT is .TRUE., then on exit
126 *
127 * (*) (initial value of H)*U = U*(final value of H)
128 *
129 * where U is a unitary matrix. The final
130 * value of H is upper Hessenberg and triangular in
131 * rows and columns INFO+1 through IHI.
132 *
133 * If INFO .GT. 0 and WANTZ is .TRUE., then on exit
134 *
135 * (final value of Z(ILO:IHI,ILOZ:IHIZ)
136 * = (initial value of Z(ILO:IHI,ILOZ:IHIZ)*U
137 *
138 * where U is the unitary matrix in (*) (regard-
139 * less of the value of WANTT.)
140 *
141 * If INFO .GT. 0 and WANTZ is .FALSE., then Z is not
142 * accessed.
143 *
144 * ================================================================
145 * Based on contributions by
146 * Karen Braman and Ralph Byers, Department of Mathematics,
147 * University of Kansas, USA
148 *
149 * ================================================================
150 * References:
151 * K. Braman, R. Byers and R. Mathias, The Multi-Shift QR
152 * Algorithm Part I: Maintaining Well Focused Shifts, and Level 3
153 * Performance, SIAM Journal of Matrix Analysis, volume 23, pages
154 * 929--947, 2002.
155 *
156 * K. Braman, R. Byers and R. Mathias, The Multi-Shift QR
157 * Algorithm Part II: Aggressive Early Deflation, SIAM Journal
158 * of Matrix Analysis, volume 23, pages 948--973, 2002.
159 *
160 * ================================================================
161 * .. Parameters ..
162 *
163 * ==== Matrices of order NTINY or smaller must be processed by
164 * . ZLAHQR because of insufficient subdiagonal scratch space.
165 * . (This is a hard limit.) ====
166 *
167 * ==== Exceptional deflation windows: try to cure rare
168 * . slow convergence by increasing the size of the
169 * . deflation window after KEXNW iterations. =====
170 *
171 * ==== Exceptional shifts: try to cure rare slow convergence
172 * . with ad-hoc exceptional shifts every KEXSH iterations.
173 * . The constants WILK1 and WILK2 are used to form the
174 * . exceptional shifts. ====
175 *
176 INTEGER NTINY
177 PARAMETER ( NTINY = 11 )
178 INTEGER KEXNW, KEXSH
179 PARAMETER ( KEXNW = 5, KEXSH = 6 )
180 DOUBLE PRECISION WILK1
181 PARAMETER ( WILK1 = 0.75d0 )
182 COMPLEX*16 ZERO, ONE
183 PARAMETER ( ZERO = ( 0.0d0, 0.0d0 ),
184 $ ONE = ( 1.0d0, 0.0d0 ) )
185 DOUBLE PRECISION TWO
186 PARAMETER ( TWO = 2.0d0 )
187 * ..
188 * .. Local Scalars ..
189 COMPLEX*16 AA, BB, CC, CDUM, DD, DET, RTDISC, SWAP, TR2
190 DOUBLE PRECISION S
191 INTEGER I, INF, IT, ITMAX, K, KACC22, KBOT, KDU, KS,
192 $ KT, KTOP, KU, KV, KWH, KWTOP, KWV, LD, LS,
193 $ LWKOPT, NDFL, NH, NHO, NIBBLE, NMIN, NS, NSMAX,
194 $ NSR, NVE, NW, NWMAX, NWR
195 LOGICAL NWINC, SORTED
196 CHARACTER JBCMPZ*2
197 * ..
198 * .. External Functions ..
199 INTEGER ILAENV
200 EXTERNAL ILAENV
201 * ..
202 * .. Local Arrays ..
203 COMPLEX*16 ZDUM( 1, 1 )
204 * ..
205 * .. External Subroutines ..
206 EXTERNAL ZLACPY, ZLAHQR, ZLAQR2, ZLAQR5
207 * ..
208 * .. Intrinsic Functions ..
209 INTRINSIC ABS, DBLE, DCMPLX, DIMAG, INT, MAX, MIN, MOD,
210 $ SQRT
211 * ..
212 * .. Statement Functions ..
213 DOUBLE PRECISION CABS1
214 * ..
215 * .. Statement Function definitions ..
216 CABS1( CDUM ) = ABS( DBLE( CDUM ) ) + ABS( DIMAG( CDUM ) )
217 * ..
218 * .. Executable Statements ..
219 INFO = 0
220 *
221 * ==== Quick return for N = 0: nothing to do. ====
222 *
223 IF( N.EQ.0 ) THEN
224 WORK( 1 ) = ONE
225 RETURN
226 END IF
227 *
228 * ==== Set up job flags for ILAENV. ====
229 *
230 IF( WANTT ) THEN
231 JBCMPZ( 1: 1 ) = 'S'
232 ELSE
233 JBCMPZ( 1: 1 ) = 'E'
234 END IF
235 IF( WANTZ ) THEN
236 JBCMPZ( 2: 2 ) = 'V'
237 ELSE
238 JBCMPZ( 2: 2 ) = 'N'
239 END IF
240 *
241 * ==== Tiny matrices must use ZLAHQR. ====
242 *
243 IF( N.LE.NTINY ) THEN
244 *
245 * ==== Estimate optimal workspace. ====
246 *
247 LWKOPT = 1
248 IF( LWORK.NE.-1 )
249 $ CALL ZLAHQR( WANTT, WANTZ, N, ILO, IHI, H, LDH, W, ILOZ,
250 $ IHIZ, Z, LDZ, INFO )
251 ELSE
252 *
253 * ==== Use small bulge multi-shift QR with aggressive early
254 * . deflation on larger-than-tiny matrices. ====
255 *
256 * ==== Hope for the best. ====
257 *
258 INFO = 0
259 *
260 * ==== NWR = recommended deflation window size. At this
261 * . point, N .GT. NTINY = 11, so there is enough
262 * . subdiagonal workspace for NWR.GE.2 as required.
263 * . (In fact, there is enough subdiagonal space for
264 * . NWR.GE.3.) ====
265 *
266 NWR = ILAENV( 13, 'ZLAQR4', JBCMPZ, N, ILO, IHI, LWORK )
267 NWR = MAX( 2, NWR )
268 NWR = MIN( IHI-ILO+1, ( N-1 ) / 3, NWR )
269 NW = NWR
270 *
271 * ==== NSR = recommended number of simultaneous shifts.
272 * . At this point N .GT. NTINY = 11, so there is at
273 * . enough subdiagonal workspace for NSR to be even
274 * . and greater than or equal to two as required. ====
275 *
276 NSR = ILAENV( 15, 'ZLAQR4', JBCMPZ, N, ILO, IHI, LWORK )
277 NSR = MIN( NSR, ( N+6 ) / 9, IHI-ILO )
278 NSR = MAX( 2, NSR-MOD( NSR, 2 ) )
279 *
280 * ==== Estimate optimal workspace ====
281 *
282 * ==== Workspace query call to ZLAQR2 ====
283 *
284 CALL ZLAQR2( WANTT, WANTZ, N, ILO, IHI, NWR+1, H, LDH, ILOZ,
285 $ IHIZ, Z, LDZ, LS, LD, W, H, LDH, N, H, LDH, N, H,
286 $ LDH, WORK, -1 )
287 *
288 * ==== Optimal workspace = MAX(ZLAQR5, ZLAQR2) ====
289 *
290 LWKOPT = MAX( 3*NSR / 2, INT( WORK( 1 ) ) )
291 *
292 * ==== Quick return in case of workspace query. ====
293 *
294 IF( LWORK.EQ.-1 ) THEN
295 WORK( 1 ) = DCMPLX( LWKOPT, 0 )
296 RETURN
297 END IF
298 *
299 * ==== ZLAHQR/ZLAQR0 crossover point ====
300 *
301 NMIN = ILAENV( 12, 'ZLAQR4', JBCMPZ, N, ILO, IHI, LWORK )
302 NMIN = MAX( NTINY, NMIN )
303 *
304 * ==== Nibble crossover point ====
305 *
306 NIBBLE = ILAENV( 14, 'ZLAQR4', JBCMPZ, N, ILO, IHI, LWORK )
307 NIBBLE = MAX( 0, NIBBLE )
308 *
309 * ==== Accumulate reflections during ttswp? Use block
310 * . 2-by-2 structure during matrix-matrix multiply? ====
311 *
312 KACC22 = ILAENV( 16, 'ZLAQR4', JBCMPZ, N, ILO, IHI, LWORK )
313 KACC22 = MAX( 0, KACC22 )
314 KACC22 = MIN( 2, KACC22 )
315 *
316 * ==== NWMAX = the largest possible deflation window for
317 * . which there is sufficient workspace. ====
318 *
319 NWMAX = MIN( ( N-1 ) / 3, LWORK / 2 )
320 *
321 * ==== NSMAX = the Largest number of simultaneous shifts
322 * . for which there is sufficient workspace. ====
323 *
324 NSMAX = MIN( ( N+6 ) / 9, 2*LWORK / 3 )
325 NSMAX = NSMAX - MOD( NSMAX, 2 )
326 *
327 * ==== NDFL: an iteration count restarted at deflation. ====
328 *
329 NDFL = 1
330 *
331 * ==== ITMAX = iteration limit ====
332 *
333 ITMAX = MAX( 30, 2*KEXSH )*MAX( 10, ( IHI-ILO+1 ) )
334 *
335 * ==== Last row and column in the active block ====
336 *
337 KBOT = IHI
338 *
339 * ==== Main Loop ====
340 *
341 DO 70 IT = 1, ITMAX
342 *
343 * ==== Done when KBOT falls below ILO ====
344 *
345 IF( KBOT.LT.ILO )
346 $ GO TO 80
347 *
348 * ==== Locate active block ====
349 *
350 DO 10 K = KBOT, ILO + 1, -1
351 IF( H( K, K-1 ).EQ.ZERO )
352 $ GO TO 20
353 10 CONTINUE
354 K = ILO
355 20 CONTINUE
356 KTOP = K
357 *
358 * ==== Select deflation window size ====
359 *
360 NH = KBOT - KTOP + 1
361 IF( NDFL.LT.KEXNW .OR. NH.LT.NW ) THEN
362 *
363 * ==== Typical deflation window. If possible and
364 * . advisable, nibble the entire active block.
365 * . If not, use size NWR or NWR+1 depending upon
366 * . which has the smaller corresponding subdiagonal
367 * . entry (a heuristic). ====
368 *
369 NWINC = .TRUE.
370 IF( NH.LE.MIN( NMIN, NWMAX ) ) THEN
371 NW = NH
372 ELSE
373 NW = MIN( NWR, NH, NWMAX )
374 IF( NW.LT.NWMAX ) THEN
375 IF( NW.GE.NH-1 ) THEN
376 NW = NH
377 ELSE
378 KWTOP = KBOT - NW + 1
379 IF( CABS1( H( KWTOP, KWTOP-1 ) ).GT.
380 $ CABS1( H( KWTOP-1, KWTOP-2 ) ) )NW = NW + 1
381 END IF
382 END IF
383 END IF
384 ELSE
385 *
386 * ==== Exceptional deflation window. If there have
387 * . been no deflations in KEXNW or more iterations,
388 * . then vary the deflation window size. At first,
389 * . because, larger windows are, in general, more
390 * . powerful than smaller ones, rapidly increase the
391 * . window up to the maximum reasonable and possible.
392 * . Then maybe try a slightly smaller window. ====
393 *
394 IF( NWINC .AND. NW.LT.MIN( NWMAX, NH ) ) THEN
395 NW = MIN( NWMAX, NH, 2*NW )
396 ELSE
397 NWINC = .FALSE.
398 IF( NW.EQ.NH .AND. NH.GT.2 )
399 $ NW = NH - 1
400 END IF
401 END IF
402 *
403 * ==== Aggressive early deflation:
404 * . split workspace under the subdiagonal into
405 * . - an nw-by-nw work array V in the lower
406 * . left-hand-corner,
407 * . - an NW-by-at-least-NW-but-more-is-better
408 * . (NW-by-NHO) horizontal work array along
409 * . the bottom edge,
410 * . - an at-least-NW-but-more-is-better (NHV-by-NW)
411 * . vertical work array along the left-hand-edge.
412 * . ====
413 *
414 KV = N - NW + 1
415 KT = NW + 1
416 NHO = ( N-NW-1 ) - KT + 1
417 KWV = NW + 2
418 NVE = ( N-NW ) - KWV + 1
419 *
420 * ==== Aggressive early deflation ====
421 *
422 CALL ZLAQR2( WANTT, WANTZ, N, KTOP, KBOT, NW, H, LDH, ILOZ,
423 $ IHIZ, Z, LDZ, LS, LD, W, H( KV, 1 ), LDH, NHO,
424 $ H( KV, KT ), LDH, NVE, H( KWV, 1 ), LDH, WORK,
425 $ LWORK )
426 *
427 * ==== Adjust KBOT accounting for new deflations. ====
428 *
429 KBOT = KBOT - LD
430 *
431 * ==== KS points to the shifts. ====
432 *
433 KS = KBOT - LS + 1
434 *
435 * ==== Skip an expensive QR sweep if there is a (partly
436 * . heuristic) reason to expect that many eigenvalues
437 * . will deflate without it. Here, the QR sweep is
438 * . skipped if many eigenvalues have just been deflated
439 * . or if the remaining active block is small.
440 *
441 IF( ( LD.EQ.0 ) .OR. ( ( 100*LD.LE.NW*NIBBLE ) .AND. ( KBOT-
442 $ KTOP+1.GT.MIN( NMIN, NWMAX ) ) ) ) THEN
443 *
444 * ==== NS = nominal number of simultaneous shifts.
445 * . This may be lowered (slightly) if ZLAQR2
446 * . did not provide that many shifts. ====
447 *
448 NS = MIN( NSMAX, NSR, MAX( 2, KBOT-KTOP ) )
449 NS = NS - MOD( NS, 2 )
450 *
451 * ==== If there have been no deflations
452 * . in a multiple of KEXSH iterations,
453 * . then try exceptional shifts.
454 * . Otherwise use shifts provided by
455 * . ZLAQR2 above or from the eigenvalues
456 * . of a trailing principal submatrix. ====
457 *
458 IF( MOD( NDFL, KEXSH ).EQ.0 ) THEN
459 KS = KBOT - NS + 1
460 DO 30 I = KBOT, KS + 1, -2
461 W( I ) = H( I, I ) + WILK1*CABS1( H( I, I-1 ) )
462 W( I-1 ) = W( I )
463 30 CONTINUE
464 ELSE
465 *
466 * ==== Got NS/2 or fewer shifts? Use ZLAHQR
467 * . on a trailing principal submatrix to
468 * . get more. (Since NS.LE.NSMAX.LE.(N+6)/9,
469 * . there is enough space below the subdiagonal
470 * . to fit an NS-by-NS scratch array.) ====
471 *
472 IF( KBOT-KS+1.LE.NS / 2 ) THEN
473 KS = KBOT - NS + 1
474 KT = N - NS + 1
475 CALL ZLACPY( 'A', NS, NS, H( KS, KS ), LDH,
476 $ H( KT, 1 ), LDH )
477 CALL ZLAHQR( .false., .false., NS, 1, NS,
478 $ H( KT, 1 ), LDH, W( KS ), 1, 1, ZDUM,
479 $ 1, INF )
480 KS = KS + INF
481 *
482 * ==== In case of a rare QR failure use
483 * . eigenvalues of the trailing 2-by-2
484 * . principal submatrix. Scale to avoid
485 * . overflows, underflows and subnormals.
486 * . (The scale factor S can not be zero,
487 * . because H(KBOT,KBOT-1) is nonzero.) ====
488 *
489 IF( KS.GE.KBOT ) THEN
490 S = CABS1( H( KBOT-1, KBOT-1 ) ) +
491 $ CABS1( H( KBOT, KBOT-1 ) ) +
492 $ CABS1( H( KBOT-1, KBOT ) ) +
493 $ CABS1( H( KBOT, KBOT ) )
494 AA = H( KBOT-1, KBOT-1 ) / S
495 CC = H( KBOT, KBOT-1 ) / S
496 BB = H( KBOT-1, KBOT ) / S
497 DD = H( KBOT, KBOT ) / S
498 TR2 = ( AA+DD ) / TWO
499 DET = ( AA-TR2 )*( DD-TR2 ) - BB*CC
500 RTDISC = SQRT( -DET )
501 W( KBOT-1 ) = ( TR2+RTDISC )*S
502 W( KBOT ) = ( TR2-RTDISC )*S
503 *
504 KS = KBOT - 1
505 END IF
506 END IF
507 *
508 IF( KBOT-KS+1.GT.NS ) THEN
509 *
510 * ==== Sort the shifts (Helps a little) ====
511 *
512 SORTED = .false.
513 DO 50 K = KBOT, KS + 1, -1
514 IF( SORTED )
515 $ GO TO 60
516 SORTED = .true.
517 DO 40 I = KS, K - 1
518 IF( CABS1( W( I ) ).LT.CABS1( W( I+1 ) ) )
519 $ THEN
520 SORTED = .false.
521 SWAP = W( I )
522 W( I ) = W( I+1 )
523 W( I+1 ) = SWAP
524 END IF
525 40 CONTINUE
526 50 CONTINUE
527 60 CONTINUE
528 END IF
529 END IF
530 *
531 * ==== If there are only two shifts, then use
532 * . only one. ====
533 *
534 IF( KBOT-KS+1.EQ.2 ) THEN
535 IF( CABS1( W( KBOT )-H( KBOT, KBOT ) ).LT.
536 $ CABS1( W( KBOT-1 )-H( KBOT, KBOT ) ) ) THEN
537 W( KBOT-1 ) = W( KBOT )
538 ELSE
539 W( KBOT ) = W( KBOT-1 )
540 END IF
541 END IF
542 *
543 * ==== Use up to NS of the the smallest magnatiude
544 * . shifts. If there aren't NS shifts available,
545 * . then use them all, possibly dropping one to
546 * . make the number of shifts even. ====
547 *
548 NS = MIN( NS, KBOT-KS+1 )
549 NS = NS - MOD( NS, 2 )
550 KS = KBOT - NS + 1
551 *
552 * ==== Small-bulge multi-shift QR sweep:
553 * . split workspace under the subdiagonal into
554 * . - a KDU-by-KDU work array U in the lower
555 * . left-hand-corner,
556 * . - a KDU-by-at-least-KDU-but-more-is-better
557 * . (KDU-by-NHo) horizontal work array WH along
558 * . the bottom edge,
559 * . - and an at-least-KDU-but-more-is-better-by-KDU
560 * . (NVE-by-KDU) vertical work WV arrow along
561 * . the left-hand-edge. ====
562 *
563 KDU = 3*NS - 3
564 KU = N - KDU + 1
565 KWH = KDU + 1
566 NHO = ( N-KDU+1-4 ) - ( KDU+1 ) + 1
567 KWV = KDU + 4
568 NVE = N - KDU - KWV + 1
569 *
570 * ==== Small-bulge multi-shift QR sweep ====
571 *
572 CALL ZLAQR5( WANTT, WANTZ, KACC22, N, KTOP, KBOT, NS,
573 $ W( KS ), H, LDH, ILOZ, IHIZ, Z, LDZ, WORK,
574 $ 3, H( KU, 1 ), LDH, NVE, H( KWV, 1 ), LDH,
575 $ NHO, H( KU, KWH ), LDH )
576 END IF
577 *
578 * ==== Note progress (or the lack of it). ====
579 *
580 IF( LD.GT.0 ) THEN
581 NDFL = 1
582 ELSE
583 NDFL = NDFL + 1
584 END IF
585 *
586 * ==== End of main loop ====
587 70 CONTINUE
588 *
589 * ==== Iteration limit exceeded. Set INFO to show where
590 * . the problem occurred and exit. ====
591 *
592 INFO = KBOT
593 80 CONTINUE
594 END IF
595 *
596 * ==== Return the optimal value of LWORK. ====
597 *
598 WORK( 1 ) = DCMPLX( LWKOPT, 0 )
599 *
600 * ==== End of ZLAQR4 ====
601 *
602 END