![]() |
LAPACK
3.4.1
LAPACK: Linear Algebra PACKage
|
00001 *> \brief \b CDRVGG 00002 * 00003 * =========== DOCUMENTATION =========== 00004 * 00005 * Online html documentation available at 00006 * http://www.netlib.org/lapack/explore-html/ 00007 * 00008 * Definition: 00009 * =========== 00010 * 00011 * SUBROUTINE CDRVGG( NSIZES, NN, NTYPES, DOTYPE, ISEED, THRESH, 00012 * THRSHN, NOUNIT, A, LDA, B, S, T, S2, T2, Q, 00013 * LDQ, Z, ALPHA1, BETA1, ALPHA2, BETA2, VL, VR, 00014 * WORK, LWORK, RWORK, RESULT, INFO ) 00015 * 00016 * .. Scalar Arguments .. 00017 * INTEGER INFO, LDA, LDQ, LWORK, NOUNIT, NSIZES, NTYPES 00018 * REAL THRESH, THRSHN 00019 * .. 00020 * .. Array Arguments .. 00021 * 00022 * 00023 *> \par Purpose: 00024 * ============= 00025 *> 00026 *> \verbatim 00027 *> 00028 *> CDRVGG checks the nonsymmetric generalized eigenvalue driver 00029 *> routines. 00030 *> T T T 00031 *> CGEGS factors A and B as Q S Z and Q T Z , where means 00032 *> transpose, T is upper triangular, S is in generalized Schur form 00033 *> (upper triangular), and Q and Z are unitary. It also 00034 *> computes the generalized eigenvalues (alpha(1),beta(1)), ..., 00035 *> (alpha(n),beta(n)), where alpha(j)=S(j,j) and beta(j)=T(j,j) -- 00036 *> thus, w(j) = alpha(j)/beta(j) is a root of the generalized 00037 *> eigenvalue problem 00038 *> 00039 *> det( A - w(j) B ) = 0 00040 *> 00041 *> and m(j) = beta(j)/alpha(j) is a root of the essentially equivalent 00042 *> problem 00043 *> 00044 *> det( m(j) A - B ) = 0 00045 *> 00046 *> CGEGV computes the generalized eigenvalues (alpha(1),beta(1)), ..., 00047 *> (alpha(n),beta(n)), the matrix L whose columns contain the 00048 *> generalized left eigenvectors l, and the matrix R whose columns 00049 *> contain the generalized right eigenvectors r for the pair (A,B). 00050 *> 00051 *> When CDRVGG is called, a number of matrix "sizes" ("n's") and a 00052 *> number of matrix "types" are specified. For each size ("n") 00053 *> and each type of matrix, one matrix will be generated and used 00054 *> to test the nonsymmetric eigenroutines. For each matrix, 7 00055 *> tests will be performed and compared with the threshhold THRESH: 00056 *> 00057 *> Results from CGEGS: 00058 *> 00059 *> H 00060 *> (1) | A - Q S Z | / ( |A| n ulp ) 00061 *> 00062 *> H 00063 *> (2) | B - Q T Z | / ( |B| n ulp ) 00064 *> 00065 *> H 00066 *> (3) | I - QQ | / ( n ulp ) 00067 *> 00068 *> H 00069 *> (4) | I - ZZ | / ( n ulp ) 00070 *> 00071 *> (5) maximum over j of D(j) where: 00072 *> 00073 *> |alpha(j) - S(j,j)| |beta(j) - T(j,j)| 00074 *> D(j) = ------------------------ + ----------------------- 00075 *> max(|alpha(j)|,|S(j,j)|) max(|beta(j)|,|T(j,j)|) 00076 *> 00077 *> Results from CGEGV: 00078 *> 00079 *> (6) max over all left eigenvalue/-vector pairs (beta/alpha,l) of 00080 *> 00081 *> | l**H * (beta A - alpha B) | / ( ulp max( |beta A|, |alpha B| ) ) 00082 *> 00083 *> where l**H is the conjugate tranpose of l. 00084 *> 00085 *> (7) max over all right eigenvalue/-vector pairs (beta/alpha,r) of 00086 *> 00087 *> | (beta A - alpha B) r | / ( ulp max( |beta A|, |alpha B| ) ) 00088 *> 00089 *> Test Matrices 00090 *> ---- -------- 00091 *> 00092 *> The sizes of the test matrices are specified by an array 00093 *> NN(1:NSIZES); the value of each element NN(j) specifies one size. 00094 *> The "types" are specified by a logical array DOTYPE( 1:NTYPES ); if 00095 *> DOTYPE(j) is .TRUE., then matrix type "j" will be generated. 00096 *> Currently, the list of possible types is: 00097 *> 00098 *> (1) ( 0, 0 ) (a pair of zero matrices) 00099 *> 00100 *> (2) ( I, 0 ) (an identity and a zero matrix) 00101 *> 00102 *> (3) ( 0, I ) (an identity and a zero matrix) 00103 *> 00104 *> (4) ( I, I ) (a pair of identity matrices) 00105 *> 00106 *> t t 00107 *> (5) ( J , J ) (a pair of transposed Jordan blocks) 00108 *> 00109 *> t ( I 0 ) 00110 *> (6) ( X, Y ) where X = ( J 0 ) and Y = ( t ) 00111 *> ( 0 I ) ( 0 J ) 00112 *> and I is a k x k identity and J a (k+1)x(k+1) 00113 *> Jordan block; k=(N-1)/2 00114 *> 00115 *> (7) ( D, I ) where D is diag( 0, 1,..., N-1 ) (a diagonal 00116 *> matrix with those diagonal entries.) 00117 *> (8) ( I, D ) 00118 *> 00119 *> (9) ( big*D, small*I ) where "big" is near overflow and small=1/big 00120 *> 00121 *> (10) ( small*D, big*I ) 00122 *> 00123 *> (11) ( big*I, small*D ) 00124 *> 00125 *> (12) ( small*I, big*D ) 00126 *> 00127 *> (13) ( big*D, big*I ) 00128 *> 00129 *> (14) ( small*D, small*I ) 00130 *> 00131 *> (15) ( D1, D2 ) where D1 is diag( 0, 0, 1, ..., N-3, 0 ) and 00132 *> D2 is diag( 0, N-3, N-4,..., 1, 0, 0 ) 00133 *> t t 00134 *> (16) Q ( J , J ) Z where Q and Z are random unitary matrices. 00135 *> 00136 *> (17) Q ( T1, T2 ) Z where T1 and T2 are upper triangular matrices 00137 *> with random O(1) entries above the diagonal 00138 *> and diagonal entries diag(T1) = 00139 *> ( 0, 0, 1, ..., N-3, 0 ) and diag(T2) = 00140 *> ( 0, N-3, N-4,..., 1, 0, 0 ) 00141 *> 00142 *> (18) Q ( T1, T2 ) Z diag(T1) = ( 0, 0, 1, 1, s, ..., s, 0 ) 00143 *> diag(T2) = ( 0, 1, 0, 1,..., 1, 0 ) 00144 *> s = machine precision. 00145 *> 00146 *> (19) Q ( T1, T2 ) Z diag(T1)=( 0,0,1,1, 1-d, ..., 1-(N-5)*d=s, 0 ) 00147 *> diag(T2) = ( 0, 1, 0, 1, ..., 1, 0 ) 00148 *> 00149 *> N-5 00150 *> (20) Q ( T1, T2 ) Z diag(T1)=( 0, 0, 1, 1, a, ..., a =s, 0 ) 00151 *> diag(T2) = ( 0, 1, 0, 1, ..., 1, 0, 0 ) 00152 *> 00153 *> (21) Q ( T1, T2 ) Z diag(T1)=( 0, 0, 1, r1, r2, ..., r(N-4), 0 ) 00154 *> diag(T2) = ( 0, 1, 0, 1, ..., 1, 0, 0 ) 00155 *> where r1,..., r(N-4) are random. 00156 *> 00157 *> (22) Q ( big*T1, small*T2 ) Z diag(T1) = ( 0, 0, 1, ..., N-3, 0 ) 00158 *> diag(T2) = ( 0, 1, ..., 1, 0, 0 ) 00159 *> 00160 *> (23) Q ( small*T1, big*T2 ) Z diag(T1) = ( 0, 0, 1, ..., N-3, 0 ) 00161 *> diag(T2) = ( 0, 1, ..., 1, 0, 0 ) 00162 *> 00163 *> (24) Q ( small*T1, small*T2 ) Z diag(T1) = ( 0, 0, 1, ..., N-3, 0 ) 00164 *> diag(T2) = ( 0, 1, ..., 1, 0, 0 ) 00165 *> 00166 *> (25) Q ( big*T1, big*T2 ) Z diag(T1) = ( 0, 0, 1, ..., N-3, 0 ) 00167 *> diag(T2) = ( 0, 1, ..., 1, 0, 0 ) 00168 *> 00169 *> (26) Q ( T1, T2 ) Z where T1 and T2 are random upper-triangular 00170 *> matrices. 00171 *> \endverbatim 00172 * 00173 * Arguments: 00174 * ========== 00175 * 00176 *> \param[in] NSIZES 00177 *> \verbatim 00178 *> NSIZES is INTEGER 00179 *> The number of sizes of matrices to use. If it is zero, 00180 *> CDRVGG does nothing. It must be at least zero. 00181 *> \endverbatim 00182 *> 00183 *> \param[in] NN 00184 *> \verbatim 00185 *> NN is INTEGER array, dimension (NSIZES) 00186 *> An array containing the sizes to be used for the matrices. 00187 *> Zero values will be skipped. The values must be at least 00188 *> zero. 00189 *> \endverbatim 00190 *> 00191 *> \param[in] NTYPES 00192 *> \verbatim 00193 *> NTYPES is INTEGER 00194 *> The number of elements in DOTYPE. If it is zero, CDRVGG 00195 *> does nothing. It must be at least zero. If it is MAXTYP+1 00196 *> and NSIZES is 1, then an additional type, MAXTYP+1 is 00197 *> defined, which is to use whatever matrix is in A. This 00198 *> is only useful if DOTYPE(1:MAXTYP) is .FALSE. and 00199 *> DOTYPE(MAXTYP+1) is .TRUE. . 00200 *> \endverbatim 00201 *> 00202 *> \param[in] DOTYPE 00203 *> \verbatim 00204 *> DOTYPE is LOGICAL array, dimension (NTYPES) 00205 *> If DOTYPE(j) is .TRUE., then for each size in NN a 00206 *> matrix of that size and of type j will be generated. 00207 *> If NTYPES is smaller than the maximum number of types 00208 *> defined (PARAMETER MAXTYP), then types NTYPES+1 through 00209 *> MAXTYP will not be generated. If NTYPES is larger 00210 *> than MAXTYP, DOTYPE(MAXTYP+1) through DOTYPE(NTYPES) 00211 *> will be ignored. 00212 *> \endverbatim 00213 *> 00214 *> \param[in,out] ISEED 00215 *> \verbatim 00216 *> ISEED is INTEGER array, dimension (4) 00217 *> On entry ISEED specifies the seed of the random number 00218 *> generator. The array elements should be between 0 and 4095; 00219 *> if not they will be reduced mod 4096. Also, ISEED(4) must 00220 *> be odd. The random number generator uses a linear 00221 *> congruential sequence limited to small integers, and so 00222 *> should produce machine independent random numbers. The 00223 *> values of ISEED are changed on exit, and can be used in the 00224 *> next call to CDRVGG to continue the same random number 00225 *> sequence. 00226 *> \endverbatim 00227 *> 00228 *> \param[in] THRESH 00229 *> \verbatim 00230 *> THRESH is REAL 00231 *> A test will count as "failed" if the "error", computed as 00232 *> described above, exceeds THRESH. Note that the error is 00233 *> scaled to be O(1), so THRESH should be a reasonably small 00234 *> multiple of 1, e.g., 10 or 100. In particular, it should 00235 *> not depend on the precision (single vs. double) or the size 00236 *> of the matrix. It must be at least zero. 00237 *> \endverbatim 00238 *> 00239 *> \param[in] THRSHN 00240 *> \verbatim 00241 *> THRSHN is REAL 00242 *> Threshhold for reporting eigenvector normalization error. 00243 *> If the normalization of any eigenvector differs from 1 by 00244 *> more than THRSHN*ulp, then a special error message will be 00245 *> printed. (This is handled separately from the other tests, 00246 *> since only a compiler or programming error should cause an 00247 *> error message, at least if THRSHN is at least 5--10.) 00248 *> \endverbatim 00249 *> 00250 *> \param[in] NOUNIT 00251 *> \verbatim 00252 *> NOUNIT is INTEGER 00253 *> The FORTRAN unit number for printing out error messages 00254 *> (e.g., if a routine returns IINFO not equal to 0.) 00255 *> \endverbatim 00256 *> 00257 *> \param[in,out] A 00258 *> \verbatim 00259 *> A is COMPLEX array, dimension (LDA, max(NN)) 00260 *> Used to hold the original A matrix. Used as input only 00261 *> if NTYPES=MAXTYP+1, DOTYPE(1:MAXTYP)=.FALSE., and 00262 *> DOTYPE(MAXTYP+1)=.TRUE. 00263 *> \endverbatim 00264 *> 00265 *> \param[in] LDA 00266 *> \verbatim 00267 *> LDA is INTEGER 00268 *> The leading dimension of A, B, S, T, S2, and T2. 00269 *> It must be at least 1 and at least max( NN ). 00270 *> \endverbatim 00271 *> 00272 *> \param[in,out] B 00273 *> \verbatim 00274 *> B is COMPLEX array, dimension (LDA, max(NN)) 00275 *> Used to hold the original B matrix. Used as input only 00276 *> if NTYPES=MAXTYP+1, DOTYPE(1:MAXTYP)=.FALSE., and 00277 *> DOTYPE(MAXTYP+1)=.TRUE. 00278 *> \endverbatim 00279 *> 00280 *> \param[out] S 00281 *> \verbatim 00282 *> S is COMPLEX array, dimension (LDA, max(NN)) 00283 *> The upper triangular matrix computed from A by CGEGS. 00284 *> \endverbatim 00285 *> 00286 *> \param[out] T 00287 *> \verbatim 00288 *> T is COMPLEX array, dimension (LDA, max(NN)) 00289 *> The upper triangular matrix computed from B by CGEGS. 00290 *> \endverbatim 00291 *> 00292 *> \param[out] S2 00293 *> \verbatim 00294 *> S2 is COMPLEX array, dimension (LDA, max(NN)) 00295 *> The matrix computed from A by CGEGV. This will be the 00296 *> Schur (upper triangular) form of some matrix related to A, 00297 *> but will not, in general, be the same as S. 00298 *> \endverbatim 00299 *> 00300 *> \param[out] T2 00301 *> \verbatim 00302 *> T2 is COMPLEX array, dimension (LDA, max(NN)) 00303 *> The matrix computed from B by CGEGV. This will be the 00304 *> Schur form of some matrix related to B, but will not, in 00305 *> general, be the same as T. 00306 *> \endverbatim 00307 *> 00308 *> \param[out] Q 00309 *> \verbatim 00310 *> Q is COMPLEX array, dimension (LDQ, max(NN)) 00311 *> The (left) unitary matrix computed by CGEGS. 00312 *> \endverbatim 00313 *> 00314 *> \param[in] LDQ 00315 *> \verbatim 00316 *> LDQ is INTEGER 00317 *> The leading dimension of Q, Z, VL, and VR. It must 00318 *> be at least 1 and at least max( NN ). 00319 *> \endverbatim 00320 *> 00321 *> \param[out] Z 00322 *> \verbatim 00323 *> Z is COMPLEX array, dimension (LDQ, max(NN)) 00324 *> The (right) unitary matrix computed by CGEGS. 00325 *> \endverbatim 00326 *> 00327 *> \param[out] ALPHA1 00328 *> \verbatim 00329 *> ALPHA1 is COMPLEX array, dimension (max(NN)) 00330 *> \endverbatim 00331 *> 00332 *> \param[out] BETA1 00333 *> \verbatim 00334 *> BETA1 is COMPLEX array, dimension (max(NN)) 00335 *> 00336 *> The generalized eigenvalues of (A,B) computed by CGEGS. 00337 *> ALPHA1(k) / BETA1(k) is the k-th generalized eigenvalue of 00338 *> the matrices in A and B. 00339 *> \endverbatim 00340 *> 00341 *> \param[out] ALPHA2 00342 *> \verbatim 00343 *> ALPHA2 is COMPLEX array, dimension (max(NN)) 00344 *> \endverbatim 00345 *> 00346 *> \param[out] BETA2 00347 *> \verbatim 00348 *> BETA2 is COMPLEX array, dimension (max(NN)) 00349 *> 00350 *> The generalized eigenvalues of (A,B) computed by CGEGV. 00351 *> ALPHA2(k) / BETA2(k) is the k-th generalized eigenvalue of 00352 *> the matrices in A and B. 00353 *> \endverbatim 00354 *> 00355 *> \param[out] VL 00356 *> \verbatim 00357 *> VL is COMPLEX array, dimension (LDQ, max(NN)) 00358 *> The (lower triangular) left eigenvector matrix for the 00359 *> matrices in A and B. 00360 *> \endverbatim 00361 *> 00362 *> \param[out] VR 00363 *> \verbatim 00364 *> VR is COMPLEX array, dimension (LDQ, max(NN)) 00365 *> The (upper triangular) right eigenvector matrix for the 00366 *> matrices in A and B. 00367 *> \endverbatim 00368 *> 00369 *> \param[out] WORK 00370 *> \verbatim 00371 *> WORK is COMPLEX array, dimension (LWORK) 00372 *> \endverbatim 00373 *> 00374 *> \param[in] LWORK 00375 *> \verbatim 00376 *> LWORK is INTEGER 00377 *> The number of entries in WORK. This must be at least 00378 *> MAX( 2*N, N*(NB+1), (k+1)*(2*k+N+1) ), where "k" is the 00379 *> sum of the blocksize and number-of-shifts for CHGEQZ, and 00380 *> NB is the greatest of the blocksizes for CGEQRF, CUNMQR, 00381 *> and CUNGQR. (The blocksizes and the number-of-shifts are 00382 *> retrieved through calls to ILAENV.) 00383 *> \endverbatim 00384 *> 00385 *> \param[out] RWORK 00386 *> \verbatim 00387 *> RWORK is REAL array, dimension (8*N) 00388 *> \endverbatim 00389 *> 00390 *> \param[out] RESULT 00391 *> \verbatim 00392 *> RESULT is REAL array, dimension (7) 00393 *> The values computed by the tests described above. 00394 *> The values are currently limited to 1/ulp, to avoid 00395 *> overflow. 00396 *> \endverbatim 00397 *> 00398 *> \param[out] INFO 00399 *> \verbatim 00400 *> INFO is INTEGER 00401 *> = 0: successful exit 00402 *> < 0: if INFO = -i, the i-th argument had an illegal value. 00403 *> > 0: A routine returned an error code. INFO is the 00404 *> absolute value of the INFO value returned. 00405 *> \endverbatim 00406 * 00407 * Authors: 00408 * ======== 00409 * 00410 *> \author Univ. of Tennessee 00411 *> \author Univ. of California Berkeley 00412 *> \author Univ. of Colorado Denver 00413 *> \author NAG Ltd. 00414 * 00415 *> \date November 2011 00416 * 00417 *> \ingroup complex_eig 00418 * 00419 * ===================================================================== 00420 SUBROUTINE CDRVGG( NSIZES, NN, NTYPES, DOTYPE, ISEED, THRESH, 00421 $ THRSHN, NOUNIT, A, LDA, B, S, T, S2, T2, Q, 00422 $ LDQ, Z, ALPHA1, BETA1, ALPHA2, BETA2, VL, VR, 00423 $ WORK, LWORK, RWORK, RESULT, INFO ) 00424 * 00425 * -- LAPACK test routine (version 3.4.0) -- 00426 * -- LAPACK is a software package provided by Univ. of Tennessee, -- 00427 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- 00428 * November 2011 00429 * 00430 * .. Scalar Arguments .. 00431 INTEGER INFO, LDA, LDQ, LWORK, NOUNIT, NSIZES, NTYPES 00432 REAL THRESH, THRSHN 00433 * .. 00434 * .. Array Arguments .. 00435 * 00436 * ===================================================================== 00437 * 00438 LOGICAL DOTYPE( * ) 00439 INTEGER ISEED( 4 ), NN( * ) 00440 REAL RESULT( * ), RWORK( * ) 00441 COMPLEX A( LDA, * ), ALPHA1( * ), ALPHA2( * ), 00442 $ B( LDA, * ), BETA1( * ), BETA2( * ), 00443 $ Q( LDQ, * ), S( LDA, * ), S2( LDA, * ), 00444 $ T( LDA, * ), T2( LDA, * ), VL( LDQ, * ), 00445 $ VR( LDQ, * ), WORK( * ), Z( LDQ, * ) 00446 * .. 00447 * .. Parameters .. 00448 REAL ZERO, ONE 00449 PARAMETER ( ZERO = 0.0E+0, ONE = 1.0E+0 ) 00450 COMPLEX CZERO, CONE 00451 PARAMETER ( CZERO = ( 0.0E+0, 0.0E+0 ), 00452 $ CONE = ( 1.0E+0, 0.0E+0 ) ) 00453 INTEGER MAXTYP 00454 PARAMETER ( MAXTYP = 26 ) 00455 * .. 00456 * .. Local Scalars .. 00457 LOGICAL BADNN 00458 INTEGER I1, IADD, IINFO, IN, J, JC, JR, JSIZE, JTYPE, 00459 $ LWKOPT, MTYPES, N, N1, NB, NBZ, NERRS, NMATS, 00460 $ NMAX, NS, NTEST, NTESTT 00461 REAL SAFMAX, SAFMIN, TEMP1, TEMP2, ULP, ULPINV 00462 COMPLEX CTEMP, X 00463 * .. 00464 * .. Local Arrays .. 00465 LOGICAL LASIGN( MAXTYP ), LBSIGN( MAXTYP ) 00466 INTEGER IOLDSD( 4 ), KADD( 6 ), KAMAGN( MAXTYP ), 00467 $ KATYPE( MAXTYP ), KAZERO( MAXTYP ), 00468 $ KBMAGN( MAXTYP ), KBTYPE( MAXTYP ), 00469 $ KBZERO( MAXTYP ), KCLASS( MAXTYP ), 00470 $ KTRIAN( MAXTYP ), KZ1( 6 ), KZ2( 6 ) 00471 REAL DUMMA( 4 ), RMAGN( 0: 3 ) 00472 * .. 00473 * .. External Functions .. 00474 INTEGER ILAENV 00475 REAL SLAMCH 00476 COMPLEX CLARND 00477 EXTERNAL ILAENV, SLAMCH, CLARND 00478 * .. 00479 * .. External Subroutines .. 00480 EXTERNAL ALASVM, CGEGS, CGEGV, CGET51, CGET52, CLACPY, 00481 $ CLARFG, CLASET, CLATM4, CUNM2R, SLABAD, XERBLA 00482 * .. 00483 * .. Intrinsic Functions .. 00484 INTRINSIC ABS, AIMAG, CONJG, MAX, MIN, REAL, SIGN 00485 * .. 00486 * .. Statement Functions .. 00487 REAL ABS1 00488 * .. 00489 * .. Statement Function definitions .. 00490 ABS1( X ) = ABS( REAL( X ) ) + ABS( AIMAG( X ) ) 00491 * .. 00492 * .. Data statements .. 00493 DATA KCLASS / 15*1, 10*2, 1*3 / 00494 DATA KZ1 / 0, 1, 2, 1, 3, 3 / 00495 DATA KZ2 / 0, 0, 1, 2, 1, 1 / 00496 DATA KADD / 0, 0, 0, 0, 3, 2 / 00497 DATA KATYPE / 0, 1, 0, 1, 2, 3, 4, 1, 4, 4, 1, 1, 4, 00498 $ 4, 4, 2, 4, 5, 8, 7, 9, 4*4, 0 / 00499 DATA KBTYPE / 0, 0, 1, 1, 2, -3, 1, 4, 1, 1, 4, 4, 00500 $ 1, 1, -4, 2, -4, 8*8, 0 / 00501 DATA KAZERO / 6*1, 2, 1, 2*2, 2*1, 2*2, 3, 1, 3, 00502 $ 4*5, 4*3, 1 / 00503 DATA KBZERO / 6*1, 1, 2, 2*1, 2*2, 2*1, 4, 1, 4, 00504 $ 4*6, 4*4, 1 / 00505 DATA KAMAGN / 8*1, 2, 3, 2, 3, 2, 3, 7*1, 2, 3, 3, 00506 $ 2, 1 / 00507 DATA KBMAGN / 8*1, 3, 2, 3, 2, 2, 3, 7*1, 3, 2, 3, 00508 $ 2, 1 / 00509 DATA KTRIAN / 16*0, 10*1 / 00510 DATA LASIGN / 6*.FALSE., .TRUE., .FALSE., 2*.TRUE., 00511 $ 2*.FALSE., 3*.TRUE., .FALSE., .TRUE., 00512 $ 3*.FALSE., 5*.TRUE., .FALSE. / 00513 DATA LBSIGN / 7*.FALSE., .TRUE., 2*.FALSE., 00514 $ 2*.TRUE., 2*.FALSE., .TRUE., .FALSE., .TRUE., 00515 $ 9*.FALSE. / 00516 * .. 00517 * .. Executable Statements .. 00518 * 00519 * Check for errors 00520 * 00521 INFO = 0 00522 * 00523 BADNN = .FALSE. 00524 NMAX = 1 00525 DO 10 J = 1, NSIZES 00526 NMAX = MAX( NMAX, NN( J ) ) 00527 IF( NN( J ).LT.0 ) 00528 $ BADNN = .TRUE. 00529 10 CONTINUE 00530 * 00531 * Maximum blocksize and shift -- we assume that blocksize and number 00532 * of shifts are monotone increasing functions of N. 00533 * 00534 NB = MAX( 1, ILAENV( 1, 'CGEQRF', ' ', NMAX, NMAX, -1, -1 ), 00535 $ ILAENV( 1, 'CUNMQR', 'LC', NMAX, NMAX, NMAX, -1 ), 00536 $ ILAENV( 1, 'CUNGQR', ' ', NMAX, NMAX, NMAX, -1 ) ) 00537 NBZ = ILAENV( 1, 'CHGEQZ', 'SII', NMAX, 1, NMAX, 0 ) 00538 NS = ILAENV( 4, 'CHGEQZ', 'SII', NMAX, 1, NMAX, 0 ) 00539 I1 = NBZ + NS 00540 LWKOPT = MAX( 2*NMAX, NMAX*( NB+1 ), ( 2*I1+NMAX+1 )*( I1+1 ) ) 00541 * 00542 * Check for errors 00543 * 00544 IF( NSIZES.LT.0 ) THEN 00545 INFO = -1 00546 ELSE IF( BADNN ) THEN 00547 INFO = -2 00548 ELSE IF( NTYPES.LT.0 ) THEN 00549 INFO = -3 00550 ELSE IF( THRESH.LT.ZERO ) THEN 00551 INFO = -6 00552 ELSE IF( LDA.LE.1 .OR. LDA.LT.NMAX ) THEN 00553 INFO = -10 00554 ELSE IF( LDQ.LE.1 .OR. LDQ.LT.NMAX ) THEN 00555 INFO = -19 00556 ELSE IF( LWKOPT.GT.LWORK ) THEN 00557 INFO = -30 00558 END IF 00559 * 00560 IF( INFO.NE.0 ) THEN 00561 CALL XERBLA( 'CDRVGG', -INFO ) 00562 RETURN 00563 END IF 00564 * 00565 * Quick return if possible 00566 * 00567 IF( NSIZES.EQ.0 .OR. NTYPES.EQ.0 ) 00568 $ RETURN 00569 * 00570 ULP = SLAMCH( 'Precision' ) 00571 SAFMIN = SLAMCH( 'Safe minimum' ) 00572 SAFMIN = SAFMIN / ULP 00573 SAFMAX = ONE / SAFMIN 00574 CALL SLABAD( SAFMIN, SAFMAX ) 00575 ULPINV = ONE / ULP 00576 * 00577 * The values RMAGN(2:3) depend on N, see below. 00578 * 00579 RMAGN( 0 ) = ZERO 00580 RMAGN( 1 ) = ONE 00581 * 00582 * Loop over sizes, types 00583 * 00584 NTESTT = 0 00585 NERRS = 0 00586 NMATS = 0 00587 * 00588 DO 160 JSIZE = 1, NSIZES 00589 N = NN( JSIZE ) 00590 N1 = MAX( 1, N ) 00591 RMAGN( 2 ) = SAFMAX*ULP / REAL( N1 ) 00592 RMAGN( 3 ) = SAFMIN*ULPINV*N1 00593 * 00594 IF( NSIZES.NE.1 ) THEN 00595 MTYPES = MIN( MAXTYP, NTYPES ) 00596 ELSE 00597 MTYPES = MIN( MAXTYP+1, NTYPES ) 00598 END IF 00599 * 00600 DO 150 JTYPE = 1, MTYPES 00601 IF( .NOT.DOTYPE( JTYPE ) ) 00602 $ GO TO 150 00603 NMATS = NMATS + 1 00604 NTEST = 0 00605 * 00606 * Save ISEED in case of an error. 00607 * 00608 DO 20 J = 1, 4 00609 IOLDSD( J ) = ISEED( J ) 00610 20 CONTINUE 00611 * 00612 * Initialize RESULT 00613 * 00614 DO 30 J = 1, 7 00615 RESULT( J ) = ZERO 00616 30 CONTINUE 00617 * 00618 * Compute A and B 00619 * 00620 * Description of control parameters: 00621 * 00622 * KCLASS: =1 means w/o rotation, =2 means w/ rotation, 00623 * =3 means random. 00624 * KATYPE: the "type" to be passed to CLATM4 for computing A. 00625 * KAZERO: the pattern of zeros on the diagonal for A: 00626 * =1: ( xxx ), =2: (0, xxx ) =3: ( 0, 0, xxx, 0 ), 00627 * =4: ( 0, xxx, 0, 0 ), =5: ( 0, 0, 1, xxx, 0 ), 00628 * =6: ( 0, 1, 0, xxx, 0 ). (xxx means a string of 00629 * non-zero entries.) 00630 * KAMAGN: the magnitude of the matrix: =0: zero, =1: O(1), 00631 * =2: large, =3: small. 00632 * LASIGN: .TRUE. if the diagonal elements of A are to be 00633 * multiplied by a random magnitude 1 number. 00634 * KBTYPE, KBZERO, KBMAGN, IBSIGN: the same, but for B. 00635 * KTRIAN: =0: don't fill in the upper triangle, =1: do. 00636 * KZ1, KZ2, KADD: used to implement KAZERO and KBZERO. 00637 * RMAGN: used to implement KAMAGN and KBMAGN. 00638 * 00639 IF( MTYPES.GT.MAXTYP ) 00640 $ GO TO 110 00641 IINFO = 0 00642 IF( KCLASS( JTYPE ).LT.3 ) THEN 00643 * 00644 * Generate A (w/o rotation) 00645 * 00646 IF( ABS( KATYPE( JTYPE ) ).EQ.3 ) THEN 00647 IN = 2*( ( N-1 ) / 2 ) + 1 00648 IF( IN.NE.N ) 00649 $ CALL CLASET( 'Full', N, N, CZERO, CZERO, A, LDA ) 00650 ELSE 00651 IN = N 00652 END IF 00653 CALL CLATM4( KATYPE( JTYPE ), IN, KZ1( KAZERO( JTYPE ) ), 00654 $ KZ2( KAZERO( JTYPE ) ), LASIGN( JTYPE ), 00655 $ RMAGN( KAMAGN( JTYPE ) ), ULP, 00656 $ RMAGN( KTRIAN( JTYPE )*KAMAGN( JTYPE ) ), 2, 00657 $ ISEED, A, LDA ) 00658 IADD = KADD( KAZERO( JTYPE ) ) 00659 IF( IADD.GT.0 .AND. IADD.LE.N ) 00660 $ A( IADD, IADD ) = RMAGN( KAMAGN( JTYPE ) ) 00661 * 00662 * Generate B (w/o rotation) 00663 * 00664 IF( ABS( KBTYPE( JTYPE ) ).EQ.3 ) THEN 00665 IN = 2*( ( N-1 ) / 2 ) + 1 00666 IF( IN.NE.N ) 00667 $ CALL CLASET( 'Full', N, N, CZERO, CZERO, B, LDA ) 00668 ELSE 00669 IN = N 00670 END IF 00671 CALL CLATM4( KBTYPE( JTYPE ), IN, KZ1( KBZERO( JTYPE ) ), 00672 $ KZ2( KBZERO( JTYPE ) ), LBSIGN( JTYPE ), 00673 $ RMAGN( KBMAGN( JTYPE ) ), ONE, 00674 $ RMAGN( KTRIAN( JTYPE )*KBMAGN( JTYPE ) ), 2, 00675 $ ISEED, B, LDA ) 00676 IADD = KADD( KBZERO( JTYPE ) ) 00677 IF( IADD.NE.0 .AND. IADD.LE.N ) 00678 $ B( IADD, IADD ) = RMAGN( KBMAGN( JTYPE ) ) 00679 * 00680 IF( KCLASS( JTYPE ).EQ.2 .AND. N.GT.0 ) THEN 00681 * 00682 * Include rotations 00683 * 00684 * Generate Q, Z as Householder transformations times 00685 * a diagonal matrix. 00686 * 00687 DO 50 JC = 1, N - 1 00688 DO 40 JR = JC, N 00689 Q( JR, JC ) = CLARND( 3, ISEED ) 00690 Z( JR, JC ) = CLARND( 3, ISEED ) 00691 40 CONTINUE 00692 CALL CLARFG( N+1-JC, Q( JC, JC ), Q( JC+1, JC ), 1, 00693 $ WORK( JC ) ) 00694 WORK( 2*N+JC ) = SIGN( ONE, REAL( Q( JC, JC ) ) ) 00695 Q( JC, JC ) = CONE 00696 CALL CLARFG( N+1-JC, Z( JC, JC ), Z( JC+1, JC ), 1, 00697 $ WORK( N+JC ) ) 00698 WORK( 3*N+JC ) = SIGN( ONE, REAL( Z( JC, JC ) ) ) 00699 Z( JC, JC ) = CONE 00700 50 CONTINUE 00701 CTEMP = CLARND( 3, ISEED ) 00702 Q( N, N ) = CONE 00703 WORK( N ) = CZERO 00704 WORK( 3*N ) = CTEMP / ABS( CTEMP ) 00705 CTEMP = CLARND( 3, ISEED ) 00706 Z( N, N ) = CONE 00707 WORK( 2*N ) = CZERO 00708 WORK( 4*N ) = CTEMP / ABS( CTEMP ) 00709 * 00710 * Apply the diagonal matrices 00711 * 00712 DO 70 JC = 1, N 00713 DO 60 JR = 1, N 00714 A( JR, JC ) = WORK( 2*N+JR )* 00715 $ CONJG( WORK( 3*N+JC ) )* 00716 $ A( JR, JC ) 00717 B( JR, JC ) = WORK( 2*N+JR )* 00718 $ CONJG( WORK( 3*N+JC ) )* 00719 $ B( JR, JC ) 00720 60 CONTINUE 00721 70 CONTINUE 00722 CALL CUNM2R( 'L', 'N', N, N, N-1, Q, LDQ, WORK, A, 00723 $ LDA, WORK( 2*N+1 ), IINFO ) 00724 IF( IINFO.NE.0 ) 00725 $ GO TO 100 00726 CALL CUNM2R( 'R', 'C', N, N, N-1, Z, LDQ, WORK( N+1 ), 00727 $ A, LDA, WORK( 2*N+1 ), IINFO ) 00728 IF( IINFO.NE.0 ) 00729 $ GO TO 100 00730 CALL CUNM2R( 'L', 'N', N, N, N-1, Q, LDQ, WORK, B, 00731 $ LDA, WORK( 2*N+1 ), IINFO ) 00732 IF( IINFO.NE.0 ) 00733 $ GO TO 100 00734 CALL CUNM2R( 'R', 'C', N, N, N-1, Z, LDQ, WORK( N+1 ), 00735 $ B, LDA, WORK( 2*N+1 ), IINFO ) 00736 IF( IINFO.NE.0 ) 00737 $ GO TO 100 00738 END IF 00739 ELSE 00740 * 00741 * Random matrices 00742 * 00743 DO 90 JC = 1, N 00744 DO 80 JR = 1, N 00745 A( JR, JC ) = RMAGN( KAMAGN( JTYPE ) )* 00746 $ CLARND( 4, ISEED ) 00747 B( JR, JC ) = RMAGN( KBMAGN( JTYPE ) )* 00748 $ CLARND( 4, ISEED ) 00749 80 CONTINUE 00750 90 CONTINUE 00751 END IF 00752 * 00753 100 CONTINUE 00754 * 00755 IF( IINFO.NE.0 ) THEN 00756 WRITE( NOUNIT, FMT = 9999 )'Generator', IINFO, N, JTYPE, 00757 $ IOLDSD 00758 INFO = ABS( IINFO ) 00759 RETURN 00760 END IF 00761 * 00762 110 CONTINUE 00763 * 00764 * Call CGEGS to compute H, T, Q, Z, alpha, and beta. 00765 * 00766 CALL CLACPY( ' ', N, N, A, LDA, S, LDA ) 00767 CALL CLACPY( ' ', N, N, B, LDA, T, LDA ) 00768 NTEST = 1 00769 RESULT( 1 ) = ULPINV 00770 * 00771 CALL CGEGS( 'V', 'V', N, S, LDA, T, LDA, ALPHA1, BETA1, Q, 00772 $ LDQ, Z, LDQ, WORK, LWORK, RWORK, IINFO ) 00773 IF( IINFO.NE.0 ) THEN 00774 WRITE( NOUNIT, FMT = 9999 )'CGEGS', IINFO, N, JTYPE, 00775 $ IOLDSD 00776 INFO = ABS( IINFO ) 00777 GO TO 130 00778 END IF 00779 * 00780 NTEST = 4 00781 * 00782 * Do tests 1--4 00783 * 00784 CALL CGET51( 1, N, A, LDA, S, LDA, Q, LDQ, Z, LDQ, WORK, 00785 $ RWORK, RESULT( 1 ) ) 00786 CALL CGET51( 1, N, B, LDA, T, LDA, Q, LDQ, Z, LDQ, WORK, 00787 $ RWORK, RESULT( 2 ) ) 00788 CALL CGET51( 3, N, B, LDA, T, LDA, Q, LDQ, Q, LDQ, WORK, 00789 $ RWORK, RESULT( 3 ) ) 00790 CALL CGET51( 3, N, B, LDA, T, LDA, Z, LDQ, Z, LDQ, WORK, 00791 $ RWORK, RESULT( 4 ) ) 00792 * 00793 * Do test 5: compare eigenvalues with diagonals. 00794 * 00795 TEMP1 = ZERO 00796 * 00797 DO 120 J = 1, N 00798 TEMP2 = ( ABS1( ALPHA1( J )-S( J, J ) ) / 00799 $ MAX( SAFMIN, ABS1( ALPHA1( J ) ), ABS1( S( J, 00800 $ J ) ) )+ABS1( BETA1( J )-T( J, J ) ) / 00801 $ MAX( SAFMIN, ABS1( BETA1( J ) ), ABS1( T( J, 00802 $ J ) ) ) ) / ULP 00803 TEMP1 = MAX( TEMP1, TEMP2 ) 00804 120 CONTINUE 00805 RESULT( 5 ) = TEMP1 00806 * 00807 * Call CGEGV to compute S2, T2, VL, and VR, do tests. 00808 * 00809 * Eigenvalues and Eigenvectors 00810 * 00811 CALL CLACPY( ' ', N, N, A, LDA, S2, LDA ) 00812 CALL CLACPY( ' ', N, N, B, LDA, T2, LDA ) 00813 NTEST = 6 00814 RESULT( 6 ) = ULPINV 00815 * 00816 CALL CGEGV( 'V', 'V', N, S2, LDA, T2, LDA, ALPHA2, BETA2, 00817 $ VL, LDQ, VR, LDQ, WORK, LWORK, RWORK, IINFO ) 00818 IF( IINFO.NE.0 ) THEN 00819 WRITE( NOUNIT, FMT = 9999 )'CGEGV', IINFO, N, JTYPE, 00820 $ IOLDSD 00821 INFO = ABS( IINFO ) 00822 GO TO 130 00823 END IF 00824 * 00825 NTEST = 7 00826 * 00827 * Do Tests 6 and 7 00828 * 00829 CALL CGET52( .TRUE., N, A, LDA, B, LDA, VL, LDQ, ALPHA2, 00830 $ BETA2, WORK, RWORK, DUMMA( 1 ) ) 00831 RESULT( 6 ) = DUMMA( 1 ) 00832 IF( DUMMA( 2 ).GT.THRSHN ) THEN 00833 WRITE( NOUNIT, FMT = 9998 )'Left', 'CGEGV', DUMMA( 2 ), 00834 $ N, JTYPE, IOLDSD 00835 END IF 00836 * 00837 CALL CGET52( .FALSE., N, A, LDA, B, LDA, VR, LDQ, ALPHA2, 00838 $ BETA2, WORK, RWORK, DUMMA( 1 ) ) 00839 RESULT( 7 ) = DUMMA( 1 ) 00840 IF( DUMMA( 2 ).GT.THRESH ) THEN 00841 WRITE( NOUNIT, FMT = 9998 )'Right', 'CGEGV', DUMMA( 2 ), 00842 $ N, JTYPE, IOLDSD 00843 END IF 00844 * 00845 * End of Loop -- Check for RESULT(j) > THRESH 00846 * 00847 130 CONTINUE 00848 * 00849 NTESTT = NTESTT + NTEST 00850 * 00851 * Print out tests which fail. 00852 * 00853 DO 140 JR = 1, NTEST 00854 IF( RESULT( JR ).GE.THRESH ) THEN 00855 * 00856 * If this is the first test to fail, 00857 * print a header to the data file. 00858 * 00859 IF( NERRS.EQ.0 ) THEN 00860 WRITE( NOUNIT, FMT = 9997 )'CGG' 00861 * 00862 * Matrix types 00863 * 00864 WRITE( NOUNIT, FMT = 9996 ) 00865 WRITE( NOUNIT, FMT = 9995 ) 00866 WRITE( NOUNIT, FMT = 9994 )'Unitary' 00867 * 00868 * Tests performed 00869 * 00870 WRITE( NOUNIT, FMT = 9993 )'unitary', '*', 00871 $ 'conjugate transpose', ( '*', J = 1, 5 ) 00872 * 00873 END IF 00874 NERRS = NERRS + 1 00875 IF( RESULT( JR ).LT.10000.0 ) THEN 00876 WRITE( NOUNIT, FMT = 9992 )N, JTYPE, IOLDSD, JR, 00877 $ RESULT( JR ) 00878 ELSE 00879 WRITE( NOUNIT, FMT = 9991 )N, JTYPE, IOLDSD, JR, 00880 $ RESULT( JR ) 00881 END IF 00882 END IF 00883 140 CONTINUE 00884 * 00885 150 CONTINUE 00886 160 CONTINUE 00887 * 00888 * Summary 00889 * 00890 CALL ALASVM( 'CGG', NOUNIT, NERRS, NTESTT, 0 ) 00891 RETURN 00892 * 00893 9999 FORMAT( ' CDRVGG: ', A, ' returned INFO=', I6, '.', / 9X, 'N=', 00894 $ I6, ', JTYPE=', I6, ', ISEED=(', 3( I5, ',' ), I5, ')' ) 00895 * 00896 9998 FORMAT( ' CDRVGG: ', A, ' Eigenvectors from ', A, ' incorrectly ', 00897 $ 'normalized.', / ' Bits of error=', 0P, G10.3, ',', 9X, 00898 $ 'N=', I6, ', JTYPE=', I6, ', ISEED=(', 3( I5, ',' ), I5, 00899 $ ')' ) 00900 * 00901 9997 FORMAT( / 1X, A3, 00902 $ ' -- Complex Generalized eigenvalue problem driver' ) 00903 * 00904 9996 FORMAT( ' Matrix types (see CDRVGG for details): ' ) 00905 * 00906 9995 FORMAT( ' Special Matrices:', 23X, 00907 $ '(J''=transposed Jordan block)', 00908 $ / ' 1=(0,0) 2=(I,0) 3=(0,I) 4=(I,I) 5=(J'',J'') ', 00909 $ '6=(diag(J'',I), diag(I,J''))', / ' Diagonal Matrices: ( ', 00910 $ 'D=diag(0,1,2,...) )', / ' 7=(D,I) 9=(large*D, small*I', 00911 $ ') 11=(large*I, small*D) 13=(large*D, large*I)', / 00912 $ ' 8=(I,D) 10=(small*D, large*I) 12=(small*I, large*D) ', 00913 $ ' 14=(small*D, small*I)', / ' 15=(D, reversed D)' ) 00914 9994 FORMAT( ' Matrices Rotated by Random ', A, ' Matrices U, V:', 00915 $ / ' 16=Transposed Jordan Blocks 19=geometric ', 00916 $ 'alpha, beta=0,1', / ' 17=arithm. alpha&beta ', 00917 $ ' 20=arithmetic alpha, beta=0,1', / ' 18=clustered ', 00918 $ 'alpha, beta=0,1 21=random alpha, beta=0,1', 00919 $ / ' Large & Small Matrices:', / ' 22=(large, small) ', 00920 $ '23=(small,large) 24=(small,small) 25=(large,large)', 00921 $ / ' 26=random O(1) matrices.' ) 00922 * 00923 9993 FORMAT( / ' Tests performed: (S is Schur, T is triangular, ', 00924 $ 'Q and Z are ', A, ',', / 20X, 00925 $ 'l and r are the appropriate left and right', / 19X, 00926 $ 'eigenvectors, resp., a is alpha, b is beta, and', / 19X, A, 00927 $ ' means ', A, '.)', / ' 1 = | A - Q S Z', A, 00928 $ ' | / ( |A| n ulp ) 2 = | B - Q T Z', A, 00929 $ ' | / ( |B| n ulp )', / ' 3 = | I - QQ', A, 00930 $ ' | / ( n ulp ) 4 = | I - ZZ', A, 00931 $ ' | / ( n ulp )', / 00932 $ ' 5 = difference between (alpha,beta) and diagonals of', 00933 $ ' (S,T)', / ' 6 = max | ( b A - a B )', A, 00934 $ ' l | / const. 7 = max | ( b A - a B ) r | / const.', 00935 $ / 1X ) 00936 9992 FORMAT( ' Matrix order=', I5, ', type=', I2, ', seed=', 00937 $ 4( I4, ',' ), ' result ', I3, ' is', 0P, F8.2 ) 00938 9991 FORMAT( ' Matrix order=', I5, ', type=', I2, ', seed=', 00939 $ 4( I4, ',' ), ' result ', I3, ' is', 1P, E10.3 ) 00940 * 00941 * End of CDRVGG 00942 * 00943 END