1 SUBROUTINE ZDRVGG( NSIZES, NN, NTYPES, DOTYPE, ISEED, THRESH,
2 $ THRSHN, NOUNIT, A, LDA, B, S, T, S2, T2, Q,
3 $ LDQ, Z, ALPHA1, BETA1, ALPHA2, BETA2, VL, VR,
4 $ WORK, LWORK, RWORK, RESULT, INFO )
5 *
6 * -- LAPACK test routine (version 3.1) --
7 * Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
8 * November 2006
9 *
10 * .. Scalar Arguments ..
11 INTEGER INFO, LDA, LDQ, LWORK, NOUNIT, NSIZES, NTYPES
12 DOUBLE PRECISION THRESH, THRSHN
13 * ..
14 * .. Array Arguments ..
15 *
16 * Purpose
17 * =======
18 *
19 * ZDRVGG checks the nonsymmetric generalized eigenvalue driver
20 * routines.
21 * T T T
22 * ZGEGS factors A and B as Q S Z and Q T Z , where means
23 * transpose, T is upper triangular, S is in generalized Schur form
24 * (upper triangular), and Q and Z are unitary. It also
25 * computes the generalized eigenvalues (alpha(1),beta(1)), ...,
26 * (alpha(n),beta(n)), where alpha(j)=S(j,j) and beta(j)=T(j,j) --
27 * thus, w(j) = alpha(j)/beta(j) is a root of the generalized
28 * eigenvalue problem
29 *
30 * det( A - w(j) B ) = 0
31 *
32 * and m(j) = beta(j)/alpha(j) is a root of the essentially equivalent
33 * problem
34 *
35 * det( m(j) A - B ) = 0
36 *
37 * ZGEGV computes the generalized eigenvalues (alpha(1),beta(1)), ...,
38 * (alpha(n),beta(n)), the matrix L whose columns contain the
39 * generalized left eigenvectors l, and the matrix R whose columns
40 * contain the generalized right eigenvectors r for the pair (A,B).
41 *
42 * When ZDRVGG is called, a number of matrix "sizes" ("n's") and a
43 * number of matrix "types" are specified. For each size ("n")
44 * and each type of matrix, one matrix will be generated and used
45 * to test the nonsymmetric eigenroutines. For each matrix, 7
46 * tests will be performed and compared with the threshhold THRESH:
47 *
48 * Results from ZGEGS:
49 *
50 * H
51 * (1) | A - Q S Z | / ( |A| n ulp )
52 *
53 * H
54 * (2) | B - Q T Z | / ( |B| n ulp )
55 *
56 * H
57 * (3) | I - QQ | / ( n ulp )
58 *
59 * H
60 * (4) | I - ZZ | / ( n ulp )
61 *
62 * (5) maximum over j of D(j) where:
63 *
64 * |alpha(j) - S(j,j)| |beta(j) - T(j,j)|
65 * D(j) = ------------------------ + -----------------------
66 * max(|alpha(j)|,|S(j,j)|) max(|beta(j)|,|T(j,j)|)
67 *
68 * Results from ZGEGV:
69 *
70 * (6) max over all left eigenvalue/-vector pairs (beta/alpha,l) of
71 *
72 * | l**H * (beta A - alpha B) | / ( ulp max( |beta A|, |alpha B| ) )
73 *
74 * where l**H is the conjugate tranpose of l.
75 *
76 * (7) max over all right eigenvalue/-vector pairs (beta/alpha,r) of
77 *
78 * | (beta A - alpha B) r | / ( ulp max( |beta A|, |alpha B| ) )
79 *
80 * Test Matrices
81 * ---- --------
82 *
83 * The sizes of the test matrices are specified by an array
84 * NN(1:NSIZES); the value of each element NN(j) specifies one size.
85 * The "types" are specified by a logical array DOTYPE( 1:NTYPES ); if
86 * DOTYPE(j) is .TRUE., then matrix type "j" will be generated.
87 * Currently, the list of possible types is:
88 *
89 * (1) ( 0, 0 ) (a pair of zero matrices)
90 *
91 * (2) ( I, 0 ) (an identity and a zero matrix)
92 *
93 * (3) ( 0, I ) (an identity and a zero matrix)
94 *
95 * (4) ( I, I ) (a pair of identity matrices)
96 *
97 * t t
98 * (5) ( J , J ) (a pair of transposed Jordan blocks)
99 *
100 * t ( I 0 )
101 * (6) ( X, Y ) where X = ( J 0 ) and Y = ( t )
102 * ( 0 I ) ( 0 J )
103 * and I is a k x k identity and J a (k+1)x(k+1)
104 * Jordan block; k=(N-1)/2
105 *
106 * (7) ( D, I ) where D is diag( 0, 1,..., N-1 ) (a diagonal
107 * matrix with those diagonal entries.)
108 * (8) ( I, D )
109 *
110 * (9) ( big*D, small*I ) where "big" is near overflow and small=1/big
111 *
112 * (10) ( small*D, big*I )
113 *
114 * (11) ( big*I, small*D )
115 *
116 * (12) ( small*I, big*D )
117 *
118 * (13) ( big*D, big*I )
119 *
120 * (14) ( small*D, small*I )
121 *
122 * (15) ( D1, D2 ) where D1 is diag( 0, 0, 1, ..., N-3, 0 ) and
123 * D2 is diag( 0, N-3, N-4,..., 1, 0, 0 )
124 * t t
125 * (16) Q ( J , J ) Z where Q and Z are random unitary matrices.
126 *
127 * (17) Q ( T1, T2 ) Z where T1 and T2 are upper triangular matrices
128 * with random O(1) entries above the diagonal
129 * and diagonal entries diag(T1) =
130 * ( 0, 0, 1, ..., N-3, 0 ) and diag(T2) =
131 * ( 0, N-3, N-4,..., 1, 0, 0 )
132 *
133 * (18) Q ( T1, T2 ) Z diag(T1) = ( 0, 0, 1, 1, s, ..., s, 0 )
134 * diag(T2) = ( 0, 1, 0, 1,..., 1, 0 )
135 * s = machine precision.
136 *
137 * (19) Q ( T1, T2 ) Z diag(T1)=( 0,0,1,1, 1-d, ..., 1-(N-5)*d=s, 0 )
138 * diag(T2) = ( 0, 1, 0, 1, ..., 1, 0 )
139 *
140 * N-5
141 * (20) Q ( T1, T2 ) Z diag(T1)=( 0, 0, 1, 1, a, ..., a =s, 0 )
142 * diag(T2) = ( 0, 1, 0, 1, ..., 1, 0, 0 )
143 *
144 * (21) Q ( T1, T2 ) Z diag(T1)=( 0, 0, 1, r1, r2, ..., r(N-4), 0 )
145 * diag(T2) = ( 0, 1, 0, 1, ..., 1, 0, 0 )
146 * where r1,..., r(N-4) are random.
147 *
148 * (22) Q ( big*T1, small*T2 ) Z diag(T1) = ( 0, 0, 1, ..., N-3, 0 )
149 * diag(T2) = ( 0, 1, ..., 1, 0, 0 )
150 *
151 * (23) Q ( small*T1, big*T2 ) Z diag(T1) = ( 0, 0, 1, ..., N-3, 0 )
152 * diag(T2) = ( 0, 1, ..., 1, 0, 0 )
153 *
154 * (24) Q ( small*T1, small*T2 ) Z diag(T1) = ( 0, 0, 1, ..., N-3, 0 )
155 * diag(T2) = ( 0, 1, ..., 1, 0, 0 )
156 *
157 * (25) Q ( big*T1, big*T2 ) Z diag(T1) = ( 0, 0, 1, ..., N-3, 0 )
158 * diag(T2) = ( 0, 1, ..., 1, 0, 0 )
159 *
160 * (26) Q ( T1, T2 ) Z where T1 and T2 are random upper-triangular
161 * matrices.
162 *
163 * Arguments
164 * =========
165 *
166 * NSIZES (input) INTEGER
167 * The number of sizes of matrices to use. If it is zero,
168 * ZDRVGG does nothing. It must be at least zero.
169 *
170 * NN (input) INTEGER array, dimension (NSIZES)
171 * An array containing the sizes to be used for the matrices.
172 * Zero values will be skipped. The values must be at least
173 * zero.
174 *
175 * NTYPES (input) INTEGER
176 * The number of elements in DOTYPE. If it is zero, ZDRVGG
177 * does nothing. It must be at least zero. If it is MAXTYP+1
178 * and NSIZES is 1, then an additional type, MAXTYP+1 is
179 * defined, which is to use whatever matrix is in A. This
180 * is only useful if DOTYPE(1:MAXTYP) is .FALSE. and
181 * DOTYPE(MAXTYP+1) is .TRUE. .
182 *
183 * DOTYPE (input) LOGICAL array, dimension (NTYPES)
184 * If DOTYPE(j) is .TRUE., then for each size in NN a
185 * matrix of that size and of type j will be generated.
186 * If NTYPES is smaller than the maximum number of types
187 * defined (PARAMETER MAXTYP), then types NTYPES+1 through
188 * MAXTYP will not be generated. If NTYPES is larger
189 * than MAXTYP, DOTYPE(MAXTYP+1) through DOTYPE(NTYPES)
190 * will be ignored.
191 *
192 * ISEED (input/output) INTEGER array, dimension (4)
193 * On entry ISEED specifies the seed of the random number
194 * generator. The array elements should be between 0 and 4095;
195 * if not they will be reduced mod 4096. Also, ISEED(4) must
196 * be odd. The random number generator uses a linear
197 * congruential sequence limited to small integers, and so
198 * should produce machine independent random numbers. The
199 * values of ISEED are changed on exit, and can be used in the
200 * next call to ZDRVGG to continue the same random number
201 * sequence.
202 *
203 * THRESH (input) DOUBLE PRECISION
204 * A test will count as "failed" if the "error", computed as
205 * described above, exceeds THRESH. Note that the error is
206 * scaled to be O(1), so THRESH should be a reasonably small
207 * multiple of 1, e.g., 10 or 100. In particular, it should
208 * not depend on the precision (single vs. double) or the size
209 * of the matrix. It must be at least zero.
210 *
211 * THRSHN (input) DOUBLE PRECISION
212 * Threshhold for reporting eigenvector normalization error.
213 * If the normalization of any eigenvector differs from 1 by
214 * more than THRSHN*ulp, then a special error message will be
215 * printed. (This is handled separately from the other tests,
216 * since only a compiler or programming error should cause an
217 * error message, at least if THRSHN is at least 5--10.)
218 *
219 * NOUNIT (input) INTEGER
220 * The FORTRAN unit number for printing out error messages
221 * (e.g., if a routine returns IINFO not equal to 0.)
222 *
223 * A (input/workspace) COMPLEX*16 array, dimension (LDA, max(NN))
224 * Used to hold the original A matrix. Used as input only
225 * if NTYPES=MAXTYP+1, DOTYPE(1:MAXTYP)=.FALSE., and
226 * DOTYPE(MAXTYP+1)=.TRUE.
227 *
228 * LDA (input) INTEGER
229 * The leading dimension of A, B, S, T, S2, and T2.
230 * It must be at least 1 and at least max( NN ).
231 *
232 * B (input/workspace) COMPLEX*16 array, dimension (LDA, max(NN))
233 * Used to hold the original B matrix. Used as input only
234 * if NTYPES=MAXTYP+1, DOTYPE(1:MAXTYP)=.FALSE., and
235 * DOTYPE(MAXTYP+1)=.TRUE.
236 *
237 * S (workspace) COMPLEX*16 array, dimension (LDA, max(NN))
238 * The upper triangular matrix computed from A by ZGEGS.
239 *
240 * T (workspace) COMPLEX*16 array, dimension (LDA, max(NN))
241 * The upper triangular matrix computed from B by ZGEGS.
242 *
243 * S2 (workspace) COMPLEX*16 array, dimension (LDA, max(NN))
244 * The matrix computed from A by ZGEGV. This will be the
245 * Schur (upper triangular) form of some matrix related to A,
246 * but will not, in general, be the same as S.
247 *
248 * T2 (workspace) COMPLEX*16 array, dimension (LDA, max(NN))
249 * The matrix computed from B by ZGEGV. This will be the
250 * Schur form of some matrix related to B, but will not, in
251 * general, be the same as T.
252 *
253 * Q (workspace) COMPLEX*16 array, dimension (LDQ, max(NN))
254 * The (left) unitary matrix computed by ZGEGS.
255 *
256 * LDQ (input) INTEGER
257 * The leading dimension of Q, Z, VL, and VR. It must
258 * be at least 1 and at least max( NN ).
259 *
260 * Z (workspace) COMPLEX*16 array, dimension (LDQ, max(NN))
261 * The (right) unitary matrix computed by ZGEGS.
262 *
263 * ALPHA1 (workspace) COMPLEX*16 array, dimension (max(NN))
264 * BETA1 (workspace) COMPLEX*16 array, dimension (max(NN))
265 * The generalized eigenvalues of (A,B) computed by ZGEGS.
266 * ALPHA1(k) / BETA1(k) is the k-th generalized eigenvalue of
267 * the matrices in A and B.
268 *
269 * ALPHA2 (workspace) COMPLEX*16 array, dimension (max(NN))
270 * BETA2 (workspace) COMPLEX*16 array, dimension (max(NN))
271 * The generalized eigenvalues of (A,B) computed by ZGEGV.
272 * ALPHA2(k) / BETA2(k) is the k-th generalized eigenvalue of
273 * the matrices in A and B.
274 *
275 * VL (workspace) COMPLEX*16 array, dimension (LDQ, max(NN))
276 * The (lower triangular) left eigenvector matrix for the
277 * matrices in A and B.
278 *
279 * VR (workspace) COMPLEX*16 array, dimension (LDQ, max(NN))
280 * The (upper triangular) right eigenvector matrix for the
281 * matrices in A and B.
282 *
283 * WORK (workspace) COMPLEX*16 array, dimension (LWORK)
284 *
285 * LWORK (input) INTEGER
286 * The number of entries in WORK. This must be at least
287 * MAX( 2*N, N*(NB+1), (k+1)*(2*k+N+1) ), where "k" is the
288 * sum of the blocksize and number-of-shifts for ZHGEQZ, and
289 * NB is the greatest of the blocksizes for ZGEQRF, ZUNMQR,
290 * and ZUNGQR. (The blocksizes and the number-of-shifts are
291 * retrieved through calls to ILAENV.)
292 *
293 * RWORK (workspace) DOUBLE PRECISION array, dimension (8*N)
294 *
295 * RESULT (output) DOUBLE PRECISION array, dimension (7)
296 * The values computed by the tests described above.
297 * The values are currently limited to 1/ulp, to avoid
298 * overflow.
299 *
300 * INFO (output) INTEGER
301 * = 0: successful exit
302 * < 0: if INFO = -i, the i-th argument had an illegal value.
303 * > 0: A routine returned an error code. INFO is the
304 * absolute value of the INFO value returned.
305 *
306 * =====================================================================
307 *
308 LOGICAL DOTYPE( * )
309 INTEGER ISEED( 4 ), NN( * )
310 DOUBLE PRECISION RESULT( * ), RWORK( * )
311 COMPLEX*16 A( LDA, * ), ALPHA1( * ), ALPHA2( * ),
312 $ B( LDA, * ), BETA1( * ), BETA2( * ),
313 $ Q( LDQ, * ), S( LDA, * ), S2( LDA, * ),
314 $ T( LDA, * ), T2( LDA, * ), VL( LDQ, * ),
315 $ VR( LDQ, * ), WORK( * ), Z( LDQ, * )
316 * ..
317 * .. Parameters ..
318 DOUBLE PRECISION ZERO, ONE
319 PARAMETER ( ZERO = 0.0D+0, ONE = 1.0D+0 )
320 COMPLEX*16 CZERO, CONE
321 PARAMETER ( CZERO = ( 0.0D+0, 0.0D+0 ),
322 $ CONE = ( 1.0D+0, 0.0D+0 ) )
323 INTEGER MAXTYP
324 PARAMETER ( MAXTYP = 26 )
325 * ..
326 * .. Local Scalars ..
327 LOGICAL BADNN
328 INTEGER I1, IADD, IINFO, IN, J, JC, JR, JSIZE, JTYPE,
329 $ LWKOPT, MTYPES, N, N1, NB, NBZ, NERRS, NMATS,
330 $ NMAX, NS, NTEST, NTESTT
331 DOUBLE PRECISION SAFMAX, SAFMIN, TEMP1, TEMP2, ULP, ULPINV
332 COMPLEX*16 CTEMP, X
333 * ..
334 * .. Local Arrays ..
335 LOGICAL LASIGN( MAXTYP ), LBSIGN( MAXTYP )
336 INTEGER IOLDSD( 4 ), KADD( 6 ), KAMAGN( MAXTYP ),
337 $ KATYPE( MAXTYP ), KAZERO( MAXTYP ),
338 $ KBMAGN( MAXTYP ), KBTYPE( MAXTYP ),
339 $ KBZERO( MAXTYP ), KCLASS( MAXTYP ),
340 $ KTRIAN( MAXTYP ), KZ1( 6 ), KZ2( 6 )
341 DOUBLE PRECISION DUMMA( 4 ), RMAGN( 0: 3 )
342 * ..
343 * .. External Functions ..
344 INTEGER ILAENV
345 DOUBLE PRECISION DLAMCH
346 COMPLEX*16 ZLARND
347 EXTERNAL ILAENV, DLAMCH, ZLARND
348 * ..
349 * .. External Subroutines ..
350 EXTERNAL ALASVM, DLABAD, XERBLA, ZGEGS, ZGEGV, ZGET51,
351 $ ZGET52, ZLACPY, ZLARFG, ZLASET, ZLATM4, ZUNM2R
352 * ..
353 * .. Intrinsic Functions ..
354 INTRINSIC ABS, DBLE, DCONJG, DIMAG, MAX, MIN, SIGN
355 * ..
356 * .. Statement Functions ..
357 DOUBLE PRECISION ABS1
358 * ..
359 * .. Statement Function definitions ..
360 ABS1( X ) = ABS( DBLE( X ) ) + ABS( DIMAG( X ) )
361 * ..
362 * .. Data statements ..
363 DATA KCLASS / 15*1, 10*2, 1*3 /
364 DATA KZ1 / 0, 1, 2, 1, 3, 3 /
365 DATA KZ2 / 0, 0, 1, 2, 1, 1 /
366 DATA KADD / 0, 0, 0, 0, 3, 2 /
367 DATA KATYPE / 0, 1, 0, 1, 2, 3, 4, 1, 4, 4, 1, 1, 4,
368 $ 4, 4, 2, 4, 5, 8, 7, 9, 4*4, 0 /
369 DATA KBTYPE / 0, 0, 1, 1, 2, -3, 1, 4, 1, 1, 4, 4,
370 $ 1, 1, -4, 2, -4, 8*8, 0 /
371 DATA KAZERO / 6*1, 2, 1, 2*2, 2*1, 2*2, 3, 1, 3,
372 $ 4*5, 4*3, 1 /
373 DATA KBZERO / 6*1, 1, 2, 2*1, 2*2, 2*1, 4, 1, 4,
374 $ 4*6, 4*4, 1 /
375 DATA KAMAGN / 8*1, 2, 3, 2, 3, 2, 3, 7*1, 2, 3, 3,
376 $ 2, 1 /
377 DATA KBMAGN / 8*1, 3, 2, 3, 2, 2, 3, 7*1, 3, 2, 3,
378 $ 2, 1 /
379 DATA KTRIAN / 16*0, 10*1 /
380 DATA LASIGN / 6*.FALSE., .TRUE., .FALSE., 2*.TRUE.,
381 $ 2*.FALSE., 3*.TRUE., .FALSE., .TRUE.,
382 $ 3*.FALSE., 5*.TRUE., .FALSE. /
383 DATA LBSIGN / 7*.FALSE., .TRUE., 2*.FALSE.,
384 $ 2*.TRUE., 2*.FALSE., .TRUE., .FALSE., .TRUE.,
385 $ 9*.FALSE. /
386 * ..
387 * .. Executable Statements ..
388 *
389 * Check for errors
390 *
391 INFO = 0
392 *
393 BADNN = .FALSE.
394 NMAX = 1
395 DO 10 J = 1, NSIZES
396 NMAX = MAX( NMAX, NN( J ) )
397 IF( NN( J ).LT.0 )
398 $ BADNN = .TRUE.
399 10 CONTINUE
400 *
401 * Maximum blocksize and shift -- we assume that blocksize and number
402 * of shifts are monotone increasing functions of N.
403 *
404 NB = MAX( 1, ILAENV( 1, 'ZGEQRF', ' ', NMAX, NMAX, -1, -1 ),
405 $ ILAENV( 1, 'ZUNMQR', 'LC', NMAX, NMAX, NMAX, -1 ),
406 $ ILAENV( 1, 'ZUNGQR', ' ', NMAX, NMAX, NMAX, -1 ) )
407 NBZ = ILAENV( 1, 'ZHGEQZ', 'SII', NMAX, 1, NMAX, 0 )
408 NS = ILAENV( 4, 'ZHGEQZ', 'SII', NMAX, 1, NMAX, 0 )
409 I1 = NBZ + NS
410 LWKOPT = MAX( 2*NMAX, NMAX*( NB+1 ), ( 2*I1+NMAX+1 )*( I1+1 ) )
411 *
412 * Check for errors
413 *
414 IF( NSIZES.LT.0 ) THEN
415 INFO = -1
416 ELSE IF( BADNN ) THEN
417 INFO = -2
418 ELSE IF( NTYPES.LT.0 ) THEN
419 INFO = -3
420 ELSE IF( THRESH.LT.ZERO ) THEN
421 INFO = -6
422 ELSE IF( LDA.LE.1 .OR. LDA.LT.NMAX ) THEN
423 INFO = -10
424 ELSE IF( LDQ.LE.1 .OR. LDQ.LT.NMAX ) THEN
425 INFO = -19
426 ELSE IF( LWKOPT.GT.LWORK ) THEN
427 INFO = -30
428 END IF
429 *
430 IF( INFO.NE.0 ) THEN
431 CALL XERBLA( 'ZDRVGG', -INFO )
432 RETURN
433 END IF
434 *
435 * Quick return if possible
436 *
437 IF( NSIZES.EQ.0 .OR. NTYPES.EQ.0 )
438 $ RETURN
439 *
440 ULP = DLAMCH( 'Precision' )
441 SAFMIN = DLAMCH( 'Safe minimum' )
442 SAFMIN = SAFMIN / ULP
443 SAFMAX = ONE / SAFMIN
444 CALL DLABAD( SAFMIN, SAFMAX )
445 ULPINV = ONE / ULP
446 *
447 * The values RMAGN(2:3) depend on N, see below.
448 *
449 RMAGN( 0 ) = ZERO
450 RMAGN( 1 ) = ONE
451 *
452 * Loop over sizes, types
453 *
454 NTESTT = 0
455 NERRS = 0
456 NMATS = 0
457 *
458 DO 160 JSIZE = 1, NSIZES
459 N = NN( JSIZE )
460 N1 = MAX( 1, N )
461 RMAGN( 2 ) = SAFMAX*ULP / DBLE( N1 )
462 RMAGN( 3 ) = SAFMIN*ULPINV*N1
463 *
464 IF( NSIZES.NE.1 ) THEN
465 MTYPES = MIN( MAXTYP, NTYPES )
466 ELSE
467 MTYPES = MIN( MAXTYP+1, NTYPES )
468 END IF
469 *
470 DO 150 JTYPE = 1, MTYPES
471 IF( .NOT.DOTYPE( JTYPE ) )
472 $ GO TO 150
473 NMATS = NMATS + 1
474 NTEST = 0
475 *
476 * Save ISEED in case of an error.
477 *
478 DO 20 J = 1, 4
479 IOLDSD( J ) = ISEED( J )
480 20 CONTINUE
481 *
482 * Initialize RESULT
483 *
484 DO 30 J = 1, 7
485 RESULT( J ) = ZERO
486 30 CONTINUE
487 *
488 * Compute A and B
489 *
490 * Description of control parameters:
491 *
492 * KZLASS: =1 means w/o rotation, =2 means w/ rotation,
493 * =3 means random.
494 * KATYPE: the "type" to be passed to ZLATM4 for computing A.
495 * KAZERO: the pattern of zeros on the diagonal for A:
496 * =1: ( xxx ), =2: (0, xxx ) =3: ( 0, 0, xxx, 0 ),
497 * =4: ( 0, xxx, 0, 0 ), =5: ( 0, 0, 1, xxx, 0 ),
498 * =6: ( 0, 1, 0, xxx, 0 ). (xxx means a string of
499 * non-zero entries.)
500 * KAMAGN: the magnitude of the matrix: =0: zero, =1: O(1),
501 * =2: large, =3: small.
502 * LASIGN: .TRUE. if the diagonal elements of A are to be
503 * multiplied by a random magnitude 1 number.
504 * KBTYPE, KBZERO, KBMAGN, IBSIGN: the same, but for B.
505 * KTRIAN: =0: don't fill in the upper triangle, =1: do.
506 * KZ1, KZ2, KADD: used to implement KAZERO and KBZERO.
507 * RMAGN: used to implement KAMAGN and KBMAGN.
508 *
509 IF( MTYPES.GT.MAXTYP )
510 $ GO TO 110
511 IINFO = 0
512 IF( KCLASS( JTYPE ).LT.3 ) THEN
513 *
514 * Generate A (w/o rotation)
515 *
516 IF( ABS( KATYPE( JTYPE ) ).EQ.3 ) THEN
517 IN = 2*( ( N-1 ) / 2 ) + 1
518 IF( IN.NE.N )
519 $ CALL ZLASET( 'Full', N, N, CZERO, CZERO, A, LDA )
520 ELSE
521 IN = N
522 END IF
523 CALL ZLATM4( KATYPE( JTYPE ), IN, KZ1( KAZERO( JTYPE ) ),
524 $ KZ2( KAZERO( JTYPE ) ), LASIGN( JTYPE ),
525 $ RMAGN( KAMAGN( JTYPE ) ), ULP,
526 $ RMAGN( KTRIAN( JTYPE )*KAMAGN( JTYPE ) ), 2,
527 $ ISEED, A, LDA )
528 IADD = KADD( KAZERO( JTYPE ) )
529 IF( IADD.GT.0 .AND. IADD.LE.N )
530 $ A( IADD, IADD ) = RMAGN( KAMAGN( JTYPE ) )
531 *
532 * Generate B (w/o rotation)
533 *
534 IF( ABS( KBTYPE( JTYPE ) ).EQ.3 ) THEN
535 IN = 2*( ( N-1 ) / 2 ) + 1
536 IF( IN.NE.N )
537 $ CALL ZLASET( 'Full', N, N, CZERO, CZERO, B, LDA )
538 ELSE
539 IN = N
540 END IF
541 CALL ZLATM4( KBTYPE( JTYPE ), IN, KZ1( KBZERO( JTYPE ) ),
542 $ KZ2( KBZERO( JTYPE ) ), LBSIGN( JTYPE ),
543 $ RMAGN( KBMAGN( JTYPE ) ), ONE,
544 $ RMAGN( KTRIAN( JTYPE )*KBMAGN( JTYPE ) ), 2,
545 $ ISEED, B, LDA )
546 IADD = KADD( KBZERO( JTYPE ) )
547 IF( IADD.NE.0 .AND. IADD.LE.N )
548 $ B( IADD, IADD ) = RMAGN( KBMAGN( JTYPE ) )
549 *
550 IF( KCLASS( JTYPE ).EQ.2 .AND. N.GT.0 ) THEN
551 *
552 * Include rotations
553 *
554 * Generate Q, Z as Householder transformations times
555 * a diagonal matrix.
556 *
557 DO 50 JC = 1, N - 1
558 DO 40 JR = JC, N
559 Q( JR, JC ) = ZLARND( 3, ISEED )
560 Z( JR, JC ) = ZLARND( 3, ISEED )
561 40 CONTINUE
562 CALL ZLARFG( N+1-JC, Q( JC, JC ), Q( JC+1, JC ), 1,
563 $ WORK( JC ) )
564 WORK( 2*N+JC ) = SIGN( ONE, DBLE( Q( JC, JC ) ) )
565 Q( JC, JC ) = CONE
566 CALL ZLARFG( N+1-JC, Z( JC, JC ), Z( JC+1, JC ), 1,
567 $ WORK( N+JC ) )
568 WORK( 3*N+JC ) = SIGN( ONE, DBLE( Z( JC, JC ) ) )
569 Z( JC, JC ) = CONE
570 50 CONTINUE
571 CTEMP = ZLARND( 3, ISEED )
572 Q( N, N ) = CONE
573 WORK( N ) = CZERO
574 WORK( 3*N ) = CTEMP / ABS( CTEMP )
575 CTEMP = ZLARND( 3, ISEED )
576 Z( N, N ) = CONE
577 WORK( 2*N ) = CZERO
578 WORK( 4*N ) = CTEMP / ABS( CTEMP )
579 *
580 * Apply the diagonal matrices
581 *
582 DO 70 JC = 1, N
583 DO 60 JR = 1, N
584 A( JR, JC ) = WORK( 2*N+JR )*
585 $ DCONJG( WORK( 3*N+JC ) )*
586 $ A( JR, JC )
587 B( JR, JC ) = WORK( 2*N+JR )*
588 $ DCONJG( WORK( 3*N+JC ) )*
589 $ B( JR, JC )
590 60 CONTINUE
591 70 CONTINUE
592 CALL ZUNM2R( 'L', 'N', N, N, N-1, Q, LDQ, WORK, A,
593 $ LDA, WORK( 2*N+1 ), IINFO )
594 IF( IINFO.NE.0 )
595 $ GO TO 100
596 CALL ZUNM2R( 'R', 'C', N, N, N-1, Z, LDQ, WORK( N+1 ),
597 $ A, LDA, WORK( 2*N+1 ), IINFO )
598 IF( IINFO.NE.0 )
599 $ GO TO 100
600 CALL ZUNM2R( 'L', 'N', N, N, N-1, Q, LDQ, WORK, B,
601 $ LDA, WORK( 2*N+1 ), IINFO )
602 IF( IINFO.NE.0 )
603 $ GO TO 100
604 CALL ZUNM2R( 'R', 'C', N, N, N-1, Z, LDQ, WORK( N+1 ),
605 $ B, LDA, WORK( 2*N+1 ), IINFO )
606 IF( IINFO.NE.0 )
607 $ GO TO 100
608 END IF
609 ELSE
610 *
611 * Random matrices
612 *
613 DO 90 JC = 1, N
614 DO 80 JR = 1, N
615 A( JR, JC ) = RMAGN( KAMAGN( JTYPE ) )*
616 $ ZLARND( 4, ISEED )
617 B( JR, JC ) = RMAGN( KBMAGN( JTYPE ) )*
618 $ ZLARND( 4, ISEED )
619 80 CONTINUE
620 90 CONTINUE
621 END IF
622 *
623 100 CONTINUE
624 *
625 IF( IINFO.NE.0 ) THEN
626 WRITE( NOUNIT, FMT = 9999 )'Generator', IINFO, N, JTYPE,
627 $ IOLDSD
628 INFO = ABS( IINFO )
629 RETURN
630 END IF
631 *
632 110 CONTINUE
633 *
634 * Call ZGEGS to compute H, T, Q, Z, alpha, and beta.
635 *
636 CALL ZLACPY( ' ', N, N, A, LDA, S, LDA )
637 CALL ZLACPY( ' ', N, N, B, LDA, T, LDA )
638 NTEST = 1
639 RESULT( 1 ) = ULPINV
640 *
641 CALL ZGEGS( 'V', 'V', N, S, LDA, T, LDA, ALPHA1, BETA1, Q,
642 $ LDQ, Z, LDQ, WORK, LWORK, RWORK, IINFO )
643 IF( IINFO.NE.0 ) THEN
644 WRITE( NOUNIT, FMT = 9999 )'ZGEGS', IINFO, N, JTYPE,
645 $ IOLDSD
646 INFO = ABS( IINFO )
647 GO TO 130
648 END IF
649 *
650 NTEST = 4
651 *
652 * Do tests 1--4
653 *
654 CALL ZGET51( 1, N, A, LDA, S, LDA, Q, LDQ, Z, LDQ, WORK,
655 $ RWORK, RESULT( 1 ) )
656 CALL ZGET51( 1, N, B, LDA, T, LDA, Q, LDQ, Z, LDQ, WORK,
657 $ RWORK, RESULT( 2 ) )
658 CALL ZGET51( 3, N, B, LDA, T, LDA, Q, LDQ, Q, LDQ, WORK,
659 $ RWORK, RESULT( 3 ) )
660 CALL ZGET51( 3, N, B, LDA, T, LDA, Z, LDQ, Z, LDQ, WORK,
661 $ RWORK, RESULT( 4 ) )
662 *
663 * Do test 5: compare eigenvalues with diagonals.
664 *
665 TEMP1 = ZERO
666 *
667 DO 120 J = 1, N
668 TEMP2 = ( ABS1( ALPHA1( J )-S( J, J ) ) /
669 $ MAX( SAFMIN, ABS1( ALPHA1( J ) ), ABS1( S( J,
670 $ J ) ) )+ABS1( BETA1( J )-T( J, J ) ) /
671 $ MAX( SAFMIN, ABS1( BETA1( J ) ), ABS1( T( J,
672 $ J ) ) ) ) / ULP
673 TEMP1 = MAX( TEMP1, TEMP2 )
674 120 CONTINUE
675 RESULT( 5 ) = TEMP1
676 *
677 * Call ZGEGV to compute S2, T2, VL, and VR, do tests.
678 *
679 * Eigenvalues and Eigenvectors
680 *
681 CALL ZLACPY( ' ', N, N, A, LDA, S2, LDA )
682 CALL ZLACPY( ' ', N, N, B, LDA, T2, LDA )
683 NTEST = 6
684 RESULT( 6 ) = ULPINV
685 *
686 CALL ZGEGV( 'V', 'V', N, S2, LDA, T2, LDA, ALPHA2, BETA2,
687 $ VL, LDQ, VR, LDQ, WORK, LWORK, RWORK, IINFO )
688 IF( IINFO.NE.0 ) THEN
689 WRITE( NOUNIT, FMT = 9999 )'ZGEGV', IINFO, N, JTYPE,
690 $ IOLDSD
691 INFO = ABS( IINFO )
692 GO TO 130
693 END IF
694 *
695 NTEST = 7
696 *
697 * Do Tests 6 and 7
698 *
699 CALL ZGET52( .TRUE., N, A, LDA, B, LDA, VL, LDQ, ALPHA2,
700 $ BETA2, WORK, RWORK, DUMMA( 1 ) )
701 RESULT( 6 ) = DUMMA( 1 )
702 IF( DUMMA( 2 ).GT.THRSHN ) THEN
703 WRITE( NOUNIT, FMT = 9998 )'Left', 'ZGEGV', DUMMA( 2 ),
704 $ N, JTYPE, IOLDSD
705 END IF
706 *
707 CALL ZGET52( .FALSE., N, A, LDA, B, LDA, VR, LDQ, ALPHA2,
708 $ BETA2, WORK, RWORK, DUMMA( 1 ) )
709 RESULT( 7 ) = DUMMA( 1 )
710 IF( DUMMA( 2 ).GT.THRESH ) THEN
711 WRITE( NOUNIT, FMT = 9998 )'Right', 'ZGEGV', DUMMA( 2 ),
712 $ N, JTYPE, IOLDSD
713 END IF
714 *
715 * End of Loop -- Check for RESULT(j) > THRESH
716 *
717 130 CONTINUE
718 *
719 NTESTT = NTESTT + NTEST
720 *
721 * Print out tests which fail.
722 *
723 DO 140 JR = 1, NTEST
724 IF( RESULT( JR ).GE.THRESH ) THEN
725 *
726 * If this is the first test to fail,
727 * print a header to the data file.
728 *
729 IF( NERRS.EQ.0 ) THEN
730 WRITE( NOUNIT, FMT = 9997 )'ZGG'
731 *
732 * Matrix types
733 *
734 WRITE( NOUNIT, FMT = 9996 )
735 WRITE( NOUNIT, FMT = 9995 )
736 WRITE( NOUNIT, FMT = 9994 )'Unitary'
737 *
738 * Tests performed
739 *
740 WRITE( NOUNIT, FMT = 9993 )'unitary', '*',
741 $ 'conjugate transpose', ( '*', J = 1, 5 )
742 *
743 END IF
744 NERRS = NERRS + 1
745 IF( RESULT( JR ).LT.10000.0D0 ) THEN
746 WRITE( NOUNIT, FMT = 9992 )N, JTYPE, IOLDSD, JR,
747 $ RESULT( JR )
748 ELSE
749 WRITE( NOUNIT, FMT = 9991 )N, JTYPE, IOLDSD, JR,
750 $ RESULT( JR )
751 END IF
752 END IF
753 140 CONTINUE
754 *
755 150 CONTINUE
756 160 CONTINUE
757 *
758 * Summary
759 *
760 CALL ALASVM( 'ZGG', NOUNIT, NERRS, NTESTT, 0 )
761 RETURN
762 *
763 9999 FORMAT( ' ZDRVGG: ', A, ' returned INFO=', I6, '.', / 9X, 'N=',
764 $ I6, ', JTYPE=', I6, ', ISEED=(', 3( I5, ',' ), I5, ')' )
765 *
766 9998 FORMAT( ' ZDRVGG: ', A, ' Eigenvectors from ', A, ' incorrectly ',
767 $ 'normalized.', / ' Bits of error=', 0P, G10.3, ',', 9X,
768 $ 'N=', I6, ', JTYPE=', I6, ', ISEED=(', 3( I5, ',' ), I5,
769 $ ')' )
770 *
771 9997 FORMAT( / 1X, A3,
772 $ ' -- Complex Generalized eigenvalue problem driver' )
773 *
774 9996 FORMAT( ' Matrix types (see ZDRVGG for details): ' )
775 *
776 9995 FORMAT( ' Special Matrices:', 23X,
777 $ '(J''=transposed Jordan block)',
778 $ / ' 1=(0,0) 2=(I,0) 3=(0,I) 4=(I,I) 5=(J'',J'') ',
779 $ '6=(diag(J'',I), diag(I,J''))', / ' Diagonal Matrices: ( ',
780 $ 'D=diag(0,1,2,...) )', / ' 7=(D,I) 9=(large*D, small*I',
781 $ ') 11=(large*I, small*D) 13=(large*D, large*I)', /
782 $ ' 8=(I,D) 10=(small*D, large*I) 12=(small*I, large*D) ',
783 $ ' 14=(small*D, small*I)', / ' 15=(D, reversed D)' )
784 9994 FORMAT( ' Matrices Rotated by Random ', A, ' Matrices U, V:',
785 $ / ' 16=Transposed Jordan Blocks 19=geometric ',
786 $ 'alpha, beta=0,1', / ' 17=arithm. alpha&beta ',
787 $ ' 20=arithmetic alpha, beta=0,1', / ' 18=clustered ',
788 $ 'alpha, beta=0,1 21=random alpha, beta=0,1',
789 $ / ' Large & Small Matrices:', / ' 22=(large, small) ',
790 $ '23=(small,large) 24=(small,small) 25=(large,large)',
791 $ / ' 26=random O(1) matrices.' )
792 *
793 9993 FORMAT( / ' Tests performed: (S is Schur, T is triangular, ',
794 $ 'Q and Z are ', A, ',', / 20X,
795 $ 'l and r are the appropriate left and right', / 19X,
796 $ 'eigenvectors, resp., a is alpha, b is beta, and', / 19X, A,
797 $ ' means ', A, '.)', / ' 1 = | A - Q S Z', A,
798 $ ' | / ( |A| n ulp ) 2 = | B - Q T Z', A,
799 $ ' | / ( |B| n ulp )', / ' 3 = | I - QQ', A,
800 $ ' | / ( n ulp ) 4 = | I - ZZ', A,
801 $ ' | / ( n ulp )', /
802 $ ' 5 = difference between (alpha,beta) and diagonals of',
803 $ ' (S,T)', / ' 6 = max | ( b A - a B )', A,
804 $ ' l | / const. 7 = max | ( b A - a B ) r | / const.',
805 $ / 1X )
806 9992 FORMAT( ' Matrix order=', I5, ', type=', I2, ', seed=',
807 $ 4( I4, ',' ), ' result ', I3, ' is', 0P, F8.2 )
808 9991 FORMAT( ' Matrix order=', I5, ', type=', I2, ', seed=',
809 $ 4( I4, ',' ), ' result ', I3, ' is', 1P, D10.3 )
810 *
811 * End of ZDRVGG
812 *
813 END
2 $ THRSHN, NOUNIT, A, LDA, B, S, T, S2, T2, Q,
3 $ LDQ, Z, ALPHA1, BETA1, ALPHA2, BETA2, VL, VR,
4 $ WORK, LWORK, RWORK, RESULT, INFO )
5 *
6 * -- LAPACK test routine (version 3.1) --
7 * Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
8 * November 2006
9 *
10 * .. Scalar Arguments ..
11 INTEGER INFO, LDA, LDQ, LWORK, NOUNIT, NSIZES, NTYPES
12 DOUBLE PRECISION THRESH, THRSHN
13 * ..
14 * .. Array Arguments ..
15 *
16 * Purpose
17 * =======
18 *
19 * ZDRVGG checks the nonsymmetric generalized eigenvalue driver
20 * routines.
21 * T T T
22 * ZGEGS factors A and B as Q S Z and Q T Z , where means
23 * transpose, T is upper triangular, S is in generalized Schur form
24 * (upper triangular), and Q and Z are unitary. It also
25 * computes the generalized eigenvalues (alpha(1),beta(1)), ...,
26 * (alpha(n),beta(n)), where alpha(j)=S(j,j) and beta(j)=T(j,j) --
27 * thus, w(j) = alpha(j)/beta(j) is a root of the generalized
28 * eigenvalue problem
29 *
30 * det( A - w(j) B ) = 0
31 *
32 * and m(j) = beta(j)/alpha(j) is a root of the essentially equivalent
33 * problem
34 *
35 * det( m(j) A - B ) = 0
36 *
37 * ZGEGV computes the generalized eigenvalues (alpha(1),beta(1)), ...,
38 * (alpha(n),beta(n)), the matrix L whose columns contain the
39 * generalized left eigenvectors l, and the matrix R whose columns
40 * contain the generalized right eigenvectors r for the pair (A,B).
41 *
42 * When ZDRVGG is called, a number of matrix "sizes" ("n's") and a
43 * number of matrix "types" are specified. For each size ("n")
44 * and each type of matrix, one matrix will be generated and used
45 * to test the nonsymmetric eigenroutines. For each matrix, 7
46 * tests will be performed and compared with the threshhold THRESH:
47 *
48 * Results from ZGEGS:
49 *
50 * H
51 * (1) | A - Q S Z | / ( |A| n ulp )
52 *
53 * H
54 * (2) | B - Q T Z | / ( |B| n ulp )
55 *
56 * H
57 * (3) | I - QQ | / ( n ulp )
58 *
59 * H
60 * (4) | I - ZZ | / ( n ulp )
61 *
62 * (5) maximum over j of D(j) where:
63 *
64 * |alpha(j) - S(j,j)| |beta(j) - T(j,j)|
65 * D(j) = ------------------------ + -----------------------
66 * max(|alpha(j)|,|S(j,j)|) max(|beta(j)|,|T(j,j)|)
67 *
68 * Results from ZGEGV:
69 *
70 * (6) max over all left eigenvalue/-vector pairs (beta/alpha,l) of
71 *
72 * | l**H * (beta A - alpha B) | / ( ulp max( |beta A|, |alpha B| ) )
73 *
74 * where l**H is the conjugate tranpose of l.
75 *
76 * (7) max over all right eigenvalue/-vector pairs (beta/alpha,r) of
77 *
78 * | (beta A - alpha B) r | / ( ulp max( |beta A|, |alpha B| ) )
79 *
80 * Test Matrices
81 * ---- --------
82 *
83 * The sizes of the test matrices are specified by an array
84 * NN(1:NSIZES); the value of each element NN(j) specifies one size.
85 * The "types" are specified by a logical array DOTYPE( 1:NTYPES ); if
86 * DOTYPE(j) is .TRUE., then matrix type "j" will be generated.
87 * Currently, the list of possible types is:
88 *
89 * (1) ( 0, 0 ) (a pair of zero matrices)
90 *
91 * (2) ( I, 0 ) (an identity and a zero matrix)
92 *
93 * (3) ( 0, I ) (an identity and a zero matrix)
94 *
95 * (4) ( I, I ) (a pair of identity matrices)
96 *
97 * t t
98 * (5) ( J , J ) (a pair of transposed Jordan blocks)
99 *
100 * t ( I 0 )
101 * (6) ( X, Y ) where X = ( J 0 ) and Y = ( t )
102 * ( 0 I ) ( 0 J )
103 * and I is a k x k identity and J a (k+1)x(k+1)
104 * Jordan block; k=(N-1)/2
105 *
106 * (7) ( D, I ) where D is diag( 0, 1,..., N-1 ) (a diagonal
107 * matrix with those diagonal entries.)
108 * (8) ( I, D )
109 *
110 * (9) ( big*D, small*I ) where "big" is near overflow and small=1/big
111 *
112 * (10) ( small*D, big*I )
113 *
114 * (11) ( big*I, small*D )
115 *
116 * (12) ( small*I, big*D )
117 *
118 * (13) ( big*D, big*I )
119 *
120 * (14) ( small*D, small*I )
121 *
122 * (15) ( D1, D2 ) where D1 is diag( 0, 0, 1, ..., N-3, 0 ) and
123 * D2 is diag( 0, N-3, N-4,..., 1, 0, 0 )
124 * t t
125 * (16) Q ( J , J ) Z where Q and Z are random unitary matrices.
126 *
127 * (17) Q ( T1, T2 ) Z where T1 and T2 are upper triangular matrices
128 * with random O(1) entries above the diagonal
129 * and diagonal entries diag(T1) =
130 * ( 0, 0, 1, ..., N-3, 0 ) and diag(T2) =
131 * ( 0, N-3, N-4,..., 1, 0, 0 )
132 *
133 * (18) Q ( T1, T2 ) Z diag(T1) = ( 0, 0, 1, 1, s, ..., s, 0 )
134 * diag(T2) = ( 0, 1, 0, 1,..., 1, 0 )
135 * s = machine precision.
136 *
137 * (19) Q ( T1, T2 ) Z diag(T1)=( 0,0,1,1, 1-d, ..., 1-(N-5)*d=s, 0 )
138 * diag(T2) = ( 0, 1, 0, 1, ..., 1, 0 )
139 *
140 * N-5
141 * (20) Q ( T1, T2 ) Z diag(T1)=( 0, 0, 1, 1, a, ..., a =s, 0 )
142 * diag(T2) = ( 0, 1, 0, 1, ..., 1, 0, 0 )
143 *
144 * (21) Q ( T1, T2 ) Z diag(T1)=( 0, 0, 1, r1, r2, ..., r(N-4), 0 )
145 * diag(T2) = ( 0, 1, 0, 1, ..., 1, 0, 0 )
146 * where r1,..., r(N-4) are random.
147 *
148 * (22) Q ( big*T1, small*T2 ) Z diag(T1) = ( 0, 0, 1, ..., N-3, 0 )
149 * diag(T2) = ( 0, 1, ..., 1, 0, 0 )
150 *
151 * (23) Q ( small*T1, big*T2 ) Z diag(T1) = ( 0, 0, 1, ..., N-3, 0 )
152 * diag(T2) = ( 0, 1, ..., 1, 0, 0 )
153 *
154 * (24) Q ( small*T1, small*T2 ) Z diag(T1) = ( 0, 0, 1, ..., N-3, 0 )
155 * diag(T2) = ( 0, 1, ..., 1, 0, 0 )
156 *
157 * (25) Q ( big*T1, big*T2 ) Z diag(T1) = ( 0, 0, 1, ..., N-3, 0 )
158 * diag(T2) = ( 0, 1, ..., 1, 0, 0 )
159 *
160 * (26) Q ( T1, T2 ) Z where T1 and T2 are random upper-triangular
161 * matrices.
162 *
163 * Arguments
164 * =========
165 *
166 * NSIZES (input) INTEGER
167 * The number of sizes of matrices to use. If it is zero,
168 * ZDRVGG does nothing. It must be at least zero.
169 *
170 * NN (input) INTEGER array, dimension (NSIZES)
171 * An array containing the sizes to be used for the matrices.
172 * Zero values will be skipped. The values must be at least
173 * zero.
174 *
175 * NTYPES (input) INTEGER
176 * The number of elements in DOTYPE. If it is zero, ZDRVGG
177 * does nothing. It must be at least zero. If it is MAXTYP+1
178 * and NSIZES is 1, then an additional type, MAXTYP+1 is
179 * defined, which is to use whatever matrix is in A. This
180 * is only useful if DOTYPE(1:MAXTYP) is .FALSE. and
181 * DOTYPE(MAXTYP+1) is .TRUE. .
182 *
183 * DOTYPE (input) LOGICAL array, dimension (NTYPES)
184 * If DOTYPE(j) is .TRUE., then for each size in NN a
185 * matrix of that size and of type j will be generated.
186 * If NTYPES is smaller than the maximum number of types
187 * defined (PARAMETER MAXTYP), then types NTYPES+1 through
188 * MAXTYP will not be generated. If NTYPES is larger
189 * than MAXTYP, DOTYPE(MAXTYP+1) through DOTYPE(NTYPES)
190 * will be ignored.
191 *
192 * ISEED (input/output) INTEGER array, dimension (4)
193 * On entry ISEED specifies the seed of the random number
194 * generator. The array elements should be between 0 and 4095;
195 * if not they will be reduced mod 4096. Also, ISEED(4) must
196 * be odd. The random number generator uses a linear
197 * congruential sequence limited to small integers, and so
198 * should produce machine independent random numbers. The
199 * values of ISEED are changed on exit, and can be used in the
200 * next call to ZDRVGG to continue the same random number
201 * sequence.
202 *
203 * THRESH (input) DOUBLE PRECISION
204 * A test will count as "failed" if the "error", computed as
205 * described above, exceeds THRESH. Note that the error is
206 * scaled to be O(1), so THRESH should be a reasonably small
207 * multiple of 1, e.g., 10 or 100. In particular, it should
208 * not depend on the precision (single vs. double) or the size
209 * of the matrix. It must be at least zero.
210 *
211 * THRSHN (input) DOUBLE PRECISION
212 * Threshhold for reporting eigenvector normalization error.
213 * If the normalization of any eigenvector differs from 1 by
214 * more than THRSHN*ulp, then a special error message will be
215 * printed. (This is handled separately from the other tests,
216 * since only a compiler or programming error should cause an
217 * error message, at least if THRSHN is at least 5--10.)
218 *
219 * NOUNIT (input) INTEGER
220 * The FORTRAN unit number for printing out error messages
221 * (e.g., if a routine returns IINFO not equal to 0.)
222 *
223 * A (input/workspace) COMPLEX*16 array, dimension (LDA, max(NN))
224 * Used to hold the original A matrix. Used as input only
225 * if NTYPES=MAXTYP+1, DOTYPE(1:MAXTYP)=.FALSE., and
226 * DOTYPE(MAXTYP+1)=.TRUE.
227 *
228 * LDA (input) INTEGER
229 * The leading dimension of A, B, S, T, S2, and T2.
230 * It must be at least 1 and at least max( NN ).
231 *
232 * B (input/workspace) COMPLEX*16 array, dimension (LDA, max(NN))
233 * Used to hold the original B matrix. Used as input only
234 * if NTYPES=MAXTYP+1, DOTYPE(1:MAXTYP)=.FALSE., and
235 * DOTYPE(MAXTYP+1)=.TRUE.
236 *
237 * S (workspace) COMPLEX*16 array, dimension (LDA, max(NN))
238 * The upper triangular matrix computed from A by ZGEGS.
239 *
240 * T (workspace) COMPLEX*16 array, dimension (LDA, max(NN))
241 * The upper triangular matrix computed from B by ZGEGS.
242 *
243 * S2 (workspace) COMPLEX*16 array, dimension (LDA, max(NN))
244 * The matrix computed from A by ZGEGV. This will be the
245 * Schur (upper triangular) form of some matrix related to A,
246 * but will not, in general, be the same as S.
247 *
248 * T2 (workspace) COMPLEX*16 array, dimension (LDA, max(NN))
249 * The matrix computed from B by ZGEGV. This will be the
250 * Schur form of some matrix related to B, but will not, in
251 * general, be the same as T.
252 *
253 * Q (workspace) COMPLEX*16 array, dimension (LDQ, max(NN))
254 * The (left) unitary matrix computed by ZGEGS.
255 *
256 * LDQ (input) INTEGER
257 * The leading dimension of Q, Z, VL, and VR. It must
258 * be at least 1 and at least max( NN ).
259 *
260 * Z (workspace) COMPLEX*16 array, dimension (LDQ, max(NN))
261 * The (right) unitary matrix computed by ZGEGS.
262 *
263 * ALPHA1 (workspace) COMPLEX*16 array, dimension (max(NN))
264 * BETA1 (workspace) COMPLEX*16 array, dimension (max(NN))
265 * The generalized eigenvalues of (A,B) computed by ZGEGS.
266 * ALPHA1(k) / BETA1(k) is the k-th generalized eigenvalue of
267 * the matrices in A and B.
268 *
269 * ALPHA2 (workspace) COMPLEX*16 array, dimension (max(NN))
270 * BETA2 (workspace) COMPLEX*16 array, dimension (max(NN))
271 * The generalized eigenvalues of (A,B) computed by ZGEGV.
272 * ALPHA2(k) / BETA2(k) is the k-th generalized eigenvalue of
273 * the matrices in A and B.
274 *
275 * VL (workspace) COMPLEX*16 array, dimension (LDQ, max(NN))
276 * The (lower triangular) left eigenvector matrix for the
277 * matrices in A and B.
278 *
279 * VR (workspace) COMPLEX*16 array, dimension (LDQ, max(NN))
280 * The (upper triangular) right eigenvector matrix for the
281 * matrices in A and B.
282 *
283 * WORK (workspace) COMPLEX*16 array, dimension (LWORK)
284 *
285 * LWORK (input) INTEGER
286 * The number of entries in WORK. This must be at least
287 * MAX( 2*N, N*(NB+1), (k+1)*(2*k+N+1) ), where "k" is the
288 * sum of the blocksize and number-of-shifts for ZHGEQZ, and
289 * NB is the greatest of the blocksizes for ZGEQRF, ZUNMQR,
290 * and ZUNGQR. (The blocksizes and the number-of-shifts are
291 * retrieved through calls to ILAENV.)
292 *
293 * RWORK (workspace) DOUBLE PRECISION array, dimension (8*N)
294 *
295 * RESULT (output) DOUBLE PRECISION array, dimension (7)
296 * The values computed by the tests described above.
297 * The values are currently limited to 1/ulp, to avoid
298 * overflow.
299 *
300 * INFO (output) INTEGER
301 * = 0: successful exit
302 * < 0: if INFO = -i, the i-th argument had an illegal value.
303 * > 0: A routine returned an error code. INFO is the
304 * absolute value of the INFO value returned.
305 *
306 * =====================================================================
307 *
308 LOGICAL DOTYPE( * )
309 INTEGER ISEED( 4 ), NN( * )
310 DOUBLE PRECISION RESULT( * ), RWORK( * )
311 COMPLEX*16 A( LDA, * ), ALPHA1( * ), ALPHA2( * ),
312 $ B( LDA, * ), BETA1( * ), BETA2( * ),
313 $ Q( LDQ, * ), S( LDA, * ), S2( LDA, * ),
314 $ T( LDA, * ), T2( LDA, * ), VL( LDQ, * ),
315 $ VR( LDQ, * ), WORK( * ), Z( LDQ, * )
316 * ..
317 * .. Parameters ..
318 DOUBLE PRECISION ZERO, ONE
319 PARAMETER ( ZERO = 0.0D+0, ONE = 1.0D+0 )
320 COMPLEX*16 CZERO, CONE
321 PARAMETER ( CZERO = ( 0.0D+0, 0.0D+0 ),
322 $ CONE = ( 1.0D+0, 0.0D+0 ) )
323 INTEGER MAXTYP
324 PARAMETER ( MAXTYP = 26 )
325 * ..
326 * .. Local Scalars ..
327 LOGICAL BADNN
328 INTEGER I1, IADD, IINFO, IN, J, JC, JR, JSIZE, JTYPE,
329 $ LWKOPT, MTYPES, N, N1, NB, NBZ, NERRS, NMATS,
330 $ NMAX, NS, NTEST, NTESTT
331 DOUBLE PRECISION SAFMAX, SAFMIN, TEMP1, TEMP2, ULP, ULPINV
332 COMPLEX*16 CTEMP, X
333 * ..
334 * .. Local Arrays ..
335 LOGICAL LASIGN( MAXTYP ), LBSIGN( MAXTYP )
336 INTEGER IOLDSD( 4 ), KADD( 6 ), KAMAGN( MAXTYP ),
337 $ KATYPE( MAXTYP ), KAZERO( MAXTYP ),
338 $ KBMAGN( MAXTYP ), KBTYPE( MAXTYP ),
339 $ KBZERO( MAXTYP ), KCLASS( MAXTYP ),
340 $ KTRIAN( MAXTYP ), KZ1( 6 ), KZ2( 6 )
341 DOUBLE PRECISION DUMMA( 4 ), RMAGN( 0: 3 )
342 * ..
343 * .. External Functions ..
344 INTEGER ILAENV
345 DOUBLE PRECISION DLAMCH
346 COMPLEX*16 ZLARND
347 EXTERNAL ILAENV, DLAMCH, ZLARND
348 * ..
349 * .. External Subroutines ..
350 EXTERNAL ALASVM, DLABAD, XERBLA, ZGEGS, ZGEGV, ZGET51,
351 $ ZGET52, ZLACPY, ZLARFG, ZLASET, ZLATM4, ZUNM2R
352 * ..
353 * .. Intrinsic Functions ..
354 INTRINSIC ABS, DBLE, DCONJG, DIMAG, MAX, MIN, SIGN
355 * ..
356 * .. Statement Functions ..
357 DOUBLE PRECISION ABS1
358 * ..
359 * .. Statement Function definitions ..
360 ABS1( X ) = ABS( DBLE( X ) ) + ABS( DIMAG( X ) )
361 * ..
362 * .. Data statements ..
363 DATA KCLASS / 15*1, 10*2, 1*3 /
364 DATA KZ1 / 0, 1, 2, 1, 3, 3 /
365 DATA KZ2 / 0, 0, 1, 2, 1, 1 /
366 DATA KADD / 0, 0, 0, 0, 3, 2 /
367 DATA KATYPE / 0, 1, 0, 1, 2, 3, 4, 1, 4, 4, 1, 1, 4,
368 $ 4, 4, 2, 4, 5, 8, 7, 9, 4*4, 0 /
369 DATA KBTYPE / 0, 0, 1, 1, 2, -3, 1, 4, 1, 1, 4, 4,
370 $ 1, 1, -4, 2, -4, 8*8, 0 /
371 DATA KAZERO / 6*1, 2, 1, 2*2, 2*1, 2*2, 3, 1, 3,
372 $ 4*5, 4*3, 1 /
373 DATA KBZERO / 6*1, 1, 2, 2*1, 2*2, 2*1, 4, 1, 4,
374 $ 4*6, 4*4, 1 /
375 DATA KAMAGN / 8*1, 2, 3, 2, 3, 2, 3, 7*1, 2, 3, 3,
376 $ 2, 1 /
377 DATA KBMAGN / 8*1, 3, 2, 3, 2, 2, 3, 7*1, 3, 2, 3,
378 $ 2, 1 /
379 DATA KTRIAN / 16*0, 10*1 /
380 DATA LASIGN / 6*.FALSE., .TRUE., .FALSE., 2*.TRUE.,
381 $ 2*.FALSE., 3*.TRUE., .FALSE., .TRUE.,
382 $ 3*.FALSE., 5*.TRUE., .FALSE. /
383 DATA LBSIGN / 7*.FALSE., .TRUE., 2*.FALSE.,
384 $ 2*.TRUE., 2*.FALSE., .TRUE., .FALSE., .TRUE.,
385 $ 9*.FALSE. /
386 * ..
387 * .. Executable Statements ..
388 *
389 * Check for errors
390 *
391 INFO = 0
392 *
393 BADNN = .FALSE.
394 NMAX = 1
395 DO 10 J = 1, NSIZES
396 NMAX = MAX( NMAX, NN( J ) )
397 IF( NN( J ).LT.0 )
398 $ BADNN = .TRUE.
399 10 CONTINUE
400 *
401 * Maximum blocksize and shift -- we assume that blocksize and number
402 * of shifts are monotone increasing functions of N.
403 *
404 NB = MAX( 1, ILAENV( 1, 'ZGEQRF', ' ', NMAX, NMAX, -1, -1 ),
405 $ ILAENV( 1, 'ZUNMQR', 'LC', NMAX, NMAX, NMAX, -1 ),
406 $ ILAENV( 1, 'ZUNGQR', ' ', NMAX, NMAX, NMAX, -1 ) )
407 NBZ = ILAENV( 1, 'ZHGEQZ', 'SII', NMAX, 1, NMAX, 0 )
408 NS = ILAENV( 4, 'ZHGEQZ', 'SII', NMAX, 1, NMAX, 0 )
409 I1 = NBZ + NS
410 LWKOPT = MAX( 2*NMAX, NMAX*( NB+1 ), ( 2*I1+NMAX+1 )*( I1+1 ) )
411 *
412 * Check for errors
413 *
414 IF( NSIZES.LT.0 ) THEN
415 INFO = -1
416 ELSE IF( BADNN ) THEN
417 INFO = -2
418 ELSE IF( NTYPES.LT.0 ) THEN
419 INFO = -3
420 ELSE IF( THRESH.LT.ZERO ) THEN
421 INFO = -6
422 ELSE IF( LDA.LE.1 .OR. LDA.LT.NMAX ) THEN
423 INFO = -10
424 ELSE IF( LDQ.LE.1 .OR. LDQ.LT.NMAX ) THEN
425 INFO = -19
426 ELSE IF( LWKOPT.GT.LWORK ) THEN
427 INFO = -30
428 END IF
429 *
430 IF( INFO.NE.0 ) THEN
431 CALL XERBLA( 'ZDRVGG', -INFO )
432 RETURN
433 END IF
434 *
435 * Quick return if possible
436 *
437 IF( NSIZES.EQ.0 .OR. NTYPES.EQ.0 )
438 $ RETURN
439 *
440 ULP = DLAMCH( 'Precision' )
441 SAFMIN = DLAMCH( 'Safe minimum' )
442 SAFMIN = SAFMIN / ULP
443 SAFMAX = ONE / SAFMIN
444 CALL DLABAD( SAFMIN, SAFMAX )
445 ULPINV = ONE / ULP
446 *
447 * The values RMAGN(2:3) depend on N, see below.
448 *
449 RMAGN( 0 ) = ZERO
450 RMAGN( 1 ) = ONE
451 *
452 * Loop over sizes, types
453 *
454 NTESTT = 0
455 NERRS = 0
456 NMATS = 0
457 *
458 DO 160 JSIZE = 1, NSIZES
459 N = NN( JSIZE )
460 N1 = MAX( 1, N )
461 RMAGN( 2 ) = SAFMAX*ULP / DBLE( N1 )
462 RMAGN( 3 ) = SAFMIN*ULPINV*N1
463 *
464 IF( NSIZES.NE.1 ) THEN
465 MTYPES = MIN( MAXTYP, NTYPES )
466 ELSE
467 MTYPES = MIN( MAXTYP+1, NTYPES )
468 END IF
469 *
470 DO 150 JTYPE = 1, MTYPES
471 IF( .NOT.DOTYPE( JTYPE ) )
472 $ GO TO 150
473 NMATS = NMATS + 1
474 NTEST = 0
475 *
476 * Save ISEED in case of an error.
477 *
478 DO 20 J = 1, 4
479 IOLDSD( J ) = ISEED( J )
480 20 CONTINUE
481 *
482 * Initialize RESULT
483 *
484 DO 30 J = 1, 7
485 RESULT( J ) = ZERO
486 30 CONTINUE
487 *
488 * Compute A and B
489 *
490 * Description of control parameters:
491 *
492 * KZLASS: =1 means w/o rotation, =2 means w/ rotation,
493 * =3 means random.
494 * KATYPE: the "type" to be passed to ZLATM4 for computing A.
495 * KAZERO: the pattern of zeros on the diagonal for A:
496 * =1: ( xxx ), =2: (0, xxx ) =3: ( 0, 0, xxx, 0 ),
497 * =4: ( 0, xxx, 0, 0 ), =5: ( 0, 0, 1, xxx, 0 ),
498 * =6: ( 0, 1, 0, xxx, 0 ). (xxx means a string of
499 * non-zero entries.)
500 * KAMAGN: the magnitude of the matrix: =0: zero, =1: O(1),
501 * =2: large, =3: small.
502 * LASIGN: .TRUE. if the diagonal elements of A are to be
503 * multiplied by a random magnitude 1 number.
504 * KBTYPE, KBZERO, KBMAGN, IBSIGN: the same, but for B.
505 * KTRIAN: =0: don't fill in the upper triangle, =1: do.
506 * KZ1, KZ2, KADD: used to implement KAZERO and KBZERO.
507 * RMAGN: used to implement KAMAGN and KBMAGN.
508 *
509 IF( MTYPES.GT.MAXTYP )
510 $ GO TO 110
511 IINFO = 0
512 IF( KCLASS( JTYPE ).LT.3 ) THEN
513 *
514 * Generate A (w/o rotation)
515 *
516 IF( ABS( KATYPE( JTYPE ) ).EQ.3 ) THEN
517 IN = 2*( ( N-1 ) / 2 ) + 1
518 IF( IN.NE.N )
519 $ CALL ZLASET( 'Full', N, N, CZERO, CZERO, A, LDA )
520 ELSE
521 IN = N
522 END IF
523 CALL ZLATM4( KATYPE( JTYPE ), IN, KZ1( KAZERO( JTYPE ) ),
524 $ KZ2( KAZERO( JTYPE ) ), LASIGN( JTYPE ),
525 $ RMAGN( KAMAGN( JTYPE ) ), ULP,
526 $ RMAGN( KTRIAN( JTYPE )*KAMAGN( JTYPE ) ), 2,
527 $ ISEED, A, LDA )
528 IADD = KADD( KAZERO( JTYPE ) )
529 IF( IADD.GT.0 .AND. IADD.LE.N )
530 $ A( IADD, IADD ) = RMAGN( KAMAGN( JTYPE ) )
531 *
532 * Generate B (w/o rotation)
533 *
534 IF( ABS( KBTYPE( JTYPE ) ).EQ.3 ) THEN
535 IN = 2*( ( N-1 ) / 2 ) + 1
536 IF( IN.NE.N )
537 $ CALL ZLASET( 'Full', N, N, CZERO, CZERO, B, LDA )
538 ELSE
539 IN = N
540 END IF
541 CALL ZLATM4( KBTYPE( JTYPE ), IN, KZ1( KBZERO( JTYPE ) ),
542 $ KZ2( KBZERO( JTYPE ) ), LBSIGN( JTYPE ),
543 $ RMAGN( KBMAGN( JTYPE ) ), ONE,
544 $ RMAGN( KTRIAN( JTYPE )*KBMAGN( JTYPE ) ), 2,
545 $ ISEED, B, LDA )
546 IADD = KADD( KBZERO( JTYPE ) )
547 IF( IADD.NE.0 .AND. IADD.LE.N )
548 $ B( IADD, IADD ) = RMAGN( KBMAGN( JTYPE ) )
549 *
550 IF( KCLASS( JTYPE ).EQ.2 .AND. N.GT.0 ) THEN
551 *
552 * Include rotations
553 *
554 * Generate Q, Z as Householder transformations times
555 * a diagonal matrix.
556 *
557 DO 50 JC = 1, N - 1
558 DO 40 JR = JC, N
559 Q( JR, JC ) = ZLARND( 3, ISEED )
560 Z( JR, JC ) = ZLARND( 3, ISEED )
561 40 CONTINUE
562 CALL ZLARFG( N+1-JC, Q( JC, JC ), Q( JC+1, JC ), 1,
563 $ WORK( JC ) )
564 WORK( 2*N+JC ) = SIGN( ONE, DBLE( Q( JC, JC ) ) )
565 Q( JC, JC ) = CONE
566 CALL ZLARFG( N+1-JC, Z( JC, JC ), Z( JC+1, JC ), 1,
567 $ WORK( N+JC ) )
568 WORK( 3*N+JC ) = SIGN( ONE, DBLE( Z( JC, JC ) ) )
569 Z( JC, JC ) = CONE
570 50 CONTINUE
571 CTEMP = ZLARND( 3, ISEED )
572 Q( N, N ) = CONE
573 WORK( N ) = CZERO
574 WORK( 3*N ) = CTEMP / ABS( CTEMP )
575 CTEMP = ZLARND( 3, ISEED )
576 Z( N, N ) = CONE
577 WORK( 2*N ) = CZERO
578 WORK( 4*N ) = CTEMP / ABS( CTEMP )
579 *
580 * Apply the diagonal matrices
581 *
582 DO 70 JC = 1, N
583 DO 60 JR = 1, N
584 A( JR, JC ) = WORK( 2*N+JR )*
585 $ DCONJG( WORK( 3*N+JC ) )*
586 $ A( JR, JC )
587 B( JR, JC ) = WORK( 2*N+JR )*
588 $ DCONJG( WORK( 3*N+JC ) )*
589 $ B( JR, JC )
590 60 CONTINUE
591 70 CONTINUE
592 CALL ZUNM2R( 'L', 'N', N, N, N-1, Q, LDQ, WORK, A,
593 $ LDA, WORK( 2*N+1 ), IINFO )
594 IF( IINFO.NE.0 )
595 $ GO TO 100
596 CALL ZUNM2R( 'R', 'C', N, N, N-1, Z, LDQ, WORK( N+1 ),
597 $ A, LDA, WORK( 2*N+1 ), IINFO )
598 IF( IINFO.NE.0 )
599 $ GO TO 100
600 CALL ZUNM2R( 'L', 'N', N, N, N-1, Q, LDQ, WORK, B,
601 $ LDA, WORK( 2*N+1 ), IINFO )
602 IF( IINFO.NE.0 )
603 $ GO TO 100
604 CALL ZUNM2R( 'R', 'C', N, N, N-1, Z, LDQ, WORK( N+1 ),
605 $ B, LDA, WORK( 2*N+1 ), IINFO )
606 IF( IINFO.NE.0 )
607 $ GO TO 100
608 END IF
609 ELSE
610 *
611 * Random matrices
612 *
613 DO 90 JC = 1, N
614 DO 80 JR = 1, N
615 A( JR, JC ) = RMAGN( KAMAGN( JTYPE ) )*
616 $ ZLARND( 4, ISEED )
617 B( JR, JC ) = RMAGN( KBMAGN( JTYPE ) )*
618 $ ZLARND( 4, ISEED )
619 80 CONTINUE
620 90 CONTINUE
621 END IF
622 *
623 100 CONTINUE
624 *
625 IF( IINFO.NE.0 ) THEN
626 WRITE( NOUNIT, FMT = 9999 )'Generator', IINFO, N, JTYPE,
627 $ IOLDSD
628 INFO = ABS( IINFO )
629 RETURN
630 END IF
631 *
632 110 CONTINUE
633 *
634 * Call ZGEGS to compute H, T, Q, Z, alpha, and beta.
635 *
636 CALL ZLACPY( ' ', N, N, A, LDA, S, LDA )
637 CALL ZLACPY( ' ', N, N, B, LDA, T, LDA )
638 NTEST = 1
639 RESULT( 1 ) = ULPINV
640 *
641 CALL ZGEGS( 'V', 'V', N, S, LDA, T, LDA, ALPHA1, BETA1, Q,
642 $ LDQ, Z, LDQ, WORK, LWORK, RWORK, IINFO )
643 IF( IINFO.NE.0 ) THEN
644 WRITE( NOUNIT, FMT = 9999 )'ZGEGS', IINFO, N, JTYPE,
645 $ IOLDSD
646 INFO = ABS( IINFO )
647 GO TO 130
648 END IF
649 *
650 NTEST = 4
651 *
652 * Do tests 1--4
653 *
654 CALL ZGET51( 1, N, A, LDA, S, LDA, Q, LDQ, Z, LDQ, WORK,
655 $ RWORK, RESULT( 1 ) )
656 CALL ZGET51( 1, N, B, LDA, T, LDA, Q, LDQ, Z, LDQ, WORK,
657 $ RWORK, RESULT( 2 ) )
658 CALL ZGET51( 3, N, B, LDA, T, LDA, Q, LDQ, Q, LDQ, WORK,
659 $ RWORK, RESULT( 3 ) )
660 CALL ZGET51( 3, N, B, LDA, T, LDA, Z, LDQ, Z, LDQ, WORK,
661 $ RWORK, RESULT( 4 ) )
662 *
663 * Do test 5: compare eigenvalues with diagonals.
664 *
665 TEMP1 = ZERO
666 *
667 DO 120 J = 1, N
668 TEMP2 = ( ABS1( ALPHA1( J )-S( J, J ) ) /
669 $ MAX( SAFMIN, ABS1( ALPHA1( J ) ), ABS1( S( J,
670 $ J ) ) )+ABS1( BETA1( J )-T( J, J ) ) /
671 $ MAX( SAFMIN, ABS1( BETA1( J ) ), ABS1( T( J,
672 $ J ) ) ) ) / ULP
673 TEMP1 = MAX( TEMP1, TEMP2 )
674 120 CONTINUE
675 RESULT( 5 ) = TEMP1
676 *
677 * Call ZGEGV to compute S2, T2, VL, and VR, do tests.
678 *
679 * Eigenvalues and Eigenvectors
680 *
681 CALL ZLACPY( ' ', N, N, A, LDA, S2, LDA )
682 CALL ZLACPY( ' ', N, N, B, LDA, T2, LDA )
683 NTEST = 6
684 RESULT( 6 ) = ULPINV
685 *
686 CALL ZGEGV( 'V', 'V', N, S2, LDA, T2, LDA, ALPHA2, BETA2,
687 $ VL, LDQ, VR, LDQ, WORK, LWORK, RWORK, IINFO )
688 IF( IINFO.NE.0 ) THEN
689 WRITE( NOUNIT, FMT = 9999 )'ZGEGV', IINFO, N, JTYPE,
690 $ IOLDSD
691 INFO = ABS( IINFO )
692 GO TO 130
693 END IF
694 *
695 NTEST = 7
696 *
697 * Do Tests 6 and 7
698 *
699 CALL ZGET52( .TRUE., N, A, LDA, B, LDA, VL, LDQ, ALPHA2,
700 $ BETA2, WORK, RWORK, DUMMA( 1 ) )
701 RESULT( 6 ) = DUMMA( 1 )
702 IF( DUMMA( 2 ).GT.THRSHN ) THEN
703 WRITE( NOUNIT, FMT = 9998 )'Left', 'ZGEGV', DUMMA( 2 ),
704 $ N, JTYPE, IOLDSD
705 END IF
706 *
707 CALL ZGET52( .FALSE., N, A, LDA, B, LDA, VR, LDQ, ALPHA2,
708 $ BETA2, WORK, RWORK, DUMMA( 1 ) )
709 RESULT( 7 ) = DUMMA( 1 )
710 IF( DUMMA( 2 ).GT.THRESH ) THEN
711 WRITE( NOUNIT, FMT = 9998 )'Right', 'ZGEGV', DUMMA( 2 ),
712 $ N, JTYPE, IOLDSD
713 END IF
714 *
715 * End of Loop -- Check for RESULT(j) > THRESH
716 *
717 130 CONTINUE
718 *
719 NTESTT = NTESTT + NTEST
720 *
721 * Print out tests which fail.
722 *
723 DO 140 JR = 1, NTEST
724 IF( RESULT( JR ).GE.THRESH ) THEN
725 *
726 * If this is the first test to fail,
727 * print a header to the data file.
728 *
729 IF( NERRS.EQ.0 ) THEN
730 WRITE( NOUNIT, FMT = 9997 )'ZGG'
731 *
732 * Matrix types
733 *
734 WRITE( NOUNIT, FMT = 9996 )
735 WRITE( NOUNIT, FMT = 9995 )
736 WRITE( NOUNIT, FMT = 9994 )'Unitary'
737 *
738 * Tests performed
739 *
740 WRITE( NOUNIT, FMT = 9993 )'unitary', '*',
741 $ 'conjugate transpose', ( '*', J = 1, 5 )
742 *
743 END IF
744 NERRS = NERRS + 1
745 IF( RESULT( JR ).LT.10000.0D0 ) THEN
746 WRITE( NOUNIT, FMT = 9992 )N, JTYPE, IOLDSD, JR,
747 $ RESULT( JR )
748 ELSE
749 WRITE( NOUNIT, FMT = 9991 )N, JTYPE, IOLDSD, JR,
750 $ RESULT( JR )
751 END IF
752 END IF
753 140 CONTINUE
754 *
755 150 CONTINUE
756 160 CONTINUE
757 *
758 * Summary
759 *
760 CALL ALASVM( 'ZGG', NOUNIT, NERRS, NTESTT, 0 )
761 RETURN
762 *
763 9999 FORMAT( ' ZDRVGG: ', A, ' returned INFO=', I6, '.', / 9X, 'N=',
764 $ I6, ', JTYPE=', I6, ', ISEED=(', 3( I5, ',' ), I5, ')' )
765 *
766 9998 FORMAT( ' ZDRVGG: ', A, ' Eigenvectors from ', A, ' incorrectly ',
767 $ 'normalized.', / ' Bits of error=', 0P, G10.3, ',', 9X,
768 $ 'N=', I6, ', JTYPE=', I6, ', ISEED=(', 3( I5, ',' ), I5,
769 $ ')' )
770 *
771 9997 FORMAT( / 1X, A3,
772 $ ' -- Complex Generalized eigenvalue problem driver' )
773 *
774 9996 FORMAT( ' Matrix types (see ZDRVGG for details): ' )
775 *
776 9995 FORMAT( ' Special Matrices:', 23X,
777 $ '(J''=transposed Jordan block)',
778 $ / ' 1=(0,0) 2=(I,0) 3=(0,I) 4=(I,I) 5=(J'',J'') ',
779 $ '6=(diag(J'',I), diag(I,J''))', / ' Diagonal Matrices: ( ',
780 $ 'D=diag(0,1,2,...) )', / ' 7=(D,I) 9=(large*D, small*I',
781 $ ') 11=(large*I, small*D) 13=(large*D, large*I)', /
782 $ ' 8=(I,D) 10=(small*D, large*I) 12=(small*I, large*D) ',
783 $ ' 14=(small*D, small*I)', / ' 15=(D, reversed D)' )
784 9994 FORMAT( ' Matrices Rotated by Random ', A, ' Matrices U, V:',
785 $ / ' 16=Transposed Jordan Blocks 19=geometric ',
786 $ 'alpha, beta=0,1', / ' 17=arithm. alpha&beta ',
787 $ ' 20=arithmetic alpha, beta=0,1', / ' 18=clustered ',
788 $ 'alpha, beta=0,1 21=random alpha, beta=0,1',
789 $ / ' Large & Small Matrices:', / ' 22=(large, small) ',
790 $ '23=(small,large) 24=(small,small) 25=(large,large)',
791 $ / ' 26=random O(1) matrices.' )
792 *
793 9993 FORMAT( / ' Tests performed: (S is Schur, T is triangular, ',
794 $ 'Q and Z are ', A, ',', / 20X,
795 $ 'l and r are the appropriate left and right', / 19X,
796 $ 'eigenvectors, resp., a is alpha, b is beta, and', / 19X, A,
797 $ ' means ', A, '.)', / ' 1 = | A - Q S Z', A,
798 $ ' | / ( |A| n ulp ) 2 = | B - Q T Z', A,
799 $ ' | / ( |B| n ulp )', / ' 3 = | I - QQ', A,
800 $ ' | / ( n ulp ) 4 = | I - ZZ', A,
801 $ ' | / ( n ulp )', /
802 $ ' 5 = difference between (alpha,beta) and diagonals of',
803 $ ' (S,T)', / ' 6 = max | ( b A - a B )', A,
804 $ ' l | / const. 7 = max | ( b A - a B ) r | / const.',
805 $ / 1X )
806 9992 FORMAT( ' Matrix order=', I5, ', type=', I2, ', seed=',
807 $ 4( I4, ',' ), ' result ', I3, ' is', 0P, F8.2 )
808 9991 FORMAT( ' Matrix order=', I5, ', type=', I2, ', seed=',
809 $ 4( I4, ',' ), ' result ', I3, ' is', 1P, D10.3 )
810 *
811 * End of ZDRVGG
812 *
813 END