LAPACK 3.3.1
Linear Algebra PACKage
|
00001 SUBROUTINE ZLATB4( PATH, IMAT, M, N, TYPE, KL, KU, ANORM, MODE, 00002 $ CNDNUM, DIST ) 00003 * 00004 * -- LAPACK test routine (version 3.1) -- 00005 * Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. 00006 * November 2006 00007 * 00008 * .. Scalar Arguments .. 00009 CHARACTER DIST, TYPE 00010 CHARACTER*3 PATH 00011 INTEGER IMAT, KL, KU, M, MODE, N 00012 DOUBLE PRECISION ANORM, CNDNUM 00013 * .. 00014 * 00015 * Purpose 00016 * ======= 00017 * 00018 * ZLATB4 sets parameters for the matrix generator based on the type of 00019 * matrix to be generated. 00020 * 00021 * Arguments 00022 * ========= 00023 * 00024 * PATH (input) CHARACTER*3 00025 * The LAPACK path name. 00026 * 00027 * IMAT (input) INTEGER 00028 * An integer key describing which matrix to generate for this 00029 * path. 00030 * 00031 * M (input) INTEGER 00032 * The number of rows in the matrix to be generated. 00033 * 00034 * N (input) INTEGER 00035 * The number of columns in the matrix to be generated. 00036 * 00037 * TYPE (output) CHARACTER*1 00038 * The type of the matrix to be generated: 00039 * = 'S': symmetric matrix 00040 * = 'P': symmetric positive (semi)definite matrix 00041 * = 'N': nonsymmetric matrix 00042 * 00043 * KL (output) INTEGER 00044 * The lower band width of the matrix to be generated. 00045 * 00046 * KU (output) INTEGER 00047 * The upper band width of the matrix to be generated. 00048 * 00049 * ANORM (output) DOUBLE PRECISION 00050 * The desired norm of the matrix to be generated. The diagonal 00051 * matrix of singular values or eigenvalues is scaled by this 00052 * value. 00053 * 00054 * MODE (output) INTEGER 00055 * A key indicating how to choose the vector of eigenvalues. 00056 * 00057 * CNDNUM (output) DOUBLE PRECISION 00058 * The desired condition number. 00059 * 00060 * DIST (output) CHARACTER*1 00061 * The type of distribution to be used by the random number 00062 * generator. 00063 * 00064 * ===================================================================== 00065 * 00066 * .. Parameters .. 00067 DOUBLE PRECISION SHRINK, TENTH 00068 PARAMETER ( SHRINK = 0.25D0, TENTH = 0.1D+0 ) 00069 DOUBLE PRECISION ONE 00070 PARAMETER ( ONE = 1.0D+0 ) 00071 DOUBLE PRECISION TWO 00072 PARAMETER ( TWO = 2.0D+0 ) 00073 * .. 00074 * .. Local Scalars .. 00075 LOGICAL FIRST 00076 CHARACTER*2 C2 00077 INTEGER MAT 00078 DOUBLE PRECISION BADC1, BADC2, EPS, LARGE, SMALL 00079 * .. 00080 * .. External Functions .. 00081 LOGICAL LSAMEN 00082 DOUBLE PRECISION DLAMCH 00083 EXTERNAL LSAMEN, DLAMCH 00084 * .. 00085 * .. Intrinsic Functions .. 00086 INTRINSIC ABS, MAX, SQRT 00087 * .. 00088 * .. External Subroutines .. 00089 EXTERNAL DLABAD 00090 * .. 00091 * .. Save statement .. 00092 SAVE EPS, SMALL, LARGE, BADC1, BADC2, FIRST 00093 * .. 00094 * .. Data statements .. 00095 DATA FIRST / .TRUE. / 00096 * .. 00097 * .. Executable Statements .. 00098 * 00099 * Set some constants for use in the subroutine. 00100 * 00101 IF( FIRST ) THEN 00102 FIRST = .FALSE. 00103 EPS = DLAMCH( 'Precision' ) 00104 BADC2 = TENTH / EPS 00105 BADC1 = SQRT( BADC2 ) 00106 SMALL = DLAMCH( 'Safe minimum' ) 00107 LARGE = ONE / SMALL 00108 * 00109 * If it looks like we're on a Cray, take the square root of 00110 * SMALL and LARGE to avoid overflow and underflow problems. 00111 * 00112 CALL DLABAD( SMALL, LARGE ) 00113 SMALL = SHRINK*( SMALL / EPS ) 00114 LARGE = ONE / SMALL 00115 END IF 00116 * 00117 C2 = PATH( 2: 3 ) 00118 * 00119 * Set some parameters we don't plan to change. 00120 * 00121 DIST = 'S' 00122 MODE = 3 00123 * 00124 * xQR, xLQ, xQL, xRQ: Set parameters to generate a general 00125 * M x N matrix. 00126 * 00127 IF( LSAMEN( 2, C2, 'QR' ) .OR. LSAMEN( 2, C2, 'LQ' ) .OR. 00128 $ LSAMEN( 2, C2, 'QL' ) .OR. LSAMEN( 2, C2, 'RQ' ) ) THEN 00129 * 00130 * Set TYPE, the type of matrix to be generated. 00131 * 00132 TYPE = 'N' 00133 * 00134 * Set the lower and upper bandwidths. 00135 * 00136 IF( IMAT.EQ.1 ) THEN 00137 KL = 0 00138 KU = 0 00139 ELSE IF( IMAT.EQ.2 ) THEN 00140 KL = 0 00141 KU = MAX( N-1, 0 ) 00142 ELSE IF( IMAT.EQ.3 ) THEN 00143 KL = MAX( M-1, 0 ) 00144 KU = 0 00145 ELSE 00146 KL = MAX( M-1, 0 ) 00147 KU = MAX( N-1, 0 ) 00148 END IF 00149 * 00150 * Set the condition number and norm. 00151 * 00152 IF( IMAT.EQ.5 ) THEN 00153 CNDNUM = BADC1 00154 ELSE IF( IMAT.EQ.6 ) THEN 00155 CNDNUM = BADC2 00156 ELSE 00157 CNDNUM = TWO 00158 END IF 00159 * 00160 IF( IMAT.EQ.7 ) THEN 00161 ANORM = SMALL 00162 ELSE IF( IMAT.EQ.8 ) THEN 00163 ANORM = LARGE 00164 ELSE 00165 ANORM = ONE 00166 END IF 00167 * 00168 ELSE IF( LSAMEN( 2, C2, 'GE' ) ) THEN 00169 * 00170 * xGE: Set parameters to generate a general M x N matrix. 00171 * 00172 * Set TYPE, the type of matrix to be generated. 00173 * 00174 TYPE = 'N' 00175 * 00176 * Set the lower and upper bandwidths. 00177 * 00178 IF( IMAT.EQ.1 ) THEN 00179 KL = 0 00180 KU = 0 00181 ELSE IF( IMAT.EQ.2 ) THEN 00182 KL = 0 00183 KU = MAX( N-1, 0 ) 00184 ELSE IF( IMAT.EQ.3 ) THEN 00185 KL = MAX( M-1, 0 ) 00186 KU = 0 00187 ELSE 00188 KL = MAX( M-1, 0 ) 00189 KU = MAX( N-1, 0 ) 00190 END IF 00191 * 00192 * Set the condition number and norm. 00193 * 00194 IF( IMAT.EQ.8 ) THEN 00195 CNDNUM = BADC1 00196 ELSE IF( IMAT.EQ.9 ) THEN 00197 CNDNUM = BADC2 00198 ELSE 00199 CNDNUM = TWO 00200 END IF 00201 * 00202 IF( IMAT.EQ.10 ) THEN 00203 ANORM = SMALL 00204 ELSE IF( IMAT.EQ.11 ) THEN 00205 ANORM = LARGE 00206 ELSE 00207 ANORM = ONE 00208 END IF 00209 * 00210 ELSE IF( LSAMEN( 2, C2, 'GB' ) ) THEN 00211 * 00212 * xGB: Set parameters to generate a general banded matrix. 00213 * 00214 * Set TYPE, the type of matrix to be generated. 00215 * 00216 TYPE = 'N' 00217 * 00218 * Set the condition number and norm. 00219 * 00220 IF( IMAT.EQ.5 ) THEN 00221 CNDNUM = BADC1 00222 ELSE IF( IMAT.EQ.6 ) THEN 00223 CNDNUM = TENTH*BADC2 00224 ELSE 00225 CNDNUM = TWO 00226 END IF 00227 * 00228 IF( IMAT.EQ.7 ) THEN 00229 ANORM = SMALL 00230 ELSE IF( IMAT.EQ.8 ) THEN 00231 ANORM = LARGE 00232 ELSE 00233 ANORM = ONE 00234 END IF 00235 * 00236 ELSE IF( LSAMEN( 2, C2, 'GT' ) ) THEN 00237 * 00238 * xGT: Set parameters to generate a general tridiagonal matrix. 00239 * 00240 * Set TYPE, the type of matrix to be generated. 00241 * 00242 TYPE = 'N' 00243 * 00244 * Set the lower and upper bandwidths. 00245 * 00246 IF( IMAT.EQ.1 ) THEN 00247 KL = 0 00248 ELSE 00249 KL = 1 00250 END IF 00251 KU = KL 00252 * 00253 * Set the condition number and norm. 00254 * 00255 IF( IMAT.EQ.3 ) THEN 00256 CNDNUM = BADC1 00257 ELSE IF( IMAT.EQ.4 ) THEN 00258 CNDNUM = BADC2 00259 ELSE 00260 CNDNUM = TWO 00261 END IF 00262 * 00263 IF( IMAT.EQ.5 .OR. IMAT.EQ.11 ) THEN 00264 ANORM = SMALL 00265 ELSE IF( IMAT.EQ.6 .OR. IMAT.EQ.12 ) THEN 00266 ANORM = LARGE 00267 ELSE 00268 ANORM = ONE 00269 END IF 00270 * 00271 ELSE IF( LSAMEN( 2, C2, 'PO' ) .OR. LSAMEN( 2, C2, 'PP' ) .OR. 00272 $ LSAMEN( 2, C2, 'HE' ) .OR. LSAMEN( 2, C2, 'HP' ) .OR. 00273 $ LSAMEN( 2, C2, 'SY' ) .OR. LSAMEN( 2, C2, 'SP' ) ) THEN 00274 * 00275 * xPO, xPP, xHE, xHP, xSY, xSP: Set parameters to generate a 00276 * symmetric or Hermitian matrix. 00277 * 00278 * Set TYPE, the type of matrix to be generated. 00279 * 00280 TYPE = C2( 1: 1 ) 00281 * 00282 * Set the lower and upper bandwidths. 00283 * 00284 IF( IMAT.EQ.1 ) THEN 00285 KL = 0 00286 ELSE 00287 KL = MAX( N-1, 0 ) 00288 END IF 00289 KU = KL 00290 * 00291 * Set the condition number and norm. 00292 * 00293 IF( IMAT.EQ.6 ) THEN 00294 CNDNUM = BADC1 00295 ELSE IF( IMAT.EQ.7 ) THEN 00296 CNDNUM = BADC2 00297 ELSE 00298 CNDNUM = TWO 00299 END IF 00300 * 00301 IF( IMAT.EQ.8 ) THEN 00302 ANORM = SMALL 00303 ELSE IF( IMAT.EQ.9 ) THEN 00304 ANORM = LARGE 00305 ELSE 00306 ANORM = ONE 00307 END IF 00308 * 00309 ELSE IF( LSAMEN( 2, C2, 'PB' ) ) THEN 00310 * 00311 * xPB: Set parameters to generate a symmetric band matrix. 00312 * 00313 * Set TYPE, the type of matrix to be generated. 00314 * 00315 TYPE = 'P' 00316 * 00317 * Set the norm and condition number. 00318 * 00319 IF( IMAT.EQ.5 ) THEN 00320 CNDNUM = BADC1 00321 ELSE IF( IMAT.EQ.6 ) THEN 00322 CNDNUM = BADC2 00323 ELSE 00324 CNDNUM = TWO 00325 END IF 00326 * 00327 IF( IMAT.EQ.7 ) THEN 00328 ANORM = SMALL 00329 ELSE IF( IMAT.EQ.8 ) THEN 00330 ANORM = LARGE 00331 ELSE 00332 ANORM = ONE 00333 END IF 00334 * 00335 ELSE IF( LSAMEN( 2, C2, 'PT' ) ) THEN 00336 * 00337 * xPT: Set parameters to generate a symmetric positive definite 00338 * tridiagonal matrix. 00339 * 00340 TYPE = 'P' 00341 IF( IMAT.EQ.1 ) THEN 00342 KL = 0 00343 ELSE 00344 KL = 1 00345 END IF 00346 KU = KL 00347 * 00348 * Set the condition number and norm. 00349 * 00350 IF( IMAT.EQ.3 ) THEN 00351 CNDNUM = BADC1 00352 ELSE IF( IMAT.EQ.4 ) THEN 00353 CNDNUM = BADC2 00354 ELSE 00355 CNDNUM = TWO 00356 END IF 00357 * 00358 IF( IMAT.EQ.5 .OR. IMAT.EQ.11 ) THEN 00359 ANORM = SMALL 00360 ELSE IF( IMAT.EQ.6 .OR. IMAT.EQ.12 ) THEN 00361 ANORM = LARGE 00362 ELSE 00363 ANORM = ONE 00364 END IF 00365 * 00366 ELSE IF( LSAMEN( 2, C2, 'TR' ) .OR. LSAMEN( 2, C2, 'TP' ) ) THEN 00367 * 00368 * xTR, xTP: Set parameters to generate a triangular matrix 00369 * 00370 * Set TYPE, the type of matrix to be generated. 00371 * 00372 TYPE = 'N' 00373 * 00374 * Set the lower and upper bandwidths. 00375 * 00376 MAT = ABS( IMAT ) 00377 IF( MAT.EQ.1 .OR. MAT.EQ.7 ) THEN 00378 KL = 0 00379 KU = 0 00380 ELSE IF( IMAT.LT.0 ) THEN 00381 KL = MAX( N-1, 0 ) 00382 KU = 0 00383 ELSE 00384 KL = 0 00385 KU = MAX( N-1, 0 ) 00386 END IF 00387 * 00388 * Set the condition number and norm. 00389 * 00390 IF( MAT.EQ.3 .OR. MAT.EQ.9 ) THEN 00391 CNDNUM = BADC1 00392 ELSE IF( MAT.EQ.4 .OR. MAT.EQ.10 ) THEN 00393 CNDNUM = BADC2 00394 ELSE 00395 CNDNUM = TWO 00396 END IF 00397 * 00398 IF( MAT.EQ.5 ) THEN 00399 ANORM = SMALL 00400 ELSE IF( MAT.EQ.6 ) THEN 00401 ANORM = LARGE 00402 ELSE 00403 ANORM = ONE 00404 END IF 00405 * 00406 ELSE IF( LSAMEN( 2, C2, 'TB' ) ) THEN 00407 * 00408 * xTB: Set parameters to generate a triangular band matrix. 00409 * 00410 * Set TYPE, the type of matrix to be generated. 00411 * 00412 TYPE = 'N' 00413 * 00414 * Set the norm and condition number. 00415 * 00416 IF( IMAT.EQ.2 .OR. IMAT.EQ.8 ) THEN 00417 CNDNUM = BADC1 00418 ELSE IF( IMAT.EQ.3 .OR. IMAT.EQ.9 ) THEN 00419 CNDNUM = BADC2 00420 ELSE 00421 CNDNUM = TWO 00422 END IF 00423 * 00424 IF( IMAT.EQ.4 ) THEN 00425 ANORM = SMALL 00426 ELSE IF( IMAT.EQ.5 ) THEN 00427 ANORM = LARGE 00428 ELSE 00429 ANORM = ONE 00430 END IF 00431 END IF 00432 IF( N.LE.1 ) 00433 $ CNDNUM = ONE 00434 * 00435 RETURN 00436 * 00437 * End of ZLATB4 00438 * 00439 END