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