00001 SUBROUTINE CDRVHE( DOTYPE, NN, NVAL, NRHS, THRESH, TSTERR, NMAX,
00002 $ A, AFAC, AINV, B, X, XACT, WORK, RWORK, IWORK,
00003 $ NOUT )
00004
00005
00006
00007
00008
00009
00010 LOGICAL TSTERR
00011 INTEGER NMAX, NN, NOUT, NRHS
00012 REAL THRESH
00013
00014
00015 LOGICAL DOTYPE( * )
00016 INTEGER IWORK( * ), NVAL( * )
00017 REAL RWORK( * )
00018 COMPLEX A( * ), AFAC( * ), AINV( * ), B( * ),
00019 $ WORK( * ), X( * ), XACT( * )
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082 REAL ONE, ZERO
00083 PARAMETER ( ONE = 1.0E+0, ZERO = 0.0E+0 )
00084 INTEGER NTYPES, NTESTS
00085 PARAMETER ( NTYPES = 10, NTESTS = 6 )
00086 INTEGER NFACT
00087 PARAMETER ( NFACT = 2 )
00088
00089
00090 LOGICAL ZEROT
00091 CHARACTER DIST, FACT, TYPE, UPLO, XTYPE
00092 CHARACTER*3 PATH
00093 INTEGER I, I1, I2, IFACT, IMAT, IN, INFO, IOFF, IUPLO,
00094 $ IZERO, J, K, K1, KL, KU, LDA, LWORK, MODE, N,
00095 $ NB, NBMIN, NERRS, NFAIL, NIMAT, NRUN, NT
00096 REAL AINVNM, ANORM, CNDNUM, RCOND, RCONDC
00097
00098
00099 CHARACTER FACTS( NFACT ), UPLOS( 2 )
00100 INTEGER ISEED( 4 ), ISEEDY( 4 )
00101 REAL RESULT( NTESTS )
00102
00103
00104 REAL CLANHE, SGET06
00105 EXTERNAL CLANHE, SGET06
00106
00107
00108 EXTERNAL ALADHD, ALAERH, ALASVM, CERRVX, CGET04, CHESV,
00109 $ CHESVX, CHET01, CHETRF, CHETRI, CLACPY, CLAIPD,
00110 $ CLARHS, CLASET, CLATB4, CLATMS, CPOT02, CPOT05,
00111 $ XLAENV
00112
00113
00114 LOGICAL LERR, OK
00115 CHARACTER*32 SRNAMT
00116 INTEGER INFOT, NUNIT
00117
00118
00119 COMMON / INFOC / INFOT, NUNIT, OK, LERR
00120 COMMON / SRNAMC / SRNAMT
00121
00122
00123 INTRINSIC CMPLX, MAX, MIN
00124
00125
00126 DATA ISEEDY / 1988, 1989, 1990, 1991 /
00127 DATA UPLOS / 'U', 'L' / , FACTS / 'F', 'N' /
00128
00129
00130
00131
00132
00133 PATH( 1: 1 ) = 'C'
00134 PATH( 2: 3 ) = 'HE'
00135 NRUN = 0
00136 NFAIL = 0
00137 NERRS = 0
00138 DO 10 I = 1, 4
00139 ISEED( I ) = ISEEDY( I )
00140 10 CONTINUE
00141 LWORK = MAX( 2*NMAX, NMAX*NRHS )
00142
00143
00144
00145 IF( TSTERR )
00146 $ CALL CERRVX( PATH, NOUT )
00147 INFOT = 0
00148
00149
00150
00151 NB = 1
00152 NBMIN = 2
00153 CALL XLAENV( 1, NB )
00154 CALL XLAENV( 2, NBMIN )
00155
00156
00157
00158 DO 180 IN = 1, NN
00159 N = NVAL( IN )
00160 LDA = MAX( N, 1 )
00161 XTYPE = 'N'
00162 NIMAT = NTYPES
00163 IF( N.LE.0 )
00164 $ NIMAT = 1
00165
00166 DO 170 IMAT = 1, NIMAT
00167
00168
00169
00170 IF( .NOT.DOTYPE( IMAT ) )
00171 $ GO TO 170
00172
00173
00174
00175 ZEROT = IMAT.GE.3 .AND. IMAT.LE.6
00176 IF( ZEROT .AND. N.LT.IMAT-2 )
00177 $ GO TO 170
00178
00179
00180
00181 DO 160 IUPLO = 1, 2
00182 UPLO = UPLOS( IUPLO )
00183
00184
00185
00186
00187 CALL CLATB4( PATH, IMAT, N, N, TYPE, KL, KU, ANORM, MODE,
00188 $ CNDNUM, DIST )
00189
00190 SRNAMT = 'CLATMS'
00191 CALL CLATMS( N, N, DIST, ISEED, TYPE, RWORK, MODE,
00192 $ CNDNUM, ANORM, KL, KU, UPLO, A, LDA, WORK,
00193 $ INFO )
00194
00195
00196
00197 IF( INFO.NE.0 ) THEN
00198 CALL ALAERH( PATH, 'CLATMS', INFO, 0, UPLO, N, N, -1,
00199 $ -1, -1, IMAT, NFAIL, NERRS, NOUT )
00200 GO TO 160
00201 END IF
00202
00203
00204
00205
00206 IF( ZEROT ) THEN
00207 IF( IMAT.EQ.3 ) THEN
00208 IZERO = 1
00209 ELSE IF( IMAT.EQ.4 ) THEN
00210 IZERO = N
00211 ELSE
00212 IZERO = N / 2 + 1
00213 END IF
00214
00215 IF( IMAT.LT.6 ) THEN
00216
00217
00218
00219 IF( IUPLO.EQ.1 ) THEN
00220 IOFF = ( IZERO-1 )*LDA
00221 DO 20 I = 1, IZERO - 1
00222 A( IOFF+I ) = ZERO
00223 20 CONTINUE
00224 IOFF = IOFF + IZERO
00225 DO 30 I = IZERO, N
00226 A( IOFF ) = ZERO
00227 IOFF = IOFF + LDA
00228 30 CONTINUE
00229 ELSE
00230 IOFF = IZERO
00231 DO 40 I = 1, IZERO - 1
00232 A( IOFF ) = ZERO
00233 IOFF = IOFF + LDA
00234 40 CONTINUE
00235 IOFF = IOFF - IZERO
00236 DO 50 I = IZERO, N
00237 A( IOFF+I ) = ZERO
00238 50 CONTINUE
00239 END IF
00240 ELSE
00241 IOFF = 0
00242 IF( IUPLO.EQ.1 ) THEN
00243
00244
00245
00246 DO 70 J = 1, N
00247 I2 = MIN( J, IZERO )
00248 DO 60 I = 1, I2
00249 A( IOFF+I ) = ZERO
00250 60 CONTINUE
00251 IOFF = IOFF + LDA
00252 70 CONTINUE
00253 ELSE
00254
00255
00256
00257 DO 90 J = 1, N
00258 I1 = MAX( J, IZERO )
00259 DO 80 I = I1, N
00260 A( IOFF+I ) = ZERO
00261 80 CONTINUE
00262 IOFF = IOFF + LDA
00263 90 CONTINUE
00264 END IF
00265 END IF
00266 ELSE
00267 IZERO = 0
00268 END IF
00269
00270
00271
00272 CALL CLAIPD( N, A, LDA+1, 0 )
00273
00274 DO 150 IFACT = 1, NFACT
00275
00276
00277
00278 FACT = FACTS( IFACT )
00279
00280
00281
00282
00283 IF( ZEROT ) THEN
00284 IF( IFACT.EQ.1 )
00285 $ GO TO 150
00286 RCONDC = ZERO
00287
00288 ELSE IF( IFACT.EQ.1 ) THEN
00289
00290
00291
00292 ANORM = CLANHE( '1', UPLO, N, A, LDA, RWORK )
00293
00294
00295
00296 CALL CLACPY( UPLO, N, N, A, LDA, AFAC, LDA )
00297 CALL CHETRF( UPLO, N, AFAC, LDA, IWORK, WORK,
00298 $ LWORK, INFO )
00299
00300
00301
00302 CALL CLACPY( UPLO, N, N, AFAC, LDA, AINV, LDA )
00303 CALL CHETRI( UPLO, N, AINV, LDA, IWORK, WORK,
00304 $ INFO )
00305 AINVNM = CLANHE( '1', UPLO, N, AINV, LDA, RWORK )
00306
00307
00308
00309 IF( ANORM.LE.ZERO .OR. AINVNM.LE.ZERO ) THEN
00310 RCONDC = ONE
00311 ELSE
00312 RCONDC = ( ONE / ANORM ) / AINVNM
00313 END IF
00314 END IF
00315
00316
00317
00318 SRNAMT = 'CLARHS'
00319 CALL CLARHS( PATH, XTYPE, UPLO, ' ', N, N, KL, KU,
00320 $ NRHS, A, LDA, XACT, LDA, B, LDA, ISEED,
00321 $ INFO )
00322 XTYPE = 'C'
00323
00324
00325
00326 IF( IFACT.EQ.2 ) THEN
00327 CALL CLACPY( UPLO, N, N, A, LDA, AFAC, LDA )
00328 CALL CLACPY( 'Full', N, NRHS, B, LDA, X, LDA )
00329
00330
00331
00332 SRNAMT = 'CHESV '
00333 CALL CHESV( UPLO, N, NRHS, AFAC, LDA, IWORK, X,
00334 $ LDA, WORK, LWORK, INFO )
00335
00336
00337
00338
00339 K = IZERO
00340 IF( K.GT.0 ) THEN
00341 100 CONTINUE
00342 IF( IWORK( K ).LT.0 ) THEN
00343 IF( IWORK( K ).NE.-K ) THEN
00344 K = -IWORK( K )
00345 GO TO 100
00346 END IF
00347 ELSE IF( IWORK( K ).NE.K ) THEN
00348 K = IWORK( K )
00349 GO TO 100
00350 END IF
00351 END IF
00352
00353
00354
00355 IF( INFO.NE.K ) THEN
00356 CALL ALAERH( PATH, 'CHESV ', INFO, K, UPLO, N,
00357 $ N, -1, -1, NRHS, IMAT, NFAIL,
00358 $ NERRS, NOUT )
00359 GO TO 120
00360 ELSE IF( INFO.NE.0 ) THEN
00361 GO TO 120
00362 END IF
00363
00364
00365
00366
00367 CALL CHET01( UPLO, N, A, LDA, AFAC, LDA, IWORK,
00368 $ AINV, LDA, RWORK, RESULT( 1 ) )
00369
00370
00371
00372 CALL CLACPY( 'Full', N, NRHS, B, LDA, WORK, LDA )
00373 CALL CPOT02( UPLO, N, NRHS, A, LDA, X, LDA, WORK,
00374 $ LDA, RWORK, RESULT( 2 ) )
00375
00376
00377
00378 CALL CGET04( N, NRHS, X, LDA, XACT, LDA, RCONDC,
00379 $ RESULT( 3 ) )
00380 NT = 3
00381
00382
00383
00384
00385 DO 110 K = 1, NT
00386 IF( RESULT( K ).GE.THRESH ) THEN
00387 IF( NFAIL.EQ.0 .AND. NERRS.EQ.0 )
00388 $ CALL ALADHD( NOUT, PATH )
00389 WRITE( NOUT, FMT = 9999 )'CHESV ', UPLO, N,
00390 $ IMAT, K, RESULT( K )
00391 NFAIL = NFAIL + 1
00392 END IF
00393 110 CONTINUE
00394 NRUN = NRUN + NT
00395 120 CONTINUE
00396 END IF
00397
00398
00399
00400 IF( IFACT.EQ.2 )
00401 $ CALL CLASET( UPLO, N, N, CMPLX( ZERO ),
00402 $ CMPLX( ZERO ), AFAC, LDA )
00403 CALL CLASET( 'Full', N, NRHS, CMPLX( ZERO ),
00404 $ CMPLX( ZERO ), X, LDA )
00405
00406
00407
00408
00409 SRNAMT = 'CHESVX'
00410 CALL CHESVX( FACT, UPLO, N, NRHS, A, LDA, AFAC, LDA,
00411 $ IWORK, B, LDA, X, LDA, RCOND, RWORK,
00412 $ RWORK( NRHS+1 ), WORK, LWORK,
00413 $ RWORK( 2*NRHS+1 ), INFO )
00414
00415
00416
00417
00418 K = IZERO
00419 IF( K.GT.0 ) THEN
00420 130 CONTINUE
00421 IF( IWORK( K ).LT.0 ) THEN
00422 IF( IWORK( K ).NE.-K ) THEN
00423 K = -IWORK( K )
00424 GO TO 130
00425 END IF
00426 ELSE IF( IWORK( K ).NE.K ) THEN
00427 K = IWORK( K )
00428 GO TO 130
00429 END IF
00430 END IF
00431
00432
00433
00434 IF( INFO.NE.K ) THEN
00435 CALL ALAERH( PATH, 'CHESVX', INFO, K, FACT // UPLO,
00436 $ N, N, -1, -1, NRHS, IMAT, NFAIL,
00437 $ NERRS, NOUT )
00438 GO TO 150
00439 END IF
00440
00441 IF( INFO.EQ.0 ) THEN
00442 IF( IFACT.GE.2 ) THEN
00443
00444
00445
00446
00447 CALL CHET01( UPLO, N, A, LDA, AFAC, LDA, IWORK,
00448 $ AINV, LDA, RWORK( 2*NRHS+1 ),
00449 $ RESULT( 1 ) )
00450 K1 = 1
00451 ELSE
00452 K1 = 2
00453 END IF
00454
00455
00456
00457 CALL CLACPY( 'Full', N, NRHS, B, LDA, WORK, LDA )
00458 CALL CPOT02( UPLO, N, NRHS, A, LDA, X, LDA, WORK,
00459 $ LDA, RWORK( 2*NRHS+1 ), RESULT( 2 ) )
00460
00461
00462
00463 CALL CGET04( N, NRHS, X, LDA, XACT, LDA, RCONDC,
00464 $ RESULT( 3 ) )
00465
00466
00467
00468 CALL CPOT05( UPLO, N, NRHS, A, LDA, B, LDA, X, LDA,
00469 $ XACT, LDA, RWORK, RWORK( NRHS+1 ),
00470 $ RESULT( 4 ) )
00471 ELSE
00472 K1 = 6
00473 END IF
00474
00475
00476
00477
00478 RESULT( 6 ) = SGET06( RCOND, RCONDC )
00479
00480
00481
00482
00483 DO 140 K = K1, 6
00484 IF( RESULT( K ).GE.THRESH ) THEN
00485 IF( NFAIL.EQ.0 .AND. NERRS.EQ.0 )
00486 $ CALL ALADHD( NOUT, PATH )
00487 WRITE( NOUT, FMT = 9998 )'CHESVX', FACT, UPLO,
00488 $ N, IMAT, K, RESULT( K )
00489 NFAIL = NFAIL + 1
00490 END IF
00491 140 CONTINUE
00492 NRUN = NRUN + 7 - K1
00493
00494 150 CONTINUE
00495
00496 160 CONTINUE
00497 170 CONTINUE
00498 180 CONTINUE
00499
00500
00501
00502 CALL ALASVM( PATH, NOUT, NFAIL, NRUN, NERRS )
00503
00504 9999 FORMAT( 1X, A, ', UPLO=''', A1, ''', N =', I5, ', type ', I2,
00505 $ ', test ', I2, ', ratio =', G12.5 )
00506 9998 FORMAT( 1X, A, ', FACT=''', A1, ''', UPLO=''', A1, ''', N =', I5,
00507 $ ', type ', I2, ', test ', I2, ', ratio =', G12.5 )
00508 RETURN
00509
00510
00511
00512 END