![]() |
LAPACK
3.4.1
LAPACK: Linear Algebra PACKage
|
00001 *> \brief \b CDRVES 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 CDRVES( NSIZES, NN, NTYPES, DOTYPE, ISEED, THRESH, 00012 * NOUNIT, A, LDA, H, HT, W, WT, VS, LDVS, RESULT, 00013 * WORK, NWORK, RWORK, IWORK, BWORK, INFO ) 00014 * 00015 * .. Scalar Arguments .. 00016 * INTEGER INFO, LDA, LDVS, NOUNIT, NSIZES, NTYPES, NWORK 00017 * REAL THRESH 00018 * .. 00019 * .. Array Arguments .. 00020 * LOGICAL BWORK( * ), DOTYPE( * ) 00021 * INTEGER ISEED( 4 ), IWORK( * ), NN( * ) 00022 * REAL RESULT( 13 ), RWORK( * ) 00023 * COMPLEX A( LDA, * ), H( LDA, * ), HT( LDA, * ), 00024 * $ VS( LDVS, * ), W( * ), WORK( * ), WT( * ) 00025 * .. 00026 * 00027 * 00028 *> \par Purpose: 00029 * ============= 00030 *> 00031 *> \verbatim 00032 *> 00033 *> CDRVES checks the nonsymmetric eigenvalue (Schur form) problem 00034 *> driver CGEES. 00035 *> 00036 *> When CDRVES is called, a number of matrix "sizes" ("n's") and a 00037 *> number of matrix "types" are specified. For each size ("n") 00038 *> and each type of matrix, one matrix will be generated and used 00039 *> to test the nonsymmetric eigenroutines. For each matrix, 13 00040 *> tests will be performed: 00041 *> 00042 *> (1) 0 if T is in Schur form, 1/ulp otherwise 00043 *> (no sorting of eigenvalues) 00044 *> 00045 *> (2) | A - VS T VS' | / ( n |A| ulp ) 00046 *> 00047 *> Here VS is the matrix of Schur eigenvectors, and T is in Schur 00048 *> form (no sorting of eigenvalues). 00049 *> 00050 *> (3) | I - VS VS' | / ( n ulp ) (no sorting of eigenvalues). 00051 *> 00052 *> (4) 0 if W are eigenvalues of T 00053 *> 1/ulp otherwise 00054 *> (no sorting of eigenvalues) 00055 *> 00056 *> (5) 0 if T(with VS) = T(without VS), 00057 *> 1/ulp otherwise 00058 *> (no sorting of eigenvalues) 00059 *> 00060 *> (6) 0 if eigenvalues(with VS) = eigenvalues(without VS), 00061 *> 1/ulp otherwise 00062 *> (no sorting of eigenvalues) 00063 *> 00064 *> (7) 0 if T is in Schur form, 1/ulp otherwise 00065 *> (with sorting of eigenvalues) 00066 *> 00067 *> (8) | A - VS T VS' | / ( n |A| ulp ) 00068 *> 00069 *> Here VS is the matrix of Schur eigenvectors, and T is in Schur 00070 *> form (with sorting of eigenvalues). 00071 *> 00072 *> (9) | I - VS VS' | / ( n ulp ) (with sorting of eigenvalues). 00073 *> 00074 *> (10) 0 if W are eigenvalues of T 00075 *> 1/ulp otherwise 00076 *> (with sorting of eigenvalues) 00077 *> 00078 *> (11) 0 if T(with VS) = T(without VS), 00079 *> 1/ulp otherwise 00080 *> (with sorting of eigenvalues) 00081 *> 00082 *> (12) 0 if eigenvalues(with VS) = eigenvalues(without VS), 00083 *> 1/ulp otherwise 00084 *> (with sorting of eigenvalues) 00085 *> 00086 *> (13) if sorting worked and SDIM is the number of 00087 *> eigenvalues which were SELECTed 00088 *> 00089 *> The "sizes" are specified by an array NN(1:NSIZES); the value of 00090 *> each element NN(j) specifies one size. 00091 *> The "types" are specified by a logical array DOTYPE( 1:NTYPES ); 00092 *> if DOTYPE(j) is .TRUE., then matrix type "j" will be generated. 00093 *> Currently, the list of possible types is: 00094 *> 00095 *> (1) The zero matrix. 00096 *> (2) The identity matrix. 00097 *> (3) A (transposed) Jordan block, with 1's on the diagonal. 00098 *> 00099 *> (4) A diagonal matrix with evenly spaced entries 00100 *> 1, ..., ULP and random complex angles. 00101 *> (ULP = (first number larger than 1) - 1 ) 00102 *> (5) A diagonal matrix with geometrically spaced entries 00103 *> 1, ..., ULP and random complex angles. 00104 *> (6) A diagonal matrix with "clustered" entries 1, ULP, ..., ULP 00105 *> and random complex angles. 00106 *> 00107 *> (7) Same as (4), but multiplied by a constant near 00108 *> the overflow threshold 00109 *> (8) Same as (4), but multiplied by a constant near 00110 *> the underflow threshold 00111 *> 00112 *> (9) A matrix of the form U' T U, where U is unitary and 00113 *> T has evenly spaced entries 1, ..., ULP with random 00114 *> complex angles on the diagonal and random O(1) entries in 00115 *> the upper triangle. 00116 *> 00117 *> (10) A matrix of the form U' T U, where U is unitary and 00118 *> T has geometrically spaced entries 1, ..., ULP with random 00119 *> complex angles on the diagonal and random O(1) entries in 00120 *> the upper triangle. 00121 *> 00122 *> (11) A matrix of the form U' T U, where U is orthogonal and 00123 *> T has "clustered" entries 1, ULP,..., ULP with random 00124 *> complex angles on the diagonal and random O(1) entries in 00125 *> the upper triangle. 00126 *> 00127 *> (12) A matrix of the form U' T U, where U is unitary and 00128 *> T has complex eigenvalues randomly chosen from 00129 *> ULP < |z| < 1 and random O(1) entries in the upper 00130 *> triangle. 00131 *> 00132 *> (13) A matrix of the form X' T X, where X has condition 00133 *> SQRT( ULP ) and T has evenly spaced entries 1, ..., ULP 00134 *> with random complex angles on the diagonal and random O(1) 00135 *> entries in the upper triangle. 00136 *> 00137 *> (14) A matrix of the form X' T X, where X has condition 00138 *> SQRT( ULP ) and T has geometrically spaced entries 00139 *> 1, ..., ULP with random complex angles on the diagonal 00140 *> and random O(1) entries in the upper triangle. 00141 *> 00142 *> (15) A matrix of the form X' T X, where X has condition 00143 *> SQRT( ULP ) and T has "clustered" entries 1, ULP,..., ULP 00144 *> with random complex angles on the diagonal and random O(1) 00145 *> entries in the upper triangle. 00146 *> 00147 *> (16) A matrix of the form X' T X, where X has condition 00148 *> SQRT( ULP ) and T has complex eigenvalues randomly chosen 00149 *> from ULP < |z| < 1 and random O(1) entries in the upper 00150 *> triangle. 00151 *> 00152 *> (17) Same as (16), but multiplied by a constant 00153 *> near the overflow threshold 00154 *> (18) Same as (16), but multiplied by a constant 00155 *> near the underflow threshold 00156 *> 00157 *> (19) Nonsymmetric matrix with random entries chosen from (-1,1). 00158 *> If N is at least 4, all entries in first two rows and last 00159 *> row, and first column and last two columns are zero. 00160 *> (20) Same as (19), but multiplied by a constant 00161 *> near the overflow threshold 00162 *> (21) Same as (19), but multiplied by a constant 00163 *> near the underflow threshold 00164 *> \endverbatim 00165 * 00166 * Arguments: 00167 * ========== 00168 * 00169 *> \param[in] NSIZES 00170 *> \verbatim 00171 *> NSIZES is INTEGER 00172 *> The number of sizes of matrices to use. If it is zero, 00173 *> CDRVES does nothing. It must be at least zero. 00174 *> \endverbatim 00175 *> 00176 *> \param[in] NN 00177 *> \verbatim 00178 *> NN is INTEGER array, dimension (NSIZES) 00179 *> An array containing the sizes to be used for the matrices. 00180 *> Zero values will be skipped. The values must be at least 00181 *> zero. 00182 *> \endverbatim 00183 *> 00184 *> \param[in] NTYPES 00185 *> \verbatim 00186 *> NTYPES is INTEGER 00187 *> The number of elements in DOTYPE. If it is zero, CDRVES 00188 *> does nothing. It must be at least zero. If it is MAXTYP+1 00189 *> and NSIZES is 1, then an additional type, MAXTYP+1 is 00190 *> defined, which is to use whatever matrix is in A. This 00191 *> is only useful if DOTYPE(1:MAXTYP) is .FALSE. and 00192 *> DOTYPE(MAXTYP+1) is .TRUE. . 00193 *> \endverbatim 00194 *> 00195 *> \param[in] DOTYPE 00196 *> \verbatim 00197 *> DOTYPE is LOGICAL array, dimension (NTYPES) 00198 *> If DOTYPE(j) is .TRUE., then for each size in NN a 00199 *> matrix of that size and of type j will be generated. 00200 *> If NTYPES is smaller than the maximum number of types 00201 *> defined (PARAMETER MAXTYP), then types NTYPES+1 through 00202 *> MAXTYP will not be generated. If NTYPES is larger 00203 *> than MAXTYP, DOTYPE(MAXTYP+1) through DOTYPE(NTYPES) 00204 *> will be ignored. 00205 *> \endverbatim 00206 *> 00207 *> \param[in,out] ISEED 00208 *> \verbatim 00209 *> ISEED is INTEGER array, dimension (4) 00210 *> On entry ISEED specifies the seed of the random number 00211 *> generator. The array elements should be between 0 and 4095; 00212 *> if not they will be reduced mod 4096. Also, ISEED(4) must 00213 *> be odd. The random number generator uses a linear 00214 *> congruential sequence limited to small integers, and so 00215 *> should produce machine independent random numbers. The 00216 *> values of ISEED are changed on exit, and can be used in the 00217 *> next call to CDRVES to continue the same random number 00218 *> sequence. 00219 *> \endverbatim 00220 *> 00221 *> \param[in] THRESH 00222 *> \verbatim 00223 *> THRESH is REAL 00224 *> A test will count as "failed" if the "error", computed as 00225 *> described above, exceeds THRESH. Note that the error 00226 *> is scaled to be O(1), so THRESH should be a reasonably 00227 *> small multiple of 1, e.g., 10 or 100. In particular, 00228 *> it should not depend on the precision (single vs. double) 00229 *> or the size of the matrix. It must be at least zero. 00230 *> \endverbatim 00231 *> 00232 *> \param[in] NOUNIT 00233 *> \verbatim 00234 *> NOUNIT is INTEGER 00235 *> The FORTRAN unit number for printing out error messages 00236 *> (e.g., if a routine returns INFO not equal to 0.) 00237 *> \endverbatim 00238 *> 00239 *> \param[out] A 00240 *> \verbatim 00241 *> A is COMPLEX array, dimension (LDA, max(NN)) 00242 *> Used to hold the matrix whose eigenvalues are to be 00243 *> computed. On exit, A contains the last matrix actually used. 00244 *> \endverbatim 00245 *> 00246 *> \param[in] LDA 00247 *> \verbatim 00248 *> LDA is INTEGER 00249 *> The leading dimension of A, and H. LDA must be at 00250 *> least 1 and at least max( NN ). 00251 *> \endverbatim 00252 *> 00253 *> \param[out] H 00254 *> \verbatim 00255 *> H is COMPLEX array, dimension (LDA, max(NN)) 00256 *> Another copy of the test matrix A, modified by CGEES. 00257 *> \endverbatim 00258 *> 00259 *> \param[out] HT 00260 *> \verbatim 00261 *> HT is COMPLEX array, dimension (LDA, max(NN)) 00262 *> Yet another copy of the test matrix A, modified by CGEES. 00263 *> \endverbatim 00264 *> 00265 *> \param[out] W 00266 *> \verbatim 00267 *> W is COMPLEX array, dimension (max(NN)) 00268 *> The computed eigenvalues of A. 00269 *> \endverbatim 00270 *> 00271 *> \param[out] WT 00272 *> \verbatim 00273 *> WT is COMPLEX array, dimension (max(NN)) 00274 *> Like W, this array contains the eigenvalues of A, 00275 *> but those computed when CGEES only computes a partial 00276 *> eigendecomposition, i.e. not Schur vectors 00277 *> \endverbatim 00278 *> 00279 *> \param[out] VS 00280 *> \verbatim 00281 *> VS is COMPLEX array, dimension (LDVS, max(NN)) 00282 *> VS holds the computed Schur vectors. 00283 *> \endverbatim 00284 *> 00285 *> \param[in] LDVS 00286 *> \verbatim 00287 *> LDVS is INTEGER 00288 *> Leading dimension of VS. Must be at least max(1,max(NN)). 00289 *> \endverbatim 00290 *> 00291 *> \param[out] RESULT 00292 *> \verbatim 00293 *> RESULT is REAL array, dimension (13) 00294 *> The values computed by the 13 tests described above. 00295 *> The values are currently limited to 1/ulp, to avoid overflow. 00296 *> \endverbatim 00297 *> 00298 *> \param[out] WORK 00299 *> \verbatim 00300 *> WORK is COMPLEX array, dimension (NWORK) 00301 *> \endverbatim 00302 *> 00303 *> \param[in] NWORK 00304 *> \verbatim 00305 *> NWORK is INTEGER 00306 *> The number of entries in WORK. This must be at least 00307 *> 5*NN(j)+2*NN(j)**2 for all j. 00308 *> \endverbatim 00309 *> 00310 *> \param[out] RWORK 00311 *> \verbatim 00312 *> RWORK is REAL array, dimension (max(NN)) 00313 *> \endverbatim 00314 *> 00315 *> \param[out] IWORK 00316 *> \verbatim 00317 *> IWORK is INTEGER array, dimension (max(NN)) 00318 *> \endverbatim 00319 *> 00320 *> \param[out] BWORK 00321 *> \verbatim 00322 *> BWORK is LOGICAL array, dimension (max(NN)) 00323 *> \endverbatim 00324 *> 00325 *> \param[out] INFO 00326 *> \verbatim 00327 *> INFO is INTEGER 00328 *> If 0, then everything ran OK. 00329 *> -1: NSIZES < 0 00330 *> -2: Some NN(j) < 0 00331 *> -3: NTYPES < 0 00332 *> -6: THRESH < 0 00333 *> -9: LDA < 1 or LDA < NMAX, where NMAX is max( NN(j) ). 00334 *> -15: LDVS < 1 or LDVS < NMAX, where NMAX is max( NN(j) ). 00335 *> -18: NWORK too small. 00336 *> If CLATMR, CLATMS, CLATME or CGEES returns an error code, 00337 *> the absolute value of it is returned. 00338 *> 00339 *>----------------------------------------------------------------------- 00340 *> 00341 *> Some Local Variables and Parameters: 00342 *> ---- ----- --------- --- ---------- 00343 *> ZERO, ONE Real 0 and 1. 00344 *> MAXTYP The number of types defined. 00345 *> NMAX Largest value in NN. 00346 *> NERRS The number of tests which have exceeded THRESH 00347 *> COND, CONDS, 00348 *> IMODE Values to be passed to the matrix generators. 00349 *> ANORM Norm of A; passed to matrix generators. 00350 *> 00351 *> OVFL, UNFL Overflow and underflow thresholds. 00352 *> ULP, ULPINV Finest relative precision and its inverse. 00353 *> RTULP, RTULPI Square roots of the previous 4 values. 00354 *> The following four arrays decode JTYPE: 00355 *> KTYPE(j) The general type (1-10) for type "j". 00356 *> KMODE(j) The MODE value to be passed to the matrix 00357 *> generator for type "j". 00358 *> KMAGN(j) The order of magnitude ( O(1), 00359 *> O(overflow^(1/2) ), O(underflow^(1/2) ) 00360 *> KCONDS(j) Select whether CONDS is to be 1 or 00361 *> 1/sqrt(ulp). (0 means irrelevant.) 00362 *> \endverbatim 00363 * 00364 * Authors: 00365 * ======== 00366 * 00367 *> \author Univ. of Tennessee 00368 *> \author Univ. of California Berkeley 00369 *> \author Univ. of Colorado Denver 00370 *> \author NAG Ltd. 00371 * 00372 *> \date November 2011 00373 * 00374 *> \ingroup complex_eig 00375 * 00376 * ===================================================================== 00377 SUBROUTINE CDRVES( NSIZES, NN, NTYPES, DOTYPE, ISEED, THRESH, 00378 $ NOUNIT, A, LDA, H, HT, W, WT, VS, LDVS, RESULT, 00379 $ WORK, NWORK, RWORK, IWORK, BWORK, INFO ) 00380 * 00381 * -- LAPACK test routine (version 3.4.0) -- 00382 * -- LAPACK is a software package provided by Univ. of Tennessee, -- 00383 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- 00384 * November 2011 00385 * 00386 * .. Scalar Arguments .. 00387 INTEGER INFO, LDA, LDVS, NOUNIT, NSIZES, NTYPES, NWORK 00388 REAL THRESH 00389 * .. 00390 * .. Array Arguments .. 00391 LOGICAL BWORK( * ), DOTYPE( * ) 00392 INTEGER ISEED( 4 ), IWORK( * ), NN( * ) 00393 REAL RESULT( 13 ), RWORK( * ) 00394 COMPLEX A( LDA, * ), H( LDA, * ), HT( LDA, * ), 00395 $ VS( LDVS, * ), W( * ), WORK( * ), WT( * ) 00396 * .. 00397 * 00398 * ===================================================================== 00399 * 00400 * .. Parameters .. 00401 COMPLEX CZERO 00402 PARAMETER ( CZERO = ( 0.0E+0, 0.0E+0 ) ) 00403 COMPLEX CONE 00404 PARAMETER ( CONE = ( 1.0E+0, 0.0E+0 ) ) 00405 REAL ZERO, ONE 00406 PARAMETER ( ZERO = 0.0E+0, ONE = 1.0E+0 ) 00407 INTEGER MAXTYP 00408 PARAMETER ( MAXTYP = 21 ) 00409 * .. 00410 * .. Local Scalars .. 00411 LOGICAL BADNN 00412 CHARACTER SORT 00413 CHARACTER*3 PATH 00414 INTEGER I, IINFO, IMODE, ISORT, ITYPE, IWK, J, JCOL, 00415 $ JSIZE, JTYPE, KNTEIG, LWORK, MTYPES, N, 00416 $ NERRS, NFAIL, NMAX, NNWORK, NTEST, NTESTF, 00417 $ NTESTT, RSUB, SDIM 00418 REAL ANORM, COND, CONDS, OVFL, RTULP, RTULPI, ULP, 00419 $ ULPINV, UNFL 00420 * .. 00421 * .. Local Arrays .. 00422 INTEGER IDUMMA( 1 ), IOLDSD( 4 ), KCONDS( MAXTYP ), 00423 $ KMAGN( MAXTYP ), KMODE( MAXTYP ), 00424 $ KTYPE( MAXTYP ) 00425 REAL RES( 2 ) 00426 * .. 00427 * .. Arrays in Common .. 00428 LOGICAL SELVAL( 20 ) 00429 REAL SELWI( 20 ), SELWR( 20 ) 00430 * .. 00431 * .. Scalars in Common .. 00432 INTEGER SELDIM, SELOPT 00433 * .. 00434 * .. Common blocks .. 00435 COMMON / SSLCT / SELOPT, SELDIM, SELVAL, SELWR, SELWI 00436 * .. 00437 * .. External Functions .. 00438 LOGICAL CSLECT 00439 REAL SLAMCH 00440 EXTERNAL CSLECT, SLAMCH 00441 * .. 00442 * .. External Subroutines .. 00443 EXTERNAL CGEES, CHST01, CLACPY, CLATME, CLATMR, CLATMS, 00444 $ CLASET, SLABAD, SLASUM, XERBLA 00445 * .. 00446 * .. Intrinsic Functions .. 00447 INTRINSIC ABS, CMPLX, MAX, MIN, SQRT 00448 * .. 00449 * .. Data statements .. 00450 DATA KTYPE / 1, 2, 3, 5*4, 4*6, 6*6, 3*9 / 00451 DATA KMAGN / 3*1, 1, 1, 1, 2, 3, 4*1, 1, 1, 1, 1, 2, 00452 $ 3, 1, 2, 3 / 00453 DATA KMODE / 3*0, 4, 3, 1, 4, 4, 4, 3, 1, 5, 4, 3, 00454 $ 1, 5, 5, 5, 4, 3, 1 / 00455 DATA KCONDS / 3*0, 5*0, 4*1, 6*2, 3*0 / 00456 * .. 00457 * .. Executable Statements .. 00458 * 00459 PATH( 1: 1 ) = 'Complex precision' 00460 PATH( 2: 3 ) = 'ES' 00461 * 00462 * Check for errors 00463 * 00464 NTESTT = 0 00465 NTESTF = 0 00466 INFO = 0 00467 SELOPT = 0 00468 * 00469 * Important constants 00470 * 00471 BADNN = .FALSE. 00472 NMAX = 0 00473 DO 10 J = 1, NSIZES 00474 NMAX = MAX( NMAX, NN( J ) ) 00475 IF( NN( J ).LT.0 ) 00476 $ BADNN = .TRUE. 00477 10 CONTINUE 00478 * 00479 * Check for errors 00480 * 00481 IF( NSIZES.LT.0 ) THEN 00482 INFO = -1 00483 ELSE IF( BADNN ) THEN 00484 INFO = -2 00485 ELSE IF( NTYPES.LT.0 ) THEN 00486 INFO = -3 00487 ELSE IF( THRESH.LT.ZERO ) THEN 00488 INFO = -6 00489 ELSE IF( NOUNIT.LE.0 ) THEN 00490 INFO = -7 00491 ELSE IF( LDA.LT.1 .OR. LDA.LT.NMAX ) THEN 00492 INFO = -9 00493 ELSE IF( LDVS.LT.1 .OR. LDVS.LT.NMAX ) THEN 00494 INFO = -15 00495 ELSE IF( 5*NMAX+2*NMAX**2.GT.NWORK ) THEN 00496 INFO = -18 00497 END IF 00498 * 00499 IF( INFO.NE.0 ) THEN 00500 CALL XERBLA( 'CDRVES', -INFO ) 00501 RETURN 00502 END IF 00503 * 00504 * Quick return if nothing to do 00505 * 00506 IF( NSIZES.EQ.0 .OR. NTYPES.EQ.0 ) 00507 $ RETURN 00508 * 00509 * More Important constants 00510 * 00511 UNFL = SLAMCH( 'Safe minimum' ) 00512 OVFL = ONE / UNFL 00513 CALL SLABAD( UNFL, OVFL ) 00514 ULP = SLAMCH( 'Precision' ) 00515 ULPINV = ONE / ULP 00516 RTULP = SQRT( ULP ) 00517 RTULPI = ONE / RTULP 00518 * 00519 * Loop over sizes, types 00520 * 00521 NERRS = 0 00522 * 00523 DO 240 JSIZE = 1, NSIZES 00524 N = NN( JSIZE ) 00525 IF( NSIZES.NE.1 ) THEN 00526 MTYPES = MIN( MAXTYP, NTYPES ) 00527 ELSE 00528 MTYPES = MIN( MAXTYP+1, NTYPES ) 00529 END IF 00530 * 00531 DO 230 JTYPE = 1, MTYPES 00532 IF( .NOT.DOTYPE( JTYPE ) ) 00533 $ GO TO 230 00534 * 00535 * Save ISEED in case of an error. 00536 * 00537 DO 20 J = 1, 4 00538 IOLDSD( J ) = ISEED( J ) 00539 20 CONTINUE 00540 * 00541 * Compute "A" 00542 * 00543 * Control parameters: 00544 * 00545 * KMAGN KCONDS KMODE KTYPE 00546 * =1 O(1) 1 clustered 1 zero 00547 * =2 large large clustered 2 identity 00548 * =3 small exponential Jordan 00549 * =4 arithmetic diagonal, (w/ eigenvalues) 00550 * =5 random log symmetric, w/ eigenvalues 00551 * =6 random general, w/ eigenvalues 00552 * =7 random diagonal 00553 * =8 random symmetric 00554 * =9 random general 00555 * =10 random triangular 00556 * 00557 IF( MTYPES.GT.MAXTYP ) 00558 $ GO TO 90 00559 * 00560 ITYPE = KTYPE( JTYPE ) 00561 IMODE = KMODE( JTYPE ) 00562 * 00563 * Compute norm 00564 * 00565 GO TO ( 30, 40, 50 )KMAGN( JTYPE ) 00566 * 00567 30 CONTINUE 00568 ANORM = ONE 00569 GO TO 60 00570 * 00571 40 CONTINUE 00572 ANORM = OVFL*ULP 00573 GO TO 60 00574 * 00575 50 CONTINUE 00576 ANORM = UNFL*ULPINV 00577 GO TO 60 00578 * 00579 60 CONTINUE 00580 * 00581 CALL CLASET( 'Full', LDA, N, CZERO, CZERO, A, LDA ) 00582 IINFO = 0 00583 COND = ULPINV 00584 * 00585 * Special Matrices -- Identity & Jordan block 00586 * 00587 IF( ITYPE.EQ.1 ) THEN 00588 * 00589 * Zero 00590 * 00591 IINFO = 0 00592 * 00593 ELSE IF( ITYPE.EQ.2 ) THEN 00594 * 00595 * Identity 00596 * 00597 DO 70 JCOL = 1, N 00598 A( JCOL, JCOL ) = CMPLX( ANORM ) 00599 70 CONTINUE 00600 * 00601 ELSE IF( ITYPE.EQ.3 ) THEN 00602 * 00603 * Jordan Block 00604 * 00605 DO 80 JCOL = 1, N 00606 A( JCOL, JCOL ) = CMPLX( ANORM ) 00607 IF( JCOL.GT.1 ) 00608 $ A( JCOL, JCOL-1 ) = CONE 00609 80 CONTINUE 00610 * 00611 ELSE IF( ITYPE.EQ.4 ) THEN 00612 * 00613 * Diagonal Matrix, [Eigen]values Specified 00614 * 00615 CALL CLATMS( N, N, 'S', ISEED, 'H', RWORK, IMODE, COND, 00616 $ ANORM, 0, 0, 'N', A, LDA, WORK( N+1 ), 00617 $ IINFO ) 00618 * 00619 ELSE IF( ITYPE.EQ.5 ) THEN 00620 * 00621 * Symmetric, eigenvalues specified 00622 * 00623 CALL CLATMS( N, N, 'S', ISEED, 'H', RWORK, IMODE, COND, 00624 $ ANORM, N, N, 'N', A, LDA, WORK( N+1 ), 00625 $ IINFO ) 00626 * 00627 ELSE IF( ITYPE.EQ.6 ) THEN 00628 * 00629 * General, eigenvalues specified 00630 * 00631 IF( KCONDS( JTYPE ).EQ.1 ) THEN 00632 CONDS = ONE 00633 ELSE IF( KCONDS( JTYPE ).EQ.2 ) THEN 00634 CONDS = RTULPI 00635 ELSE 00636 CONDS = ZERO 00637 END IF 00638 * 00639 CALL CLATME( N, 'D', ISEED, WORK, IMODE, COND, CONE, 00640 $ 'T', 'T', 'T', RWORK, 4, CONDS, N, N, ANORM, 00641 $ A, LDA, WORK( 2*N+1 ), IINFO ) 00642 * 00643 ELSE IF( ITYPE.EQ.7 ) THEN 00644 * 00645 * Diagonal, random eigenvalues 00646 * 00647 CALL CLATMR( N, N, 'D', ISEED, 'N', WORK, 6, ONE, CONE, 00648 $ 'T', 'N', WORK( N+1 ), 1, ONE, 00649 $ WORK( 2*N+1 ), 1, ONE, 'N', IDUMMA, 0, 0, 00650 $ ZERO, ANORM, 'NO', A, LDA, IWORK, IINFO ) 00651 * 00652 ELSE IF( ITYPE.EQ.8 ) THEN 00653 * 00654 * Symmetric, random eigenvalues 00655 * 00656 CALL CLATMR( N, N, 'D', ISEED, 'H', WORK, 6, ONE, CONE, 00657 $ 'T', 'N', WORK( N+1 ), 1, ONE, 00658 $ WORK( 2*N+1 ), 1, ONE, 'N', IDUMMA, N, N, 00659 $ ZERO, ANORM, 'NO', A, LDA, IWORK, IINFO ) 00660 * 00661 ELSE IF( ITYPE.EQ.9 ) THEN 00662 * 00663 * General, random eigenvalues 00664 * 00665 CALL CLATMR( N, N, 'D', ISEED, 'N', WORK, 6, ONE, CONE, 00666 $ 'T', 'N', WORK( N+1 ), 1, ONE, 00667 $ WORK( 2*N+1 ), 1, ONE, 'N', IDUMMA, N, N, 00668 $ ZERO, ANORM, 'NO', A, LDA, IWORK, IINFO ) 00669 IF( N.GE.4 ) THEN 00670 CALL CLASET( 'Full', 2, N, CZERO, CZERO, A, LDA ) 00671 CALL CLASET( 'Full', N-3, 1, CZERO, CZERO, A( 3, 1 ), 00672 $ LDA ) 00673 CALL CLASET( 'Full', N-3, 2, CZERO, CZERO, 00674 $ A( 3, N-1 ), LDA ) 00675 CALL CLASET( 'Full', 1, N, CZERO, CZERO, A( N, 1 ), 00676 $ LDA ) 00677 END IF 00678 * 00679 ELSE IF( ITYPE.EQ.10 ) THEN 00680 * 00681 * Triangular, random eigenvalues 00682 * 00683 CALL CLATMR( N, N, 'D', ISEED, 'N', WORK, 6, ONE, CONE, 00684 $ 'T', 'N', WORK( N+1 ), 1, ONE, 00685 $ WORK( 2*N+1 ), 1, ONE, 'N', IDUMMA, N, 0, 00686 $ ZERO, ANORM, 'NO', A, LDA, IWORK, IINFO ) 00687 * 00688 ELSE 00689 * 00690 IINFO = 1 00691 END IF 00692 * 00693 IF( IINFO.NE.0 ) THEN 00694 WRITE( NOUNIT, FMT = 9992 )'Generator', IINFO, N, JTYPE, 00695 $ IOLDSD 00696 INFO = ABS( IINFO ) 00697 RETURN 00698 END IF 00699 * 00700 90 CONTINUE 00701 * 00702 * Test for minimal and generous workspace 00703 * 00704 DO 220 IWK = 1, 2 00705 IF( IWK.EQ.1 ) THEN 00706 NNWORK = 3*N 00707 ELSE 00708 NNWORK = 5*N + 2*N**2 00709 END IF 00710 NNWORK = MAX( NNWORK, 1 ) 00711 * 00712 * Initialize RESULT 00713 * 00714 DO 100 J = 1, 13 00715 RESULT( J ) = -ONE 00716 100 CONTINUE 00717 * 00718 * Test with and without sorting of eigenvalues 00719 * 00720 DO 180 ISORT = 0, 1 00721 IF( ISORT.EQ.0 ) THEN 00722 SORT = 'N' 00723 RSUB = 0 00724 ELSE 00725 SORT = 'S' 00726 RSUB = 6 00727 END IF 00728 * 00729 * Compute Schur form and Schur vectors, and test them 00730 * 00731 CALL CLACPY( 'F', N, N, A, LDA, H, LDA ) 00732 CALL CGEES( 'V', SORT, CSLECT, N, H, LDA, SDIM, W, VS, 00733 $ LDVS, WORK, NNWORK, RWORK, BWORK, IINFO ) 00734 IF( IINFO.NE.0 ) THEN 00735 RESULT( 1+RSUB ) = ULPINV 00736 WRITE( NOUNIT, FMT = 9992 )'CGEES1', IINFO, N, 00737 $ JTYPE, IOLDSD 00738 INFO = ABS( IINFO ) 00739 GO TO 190 00740 END IF 00741 * 00742 * Do Test (1) or Test (7) 00743 * 00744 RESULT( 1+RSUB ) = ZERO 00745 DO 120 J = 1, N - 1 00746 DO 110 I = J + 1, N 00747 IF( H( I, J ).NE.ZERO ) 00748 $ RESULT( 1+RSUB ) = ULPINV 00749 110 CONTINUE 00750 120 CONTINUE 00751 * 00752 * Do Tests (2) and (3) or Tests (8) and (9) 00753 * 00754 LWORK = MAX( 1, 2*N*N ) 00755 CALL CHST01( N, 1, N, A, LDA, H, LDA, VS, LDVS, WORK, 00756 $ LWORK, RWORK, RES ) 00757 RESULT( 2+RSUB ) = RES( 1 ) 00758 RESULT( 3+RSUB ) = RES( 2 ) 00759 * 00760 * Do Test (4) or Test (10) 00761 * 00762 RESULT( 4+RSUB ) = ZERO 00763 DO 130 I = 1, N 00764 IF( H( I, I ).NE.W( I ) ) 00765 $ RESULT( 4+RSUB ) = ULPINV 00766 130 CONTINUE 00767 * 00768 * Do Test (5) or Test (11) 00769 * 00770 CALL CLACPY( 'F', N, N, A, LDA, HT, LDA ) 00771 CALL CGEES( 'N', SORT, CSLECT, N, HT, LDA, SDIM, WT, 00772 $ VS, LDVS, WORK, NNWORK, RWORK, BWORK, 00773 $ IINFO ) 00774 IF( IINFO.NE.0 ) THEN 00775 RESULT( 5+RSUB ) = ULPINV 00776 WRITE( NOUNIT, FMT = 9992 )'CGEES2', IINFO, N, 00777 $ JTYPE, IOLDSD 00778 INFO = ABS( IINFO ) 00779 GO TO 190 00780 END IF 00781 * 00782 RESULT( 5+RSUB ) = ZERO 00783 DO 150 J = 1, N 00784 DO 140 I = 1, N 00785 IF( H( I, J ).NE.HT( I, J ) ) 00786 $ RESULT( 5+RSUB ) = ULPINV 00787 140 CONTINUE 00788 150 CONTINUE 00789 * 00790 * Do Test (6) or Test (12) 00791 * 00792 RESULT( 6+RSUB ) = ZERO 00793 DO 160 I = 1, N 00794 IF( W( I ).NE.WT( I ) ) 00795 $ RESULT( 6+RSUB ) = ULPINV 00796 160 CONTINUE 00797 * 00798 * Do Test (13) 00799 * 00800 IF( ISORT.EQ.1 ) THEN 00801 RESULT( 13 ) = ZERO 00802 KNTEIG = 0 00803 DO 170 I = 1, N 00804 IF( CSLECT( W( I ) ) ) 00805 $ KNTEIG = KNTEIG + 1 00806 IF( I.LT.N ) THEN 00807 IF( CSLECT( W( I+1 ) ) .AND. 00808 $ ( .NOT.CSLECT( W( I ) ) ) )RESULT( 13 ) 00809 $ = ULPINV 00810 END IF 00811 170 CONTINUE 00812 IF( SDIM.NE.KNTEIG ) 00813 $ RESULT( 13 ) = ULPINV 00814 END IF 00815 * 00816 180 CONTINUE 00817 * 00818 * End of Loop -- Check for RESULT(j) > THRESH 00819 * 00820 190 CONTINUE 00821 * 00822 NTEST = 0 00823 NFAIL = 0 00824 DO 200 J = 1, 13 00825 IF( RESULT( J ).GE.ZERO ) 00826 $ NTEST = NTEST + 1 00827 IF( RESULT( J ).GE.THRESH ) 00828 $ NFAIL = NFAIL + 1 00829 200 CONTINUE 00830 * 00831 IF( NFAIL.GT.0 ) 00832 $ NTESTF = NTESTF + 1 00833 IF( NTESTF.EQ.1 ) THEN 00834 WRITE( NOUNIT, FMT = 9999 )PATH 00835 WRITE( NOUNIT, FMT = 9998 ) 00836 WRITE( NOUNIT, FMT = 9997 ) 00837 WRITE( NOUNIT, FMT = 9996 ) 00838 WRITE( NOUNIT, FMT = 9995 )THRESH 00839 WRITE( NOUNIT, FMT = 9994 ) 00840 NTESTF = 2 00841 END IF 00842 * 00843 DO 210 J = 1, 13 00844 IF( RESULT( J ).GE.THRESH ) THEN 00845 WRITE( NOUNIT, FMT = 9993 )N, IWK, IOLDSD, JTYPE, 00846 $ J, RESULT( J ) 00847 END IF 00848 210 CONTINUE 00849 * 00850 NERRS = NERRS + NFAIL 00851 NTESTT = NTESTT + NTEST 00852 * 00853 220 CONTINUE 00854 230 CONTINUE 00855 240 CONTINUE 00856 * 00857 * Summary 00858 * 00859 CALL SLASUM( PATH, NOUNIT, NERRS, NTESTT ) 00860 * 00861 9999 FORMAT( / 1X, A3, ' -- Complex Schur Form Decomposition Driver', 00862 $ / ' Matrix types (see CDRVES for details): ' ) 00863 * 00864 9998 FORMAT( / ' Special Matrices:', / ' 1=Zero matrix. ', 00865 $ ' ', ' 5=Diagonal: geometr. spaced entries.', 00866 $ / ' 2=Identity matrix. ', ' 6=Diagona', 00867 $ 'l: clustered entries.', / ' 3=Transposed Jordan block. ', 00868 $ ' ', ' 7=Diagonal: large, evenly spaced.', / ' ', 00869 $ '4=Diagonal: evenly spaced entries. ', ' 8=Diagonal: s', 00870 $ 'mall, evenly spaced.' ) 00871 9997 FORMAT( ' Dense, Non-Symmetric Matrices:', / ' 9=Well-cond., ev', 00872 $ 'enly spaced eigenvals.', ' 14=Ill-cond., geomet. spaced e', 00873 $ 'igenals.', / ' 10=Well-cond., geom. spaced eigenvals. ', 00874 $ ' 15=Ill-conditioned, clustered e.vals.', / ' 11=Well-cond', 00875 $ 'itioned, clustered e.vals. ', ' 16=Ill-cond., random comp', 00876 $ 'lex ', A6, / ' 12=Well-cond., random complex ', A6, ' ', 00877 $ ' 17=Ill-cond., large rand. complx ', A4, / ' 13=Ill-condi', 00878 $ 'tioned, evenly spaced. ', ' 18=Ill-cond., small rand.', 00879 $ ' complx ', A4 ) 00880 9996 FORMAT( ' 19=Matrix with random O(1) entries. ', ' 21=Matrix ', 00881 $ 'with small random entries.', / ' 20=Matrix with large ran', 00882 $ 'dom entries. ', / ) 00883 9995 FORMAT( ' Tests performed with test threshold =', F8.2, 00884 $ / ' ( A denotes A on input and T denotes A on output)', 00885 $ / / ' 1 = 0 if T in Schur form (no sort), ', 00886 $ ' 1/ulp otherwise', / 00887 $ ' 2 = | A - VS T transpose(VS) | / ( n |A| ulp ) (no sort)', 00888 $ / ' 3 = | I - VS transpose(VS) | / ( n ulp ) (no sort) ', 00889 $ / ' 4 = 0 if W are eigenvalues of T (no sort),', 00890 $ ' 1/ulp otherwise', / 00891 $ ' 5 = 0 if T same no matter if VS computed (no sort),', 00892 $ ' 1/ulp otherwise', / 00893 $ ' 6 = 0 if W same no matter if VS computed (no sort)', 00894 $ ', 1/ulp otherwise' ) 00895 9994 FORMAT( ' 7 = 0 if T in Schur form (sort), ', ' 1/ulp otherwise', 00896 $ / ' 8 = | A - VS T transpose(VS) | / ( n |A| ulp ) (sort)', 00897 $ / ' 9 = | I - VS transpose(VS) | / ( n ulp ) (sort) ', 00898 $ / ' 10 = 0 if W are eigenvalues of T (sort),', 00899 $ ' 1/ulp otherwise', / 00900 $ ' 11 = 0 if T same no matter if VS computed (sort),', 00901 $ ' 1/ulp otherwise', / 00902 $ ' 12 = 0 if W same no matter if VS computed (sort),', 00903 $ ' 1/ulp otherwise', / 00904 $ ' 13 = 0 if sorting succesful, 1/ulp otherwise', / ) 00905 9993 FORMAT( ' N=', I5, ', IWK=', I2, ', seed=', 4( I4, ',' ), 00906 $ ' type ', I2, ', test(', I2, ')=', G10.3 ) 00907 9992 FORMAT( ' CDRVES: ', A, ' returned INFO=', I6, '.', / 9X, 'N=', 00908 $ I6, ', JTYPE=', I6, ', ISEED=(', 3( I5, ',' ), I5, ')' ) 00909 * 00910 RETURN 00911 * 00912 * End of CDRVES 00913 * 00914 END