3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
11 * SUBROUTINE CDRGEV( NSIZES, NN, NTYPES, DOTYPE, ISEED, THRESH,
12 * NOUNIT, A, LDA, B, S, T, Q, LDQ, Z, QE, LDQE,
13 * ALPHA, BETA, ALPHA1, BETA1, WORK, LWORK, RWORK,
16 * .. Scalar Arguments ..
17 * INTEGER INFO, LDA, LDQ, LDQE, LWORK, NOUNIT, NSIZES,
21 * .. Array Arguments ..
23 * INTEGER ISEED( 4 ), NN( * )
24 * REAL RESULT( * ), RWORK( * )
25 * COMPLEX A( LDA, * ), ALPHA( * ), ALPHA1( * ),
26 * $ B( LDA, * ), BETA( * ), BETA1( * ),
27 * $ Q( LDQ, * ), QE( LDQE, * ), S( LDA, * ),
28 * $ T( LDA, * ), WORK( * ), Z( LDQ, * )
37 *> CDRGEV checks the nonsymmetric generalized eigenvalue problem driver
40 *> CGGEV computes for a pair of n-by-n nonsymmetric matrices (A,B) the
41 *> generalized eigenvalues and, optionally, the left and right
44 *> A generalized eigenvalue for a pair of matrices (A,B) is a scalar w
45 *> or a ratio alpha/beta = w, such that A - w*B is singular. It is
46 *> usually represented as the pair (alpha,beta), as there is reasonable
47 *> interpretation for beta=0, and even for both being zero.
49 *> A right generalized eigenvector corresponding to a generalized
50 *> eigenvalue w for a pair of matrices (A,B) is a vector r such that
51 *> (A - wB) * r = 0. A left generalized eigenvector is a vector l such
52 *> that l**H * (A - wB) = 0, where l**H is the conjugate-transpose of l.
54 *> When CDRGEV is called, a number of matrix "sizes" ("n's") and a
55 *> number of matrix "types" are specified. For each size ("n")
56 *> and each type of matrix, a pair of matrices (A, B) will be generated
57 *> and used for testing. For each matrix pair, the following tests
58 *> will be performed and compared with the threshold THRESH.
60 *> Results from CGGEV:
62 *> (1) max over all left eigenvalue/-vector pairs (alpha/beta,l) of
64 *> | VL**H * (beta A - alpha B) |/( ulp max(|beta A|, |alpha B|) )
66 *> where VL**H is the conjugate-transpose of VL.
68 *> (2) | |VL(i)| - 1 | / ulp and whether largest component real
70 *> VL(i) denotes the i-th column of VL.
72 *> (3) max over all left eigenvalue/-vector pairs (alpha/beta,r) of
74 *> | (beta A - alpha B) * VR | / ( ulp max(|beta A|, |alpha B|) )
76 *> (4) | |VR(i)| - 1 | / ulp and whether largest component real
78 *> VR(i) denotes the i-th column of VR.
80 *> (5) W(full) = W(partial)
81 *> W(full) denotes the eigenvalues computed when both l and r
82 *> are also computed, and W(partial) denotes the eigenvalues
83 *> computed when only W, only W and r, or only W and l are
86 *> (6) VL(full) = VL(partial)
87 *> VL(full) denotes the left eigenvectors computed when both l
88 *> and r are computed, and VL(partial) denotes the result
89 *> when only l is computed.
91 *> (7) VR(full) = VR(partial)
92 *> VR(full) denotes the right eigenvectors computed when both l
93 *> and r are also computed, and VR(partial) denotes the result
94 *> when only l is computed.
100 *> The sizes of the test matrices are specified by an array
101 *> NN(1:NSIZES); the value of each element NN(j) specifies one size.
102 *> The "types" are specified by a logical array DOTYPE( 1:NTYPES ); if
103 *> DOTYPE(j) is .TRUE., then matrix type "j" will be generated.
104 *> Currently, the list of possible types is:
106 *> (1) ( 0, 0 ) (a pair of zero matrices)
108 *> (2) ( I, 0 ) (an identity and a zero matrix)
110 *> (3) ( 0, I ) (an identity and a zero matrix)
112 *> (4) ( I, I ) (a pair of identity matrices)
115 *> (5) ( J , J ) (a pair of transposed Jordan blocks)
118 *> (6) ( X, Y ) where X = ( J 0 ) and Y = ( t )
120 *> and I is a k x k identity and J a (k+1)x(k+1)
121 *> Jordan block; k=(N-1)/2
123 *> (7) ( D, I ) where D is diag( 0, 1,..., N-1 ) (a diagonal
124 *> matrix with those diagonal entries.)
127 *> (9) ( big*D, small*I ) where "big" is near overflow and small=1/big
129 *> (10) ( small*D, big*I )
131 *> (11) ( big*I, small*D )
133 *> (12) ( small*I, big*D )
135 *> (13) ( big*D, big*I )
137 *> (14) ( small*D, small*I )
139 *> (15) ( D1, D2 ) where D1 is diag( 0, 0, 1, ..., N-3, 0 ) and
140 *> D2 is diag( 0, N-3, N-4,..., 1, 0, 0 )
142 *> (16) Q ( J , J ) Z where Q and Z are random orthogonal matrices.
144 *> (17) Q ( T1, T2 ) Z where T1 and T2 are upper triangular matrices
145 *> with random O(1) entries above the diagonal
146 *> and diagonal entries diag(T1) =
147 *> ( 0, 0, 1, ..., N-3, 0 ) and diag(T2) =
148 *> ( 0, N-3, N-4,..., 1, 0, 0 )
150 *> (18) Q ( T1, T2 ) Z diag(T1) = ( 0, 0, 1, 1, s, ..., s, 0 )
151 *> diag(T2) = ( 0, 1, 0, 1,..., 1, 0 )
152 *> s = machine precision.
154 *> (19) Q ( T1, T2 ) Z diag(T1)=( 0,0,1,1, 1-d, ..., 1-(N-5)*d=s, 0 )
155 *> diag(T2) = ( 0, 1, 0, 1, ..., 1, 0 )
158 *> (20) Q ( T1, T2 ) Z diag(T1)=( 0, 0, 1, 1, a, ..., a =s, 0 )
159 *> diag(T2) = ( 0, 1, 0, 1, ..., 1, 0, 0 )
161 *> (21) Q ( T1, T2 ) Z diag(T1)=( 0, 0, 1, r1, r2, ..., r(N-4), 0 )
162 *> diag(T2) = ( 0, 1, 0, 1, ..., 1, 0, 0 )
163 *> where r1,..., r(N-4) are random.
165 *> (22) Q ( big*T1, small*T2 ) Z diag(T1) = ( 0, 0, 1, ..., N-3, 0 )
166 *> diag(T2) = ( 0, 1, ..., 1, 0, 0 )
168 *> (23) Q ( small*T1, big*T2 ) Z diag(T1) = ( 0, 0, 1, ..., N-3, 0 )
169 *> diag(T2) = ( 0, 1, ..., 1, 0, 0 )
171 *> (24) Q ( small*T1, small*T2 ) Z diag(T1) = ( 0, 0, 1, ..., N-3, 0 )
172 *> diag(T2) = ( 0, 1, ..., 1, 0, 0 )
174 *> (25) Q ( big*T1, big*T2 ) Z diag(T1) = ( 0, 0, 1, ..., N-3, 0 )
175 *> diag(T2) = ( 0, 1, ..., 1, 0, 0 )
177 *> (26) Q ( T1, T2 ) Z where T1 and T2 are random upper-triangular
188 *> The number of sizes of matrices to use. If it is zero,
189 *> CDRGES does nothing. NSIZES >= 0.
194 *> NN is INTEGER array, dimension (NSIZES)
195 *> An array containing the sizes to be used for the matrices.
196 *> Zero values will be skipped. NN >= 0.
202 *> The number of elements in DOTYPE. If it is zero, CDRGEV
203 *> does nothing. It must be at least zero. If it is MAXTYP+1
204 *> and NSIZES is 1, then an additional type, MAXTYP+1 is
205 *> defined, which is to use whatever matrix is in A. This
206 *> is only useful if DOTYPE(1:MAXTYP) is .FALSE. and
207 *> DOTYPE(MAXTYP+1) is .TRUE. .
212 *> DOTYPE is LOGICAL array, dimension (NTYPES)
213 *> If DOTYPE(j) is .TRUE., then for each size in NN a
214 *> matrix of that size and of type j will be generated.
215 *> If NTYPES is smaller than the maximum number of types
216 *> defined (PARAMETER MAXTYP), then types NTYPES+1 through
217 *> MAXTYP will not be generated. If NTYPES is larger
218 *> than MAXTYP, DOTYPE(MAXTYP+1) through DOTYPE(NTYPES)
222 *> \param[in,out] ISEED
224 *> ISEED is INTEGER array, dimension (4)
225 *> On entry ISEED specifies the seed of the random number
226 *> generator. The array elements should be between 0 and 4095;
227 *> if not they will be reduced mod 4096. Also, ISEED(4) must
228 *> be odd. The random number generator uses a linear
229 *> congruential sequence limited to small integers, and so
230 *> should produce machine independent random numbers. The
231 *> values of ISEED are changed on exit, and can be used in the
232 *> next call to CDRGES to continue the same random number
239 *> A test will count as "failed" if the "error", computed as
240 *> described above, exceeds THRESH. Note that the error is
241 *> scaled to be O(1), so THRESH should be a reasonably small
242 *> multiple of 1, e.g., 10 or 100. In particular, it should
243 *> not depend on the precision (single vs. double) or the size
244 *> of the matrix. It must be at least zero.
250 *> The FORTRAN unit number for printing out error messages
251 *> (e.g., if a routine returns IERR not equal to 0.)
256 *> A is COMPLEX array, dimension(LDA, max(NN))
257 *> Used to hold the original A matrix. Used as input only
258 *> if NTYPES=MAXTYP+1, DOTYPE(1:MAXTYP)=.FALSE., and
259 *> DOTYPE(MAXTYP+1)=.TRUE.
265 *> The leading dimension of A, B, S, and T.
266 *> It must be at least 1 and at least max( NN ).
271 *> B is COMPLEX array, dimension(LDA, max(NN))
272 *> Used to hold the original B matrix. Used as input only
273 *> if NTYPES=MAXTYP+1, DOTYPE(1:MAXTYP)=.FALSE., and
274 *> DOTYPE(MAXTYP+1)=.TRUE.
279 *> S is COMPLEX array, dimension (LDA, max(NN))
280 *> The Schur form matrix computed from A by CGGEV. On exit, S
281 *> contains the Schur form matrix corresponding to the matrix
287 *> T is COMPLEX array, dimension (LDA, max(NN))
288 *> The upper triangular matrix computed from B by CGGEV.
293 *> Q is COMPLEX array, dimension (LDQ, max(NN))
294 *> The (left) eigenvectors matrix computed by CGGEV.
300 *> The leading dimension of Q and Z. It must
301 *> be at least 1 and at least max( NN ).
306 *> Z is COMPLEX array, dimension( LDQ, max(NN) )
307 *> The (right) orthogonal matrix computed by CGGEV.
312 *> QE is COMPLEX array, dimension( LDQ, max(NN) )
313 *> QE holds the computed right or left eigenvectors.
319 *> The leading dimension of QE. LDQE >= max(1,max(NN)).
324 *> ALPHA is COMPLEX array, dimension (max(NN))
329 *> BETA is COMPLEX array, dimension (max(NN))
331 *> The generalized eigenvalues of (A,B) computed by CGGEV.
332 *> ( ALPHAR(k)+ALPHAI(k)*i ) / BETA(k) is the k-th
333 *> generalized eigenvalue of A and B.
336 *> \param[out] ALPHA1
338 *> ALPHA1 is COMPLEX array, dimension (max(NN))
343 *> BETA1 is COMPLEX array, dimension (max(NN))
345 *> Like ALPHAR, ALPHAI, BETA, these arrays contain the
346 *> eigenvalues of A and B, but those computed when CGGEV only
347 *> computes a partial eigendecomposition, i.e. not the
348 *> eigenvalues and left and right eigenvectors.
353 *> WORK is COMPLEX array, dimension (LWORK)
359 *> The number of entries in WORK. LWORK >= N*(N+1)
364 *> RWORK is REAL array, dimension (8*N)
368 *> \param[out] RESULT
370 *> RESULT is REAL array, dimension (2)
371 *> The values computed by the tests described above.
372 *> The values are currently limited to 1/ulp, to avoid overflow.
378 *> = 0: successful exit
379 *> < 0: if INFO = -i, the i-th argument had an illegal value.
380 *> > 0: A routine returned an error code. INFO is the
381 *> absolute value of the INFO value returned.
387 *> \author Univ. of Tennessee
388 *> \author Univ. of California Berkeley
389 *> \author Univ. of Colorado Denver
394 *> \ingroup complex_eig
396 * =====================================================================
397 SUBROUTINE CDRGEV( NSIZES, NN, NTYPES, DOTYPE, ISEED, THRESH,
398 $ NOUNIT, A, LDA, B, S, T, Q, LDQ, Z, QE, LDQE,
399 $ ALPHA, BETA, ALPHA1, BETA1, WORK, LWORK, RWORK,
402 * -- LAPACK test routine (version 3.6.1) --
403 * -- LAPACK is a software package provided by Univ. of Tennessee, --
404 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
407 * .. Scalar Arguments ..
408 INTEGER INFO, LDA, LDQ, LDQE, LWORK, NOUNIT, NSIZES,
412 * .. Array Arguments ..
414 INTEGER ISEED( 4 ), NN( * )
415 REAL RESULT( * ), RWORK( * )
416 COMPLEX A( LDA, * ), ALPHA( * ), ALPHA1( * ),
417 $ B( LDA, * ), BETA( * ), BETA1( * ),
418 $ Q( LDQ, * ), QE( LDQE, * ), S( LDA, * ),
419 $ T( LDA, * ), WORK( * ), Z( LDQ, * )
422 * =====================================================================
426 PARAMETER ( ZERO = 0.0E+0, ONE = 1.0E+0 )
428 PARAMETER ( CZERO = ( 0.0E+0, 0.0E+0 ),
429 $ CONE = ( 1.0E+0, 0.0E+0 ) )
431 PARAMETER ( MAXTYP = 26 )
433 * .. Local Scalars ..
435 INTEGER I, IADD, IERR, IN, J, JC, JR, JSIZE, JTYPE,
436 $ MAXWRK, MINWRK, MTYPES, N, N1, NB, NERRS,
437 $ NMATS, NMAX, NTESTT
438 REAL SAFMAX, SAFMIN, ULP, ULPINV
442 LOGICAL LASIGN( MAXTYP ), LBSIGN( MAXTYP )
443 INTEGER IOLDSD( 4 ), KADD( 6 ), KAMAGN( MAXTYP ),
444 $ KATYPE( MAXTYP ), KAZERO( MAXTYP ),
445 $ KBMAGN( MAXTYP ), KBTYPE( MAXTYP ),
446 $ KBZERO( MAXTYP ), KCLASS( MAXTYP ),
447 $ KTRIAN( MAXTYP ), KZ1( 6 ), KZ2( 6 )
450 * .. External Functions ..
454 EXTERNAL ILAENV, SLAMCH, CLARND
456 * .. External Subroutines ..
457 EXTERNAL ALASVM, CGET52, CGGEV, CLACPY, CLARFG, CLASET,
458 $ CLATM4, CUNM2R, SLABAD, XERBLA
460 * .. Intrinsic Functions ..
461 INTRINSIC ABS, CONJG, MAX, MIN, REAL, SIGN
463 * .. Data statements ..
464 DATA KCLASS / 15*1, 10*2, 1*3 /
465 DATA KZ1 / 0, 1, 2, 1, 3, 3 /
466 DATA KZ2 / 0, 0, 1, 2, 1, 1 /
467 DATA KADD / 0, 0, 0, 0, 3, 2 /
468 DATA KATYPE / 0, 1, 0, 1, 2, 3, 4, 1, 4, 4, 1, 1, 4,
469 $ 4, 4, 2, 4, 5, 8, 7, 9, 4*4, 0 /
470 DATA KBTYPE / 0, 0, 1, 1, 2, -3, 1, 4, 1, 1, 4, 4,
471 $ 1, 1, -4, 2, -4, 8*8, 0 /
472 DATA KAZERO / 6*1, 2, 1, 2*2, 2*1, 2*2, 3, 1, 3,
474 DATA KBZERO / 6*1, 1, 2, 2*1, 2*2, 2*1, 4, 1, 4,
476 DATA KAMAGN / 8*1, 2, 3, 2, 3, 2, 3, 7*1, 2, 3, 3,
478 DATA KBMAGN / 8*1, 3, 2, 3, 2, 2, 3, 7*1, 3, 2, 3,
480 DATA KTRIAN / 16*0, 10*1 /
481 DATA LASIGN / 6*.FALSE., .TRUE., .FALSE., 2*.TRUE.,
482 $ 2*.FALSE., 3*.TRUE., .FALSE., .TRUE.,
483 $ 3*.FALSE., 5*.TRUE., .FALSE. /
484 DATA LBSIGN / 7*.FALSE., .TRUE., 2*.FALSE.,
485 $ 2*.TRUE., 2*.FALSE., .TRUE., .FALSE., .TRUE.,
488 * .. Executable Statements ..
497 NMAX = MAX( NMAX, NN( J ) )
502 IF( NSIZES.LT.0 ) THEN
504 ELSE IF( BADNN ) THEN
506 ELSE IF( NTYPES.LT.0 ) THEN
508 ELSE IF( THRESH.LT.ZERO ) THEN
510 ELSE IF( LDA.LE.1 .OR. LDA.LT.NMAX ) THEN
512 ELSE IF( LDQ.LE.1 .OR. LDQ.LT.NMAX ) THEN
514 ELSE IF( LDQE.LE.1 .OR. LDQE.LT.NMAX ) THEN
519 * (Note: Comments in the code beginning "Workspace:" describe the
520 * minimal amount of workspace needed at that point in the code,
521 * as well as the preferred amount for good performance.
522 * NB refers to the optimal block size for the immediately
523 * following subroutine, as returned by ILAENV.
526 IF( INFO.EQ.0 .AND. LWORK.GE.1 ) THEN
527 MINWRK = NMAX*( NMAX+1 )
528 NB = MAX( 1, ILAENV( 1, 'CGEQRF', ' ', NMAX, NMAX, -1, -1 ),
529 $ ILAENV( 1, 'CUNMQR', 'LC', NMAX, NMAX, NMAX, -1 ),
530 $ ILAENV( 1, 'CUNGQR', ' ', NMAX, NMAX, NMAX, -1 ) )
531 MAXWRK = MAX( 2*NMAX, NMAX*( NB+1 ), NMAX*( NMAX+1 ) )
535 IF( LWORK.LT.MINWRK )
539 CALL XERBLA( 'CDRGEV', -INFO )
543 * Quick return if possible
545 IF( NSIZES.EQ.0 .OR. NTYPES.EQ.0 )
548 ULP = SLAMCH( 'Precision' )
549 SAFMIN = SLAMCH( 'Safe minimum' )
550 SAFMIN = SAFMIN / ULP
551 SAFMAX = ONE / SAFMIN
552 CALL SLABAD( SAFMIN, SAFMAX )
555 * The values RMAGN(2:3) depend on N, see below.
560 * Loop over sizes, types
566 DO 220 JSIZE = 1, NSIZES
569 RMAGN( 2 ) = SAFMAX*ULP / REAL( N1 )
570 RMAGN( 3 ) = SAFMIN*ULPINV*N1
572 IF( NSIZES.NE.1 ) THEN
573 MTYPES = MIN( MAXTYP, NTYPES )
575 MTYPES = MIN( MAXTYP+1, NTYPES )
578 DO 210 JTYPE = 1, MTYPES
579 IF( .NOT.DOTYPE( JTYPE ) )
583 * Save ISEED in case of an error.
586 IOLDSD( J ) = ISEED( J )
589 * Generate test matrices A and B
591 * Description of control parameters:
593 * KCLASS: =1 means w/o rotation, =2 means w/ rotation,
595 * KATYPE: the "type" to be passed to CLATM4 for computing A.
596 * KAZERO: the pattern of zeros on the diagonal for A:
597 * =1: ( xxx ), =2: (0, xxx ) =3: ( 0, 0, xxx, 0 ),
598 * =4: ( 0, xxx, 0, 0 ), =5: ( 0, 0, 1, xxx, 0 ),
599 * =6: ( 0, 1, 0, xxx, 0 ). (xxx means a string of
601 * KAMAGN: the magnitude of the matrix: =0: zero, =1: O(1),
602 * =2: large, =3: small.
603 * LASIGN: .TRUE. if the diagonal elements of A are to be
604 * multiplied by a random magnitude 1 number.
605 * KBTYPE, KBZERO, KBMAGN, LBSIGN: the same, but for B.
606 * KTRIAN: =0: don't fill in the upper triangle, =1: do.
607 * KZ1, KZ2, KADD: used to implement KAZERO and KBZERO.
608 * RMAGN: used to implement KAMAGN and KBMAGN.
610 IF( MTYPES.GT.MAXTYP )
613 IF( KCLASS( JTYPE ).LT.3 ) THEN
615 * Generate A (w/o rotation)
617 IF( ABS( KATYPE( JTYPE ) ).EQ.3 ) THEN
618 IN = 2*( ( N-1 ) / 2 ) + 1
620 $ CALL CLASET( 'Full', N, N, CZERO, CZERO, A, LDA )
624 CALL CLATM4( KATYPE( JTYPE ), IN, KZ1( KAZERO( JTYPE ) ),
625 $ KZ2( KAZERO( JTYPE ) ), LASIGN( JTYPE ),
626 $ RMAGN( KAMAGN( JTYPE ) ), ULP,
627 $ RMAGN( KTRIAN( JTYPE )*KAMAGN( JTYPE ) ), 2,
629 IADD = KADD( KAZERO( JTYPE ) )
630 IF( IADD.GT.0 .AND. IADD.LE.N )
631 $ A( IADD, IADD ) = RMAGN( KAMAGN( JTYPE ) )
633 * Generate B (w/o rotation)
635 IF( ABS( KBTYPE( JTYPE ) ).EQ.3 ) THEN
636 IN = 2*( ( N-1 ) / 2 ) + 1
638 $ CALL CLASET( 'Full', N, N, CZERO, CZERO, B, LDA )
642 CALL CLATM4( KBTYPE( JTYPE ), IN, KZ1( KBZERO( JTYPE ) ),
643 $ KZ2( KBZERO( JTYPE ) ), LBSIGN( JTYPE ),
644 $ RMAGN( KBMAGN( JTYPE ) ), ONE,
645 $ RMAGN( KTRIAN( JTYPE )*KBMAGN( JTYPE ) ), 2,
647 IADD = KADD( KBZERO( JTYPE ) )
648 IF( IADD.NE.0 .AND. IADD.LE.N )
649 $ B( IADD, IADD ) = RMAGN( KBMAGN( JTYPE ) )
651 IF( KCLASS( JTYPE ).EQ.2 .AND. N.GT.0 ) THEN
655 * Generate Q, Z as Householder transformations times
660 Q( JR, JC ) = CLARND( 3, ISEED )
661 Z( JR, JC ) = CLARND( 3, ISEED )
663 CALL CLARFG( N+1-JC, Q( JC, JC ), Q( JC+1, JC ), 1,
665 WORK( 2*N+JC ) = SIGN( ONE, REAL( Q( JC, JC ) ) )
667 CALL CLARFG( N+1-JC, Z( JC, JC ), Z( JC+1, JC ), 1,
669 WORK( 3*N+JC ) = SIGN( ONE, REAL( Z( JC, JC ) ) )
672 CTEMP = CLARND( 3, ISEED )
675 WORK( 3*N ) = CTEMP / ABS( CTEMP )
676 CTEMP = CLARND( 3, ISEED )
679 WORK( 4*N ) = CTEMP / ABS( CTEMP )
681 * Apply the diagonal matrices
685 A( JR, JC ) = WORK( 2*N+JR )*
686 $ CONJG( WORK( 3*N+JC ) )*
688 B( JR, JC ) = WORK( 2*N+JR )*
689 $ CONJG( WORK( 3*N+JC ) )*
693 CALL CUNM2R( 'L', 'N', N, N, N-1, Q, LDQ, WORK, A,
694 $ LDA, WORK( 2*N+1 ), IERR )
697 CALL CUNM2R( 'R', 'C', N, N, N-1, Z, LDQ, WORK( N+1 ),
698 $ A, LDA, WORK( 2*N+1 ), IERR )
701 CALL CUNM2R( 'L', 'N', N, N, N-1, Q, LDQ, WORK, B,
702 $ LDA, WORK( 2*N+1 ), IERR )
705 CALL CUNM2R( 'R', 'C', N, N, N-1, Z, LDQ, WORK( N+1 ),
706 $ B, LDA, WORK( 2*N+1 ), IERR )
716 A( JR, JC ) = RMAGN( KAMAGN( JTYPE ) )*
718 B( JR, JC ) = RMAGN( KBMAGN( JTYPE ) )*
727 WRITE( NOUNIT, FMT = 9999 )'Generator', IERR, N, JTYPE,
739 * Call CGGEV to compute eigenvalues and eigenvectors.
741 CALL CLACPY( ' ', N, N, A, LDA, S, LDA )
742 CALL CLACPY( ' ', N, N, B, LDA, T, LDA )
743 CALL CGGEV( 'V', 'V', N, S, LDA, T, LDA, ALPHA, BETA, Q,
744 $ LDQ, Z, LDQ, WORK, LWORK, RWORK, IERR )
745 IF( IERR.NE.0 .AND. IERR.NE.N+1 ) THEN
747 WRITE( NOUNIT, FMT = 9999 )'CGGEV1', IERR, N, JTYPE,
753 * Do the tests (1) and (2)
755 CALL CGET52( .TRUE., N, A, LDA, B, LDA, Q, LDQ, ALPHA, BETA,
756 $ WORK, RWORK, RESULT( 1 ) )
757 IF( RESULT( 2 ).GT.THRESH ) THEN
758 WRITE( NOUNIT, FMT = 9998 )'Left', 'CGGEV1',
759 $ RESULT( 2 ), N, JTYPE, IOLDSD
762 * Do the tests (3) and (4)
764 CALL CGET52( .FALSE., N, A, LDA, B, LDA, Z, LDQ, ALPHA,
765 $ BETA, WORK, RWORK, RESULT( 3 ) )
766 IF( RESULT( 4 ).GT.THRESH ) THEN
767 WRITE( NOUNIT, FMT = 9998 )'Right', 'CGGEV1',
768 $ RESULT( 4 ), N, JTYPE, IOLDSD
773 CALL CLACPY( ' ', N, N, A, LDA, S, LDA )
774 CALL CLACPY( ' ', N, N, B, LDA, T, LDA )
775 CALL CGGEV( 'N', 'N', N, S, LDA, T, LDA, ALPHA1, BETA1, Q,
776 $ LDQ, Z, LDQ, WORK, LWORK, RWORK, IERR )
777 IF( IERR.NE.0 .AND. IERR.NE.N+1 ) THEN
779 WRITE( NOUNIT, FMT = 9999 )'CGGEV2', IERR, N, JTYPE,
786 IF( ALPHA( J ).NE.ALPHA1( J ) .OR. BETA( J ).NE.
787 $ BETA1( J ) )RESULT( 5 ) = ULPINV
790 * Do test (6): Compute eigenvalues and left eigenvectors,
793 CALL CLACPY( ' ', N, N, A, LDA, S, LDA )
794 CALL CLACPY( ' ', N, N, B, LDA, T, LDA )
795 CALL CGGEV( 'V', 'N', N, S, LDA, T, LDA, ALPHA1, BETA1, QE,
796 $ LDQE, Z, LDQ, WORK, LWORK, RWORK, IERR )
797 IF( IERR.NE.0 .AND. IERR.NE.N+1 ) THEN
799 WRITE( NOUNIT, FMT = 9999 )'CGGEV3', IERR, N, JTYPE,
806 IF( ALPHA( J ).NE.ALPHA1( J ) .OR. BETA( J ).NE.
807 $ BETA1( J ) )RESULT( 6 ) = ULPINV
812 IF( Q( J, JC ).NE.QE( J, JC ) )
813 $ RESULT( 6 ) = ULPINV
817 * Do test (7): Compute eigenvalues and right eigenvectors,
820 CALL CLACPY( ' ', N, N, A, LDA, S, LDA )
821 CALL CLACPY( ' ', N, N, B, LDA, T, LDA )
822 CALL CGGEV( 'N', 'V', N, S, LDA, T, LDA, ALPHA1, BETA1, Q,
823 $ LDQ, QE, LDQE, WORK, LWORK, RWORK, IERR )
824 IF( IERR.NE.0 .AND. IERR.NE.N+1 ) THEN
826 WRITE( NOUNIT, FMT = 9999 )'CGGEV4', IERR, N, JTYPE,
833 IF( ALPHA( J ).NE.ALPHA1( J ) .OR. BETA( J ).NE.
834 $ BETA1( J ) )RESULT( 7 ) = ULPINV
839 IF( Z( J, JC ).NE.QE( J, JC ) )
840 $ RESULT( 7 ) = ULPINV
844 * End of Loop -- Check for RESULT(j) > THRESH
850 * Print out tests which fail.
853 IF( RESULT( JR ).GE.THRESH ) THEN
855 * If this is the first test to fail,
856 * print a header to the data file.
858 IF( NERRS.EQ.0 ) THEN
859 WRITE( NOUNIT, FMT = 9997 )'CGV'
863 WRITE( NOUNIT, FMT = 9996 )
864 WRITE( NOUNIT, FMT = 9995 )
865 WRITE( NOUNIT, FMT = 9994 )'Orthogonal'
869 WRITE( NOUNIT, FMT = 9993 )
873 IF( RESULT( JR ).LT.10000.0 ) THEN
874 WRITE( NOUNIT, FMT = 9992 )N, JTYPE, IOLDSD, JR,
877 WRITE( NOUNIT, FMT = 9991 )N, JTYPE, IOLDSD, JR,
888 CALL ALASVM( 'CGV', NOUNIT, NERRS, NTESTT, 0 )
894 9999 FORMAT( ' CDRGEV: ', A, ' returned INFO=', I6, '.', / 3X, 'N=',
895 $ I6, ', JTYPE=', I6, ', ISEED=(', 3( I5, ',' ), I5, ')' )
897 9998 FORMAT( ' CDRGEV: ', A, ' Eigenvectors from ', A, ' incorrectly ',
898 $ 'normalized.', / ' Bits of error=', 0P, G10.3, ',', 3X,
899 $ 'N=', I4, ', JTYPE=', I3, ', ISEED=(', 3( I4, ',' ), I5,
902 9997 FORMAT( / 1X, A3, ' -- Complex Generalized eigenvalue problem ',
905 9996 FORMAT( ' Matrix types (see CDRGEV for details): ' )
907 9995 FORMAT( ' Special Matrices:', 23X,
908 $ '(J''=transposed Jordan block)',
909 $ / ' 1=(0,0) 2=(I,0) 3=(0,I) 4=(I,I) 5=(J'',J'') ',
910 $ '6=(diag(J'',I), diag(I,J''))', / ' Diagonal Matrices: ( ',
911 $ 'D=diag(0,1,2,...) )', / ' 7=(D,I) 9=(large*D, small*I',
912 $ ') 11=(large*I, small*D) 13=(large*D, large*I)', /
913 $ ' 8=(I,D) 10=(small*D, large*I) 12=(small*I, large*D) ',
914 $ ' 14=(small*D, small*I)', / ' 15=(D, reversed D)' )
915 9994 FORMAT( ' Matrices Rotated by Random ', A, ' Matrices U, V:',
916 $ / ' 16=Transposed Jordan Blocks 19=geometric ',
917 $ 'alpha, beta=0,1', / ' 17=arithm. alpha&beta ',
918 $ ' 20=arithmetic alpha, beta=0,1', / ' 18=clustered ',
919 $ 'alpha, beta=0,1 21=random alpha, beta=0,1',
920 $ / ' Large & Small Matrices:', / ' 22=(large, small) ',
921 $ '23=(small,large) 24=(small,small) 25=(large,large)',
922 $ / ' 26=random O(1) matrices.' )
924 9993 FORMAT( / ' Tests performed: ',
925 $ / ' 1 = max | ( b A - a B )''*l | / const.,',
926 $ / ' 2 = | |VR(i)| - 1 | / ulp,',
927 $ / ' 3 = max | ( b A - a B )*r | / const.',
928 $ / ' 4 = | |VL(i)| - 1 | / ulp,',
929 $ / ' 5 = 0 if W same no matter if r or l computed,',
930 $ / ' 6 = 0 if l same no matter if l computed,',
931 $ / ' 7 = 0 if r same no matter if r computed,', / 1X )
932 9992 FORMAT( ' Matrix order=', I5, ', type=', I2, ', seed=',
933 $ 4( I4, ',' ), ' result ', I2, ' is', 0P, F8.2 )
934 9991 FORMAT( ' Matrix order=', I5, ', type=', I2, ', seed=',
935 $ 4( I4, ',' ), ' result ', I2, ' is', 1P, E10.3 )