00001 SUBROUTINE CCHKHP( DOTYPE, NN, NVAL, NNS, NSVAL, THRESH, TSTERR,
00002 $ NMAX, A, AFAC, AINV, B, X, XACT, WORK, RWORK,
00003 $ IWORK, NOUT )
00004
00005
00006
00007
00008
00009
00010 LOGICAL TSTERR
00011 INTEGER NMAX, NN, NNS, NOUT
00012 REAL THRESH
00013
00014
00015 LOGICAL DOTYPE( * )
00016 INTEGER IWORK( * ), NSVAL( * ), 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
00083
00084
00085
00086
00087
00088
00089 REAL ZERO
00090 PARAMETER ( ZERO = 0.0E+0 )
00091 INTEGER NTYPES
00092 PARAMETER ( NTYPES = 10 )
00093 INTEGER NTESTS
00094 PARAMETER ( NTESTS = 8 )
00095
00096
00097 LOGICAL TRFCON, ZEROT
00098 CHARACTER DIST, PACKIT, TYPE, UPLO, XTYPE
00099 CHARACTER*3 PATH
00100 INTEGER I, I1, I2, IMAT, IN, INFO, IOFF, IRHS, IUPLO,
00101 $ IZERO, J, K, KL, KU, LDA, MODE, N, NERRS,
00102 $ NFAIL, NIMAT, NPP, NRHS, NRUN, NT
00103 REAL ANORM, CNDNUM, RCOND, RCONDC
00104
00105
00106 CHARACTER UPLOS( 2 )
00107 INTEGER ISEED( 4 ), ISEEDY( 4 )
00108 REAL RESULT( NTESTS )
00109
00110
00111 LOGICAL LSAME
00112 REAL CLANHP, SGET06
00113 EXTERNAL LSAME, CLANHP, SGET06
00114
00115
00116 EXTERNAL ALAERH, ALAHD, ALASUM, CCOPY, CERRSY, CGET04,
00117 $ CHPCON, CHPRFS, CHPT01, CHPTRF, CHPTRI, CHPTRS,
00118 $ CLACPY, CLAIPD, CLARHS, CLATB4, CLATMS, CPPT02,
00119 $ CPPT03, CPPT05
00120
00121
00122 INTRINSIC MAX, MIN
00123
00124
00125 LOGICAL LERR, OK
00126 CHARACTER*32 SRNAMT
00127 INTEGER INFOT, NUNIT
00128
00129
00130 COMMON / INFOC / INFOT, NUNIT, OK, LERR
00131 COMMON / SRNAMC / SRNAMT
00132
00133
00134 DATA ISEEDY / 1988, 1989, 1990, 1991 /
00135 DATA UPLOS / 'U', 'L' /
00136
00137
00138
00139
00140
00141 PATH( 1: 1 ) = 'Complex precision'
00142 PATH( 2: 3 ) = 'HP'
00143 NRUN = 0
00144 NFAIL = 0
00145 NERRS = 0
00146 DO 10 I = 1, 4
00147 ISEED( I ) = ISEEDY( I )
00148 10 CONTINUE
00149
00150
00151
00152 IF( TSTERR )
00153 $ CALL CERRSY( PATH, NOUT )
00154 INFOT = 0
00155
00156
00157
00158 DO 170 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 IZERO = 0
00167 DO 160 IMAT = 1, NIMAT
00168
00169
00170
00171 IF( .NOT.DOTYPE( IMAT ) )
00172 $ GO TO 160
00173
00174
00175
00176 ZEROT = IMAT.GE.3 .AND. IMAT.LE.6
00177 IF( ZEROT .AND. N.LT.IMAT-2 )
00178 $ GO TO 160
00179
00180
00181
00182 DO 150 IUPLO = 1, 2
00183 UPLO = UPLOS( IUPLO )
00184 IF( LSAME( UPLO, 'U' ) ) THEN
00185 PACKIT = 'C'
00186 ELSE
00187 PACKIT = 'R'
00188 END IF
00189
00190
00191
00192
00193 CALL CLATB4( PATH, IMAT, N, N, TYPE, KL, KU, ANORM, MODE,
00194 $ CNDNUM, DIST )
00195
00196 SRNAMT = 'CLATMS'
00197 CALL CLATMS( N, N, DIST, ISEED, TYPE, RWORK, MODE,
00198 $ CNDNUM, ANORM, KL, KU, PACKIT, A, LDA, WORK,
00199 $ INFO )
00200
00201
00202
00203 IF( INFO.NE.0 ) THEN
00204 CALL ALAERH( PATH, 'CLATMS', INFO, 0, UPLO, N, N, -1,
00205 $ -1, -1, IMAT, NFAIL, NERRS, NOUT )
00206 GO TO 150
00207 END IF
00208
00209
00210
00211
00212 IF( ZEROT ) THEN
00213 IF( IMAT.EQ.3 ) THEN
00214 IZERO = 1
00215 ELSE IF( IMAT.EQ.4 ) THEN
00216 IZERO = N
00217 ELSE
00218 IZERO = N / 2 + 1
00219 END IF
00220
00221 IF( IMAT.LT.6 ) THEN
00222
00223
00224
00225 IF( IUPLO.EQ.1 ) THEN
00226 IOFF = ( IZERO-1 )*IZERO / 2
00227 DO 20 I = 1, IZERO - 1
00228 A( IOFF+I ) = ZERO
00229 20 CONTINUE
00230 IOFF = IOFF + IZERO
00231 DO 30 I = IZERO, N
00232 A( IOFF ) = ZERO
00233 IOFF = IOFF + I
00234 30 CONTINUE
00235 ELSE
00236 IOFF = IZERO
00237 DO 40 I = 1, IZERO - 1
00238 A( IOFF ) = ZERO
00239 IOFF = IOFF + N - I
00240 40 CONTINUE
00241 IOFF = IOFF - IZERO
00242 DO 50 I = IZERO, N
00243 A( IOFF+I ) = ZERO
00244 50 CONTINUE
00245 END IF
00246 ELSE
00247 IOFF = 0
00248 IF( IUPLO.EQ.1 ) THEN
00249
00250
00251
00252 DO 70 J = 1, N
00253 I2 = MIN( J, IZERO )
00254 DO 60 I = 1, I2
00255 A( IOFF+I ) = ZERO
00256 60 CONTINUE
00257 IOFF = IOFF + J
00258 70 CONTINUE
00259 ELSE
00260
00261
00262
00263 DO 90 J = 1, N
00264 I1 = MAX( J, IZERO )
00265 DO 80 I = I1, N
00266 A( IOFF+I ) = ZERO
00267 80 CONTINUE
00268 IOFF = IOFF + N - J
00269 90 CONTINUE
00270 END IF
00271 END IF
00272 ELSE
00273 IZERO = 0
00274 END IF
00275
00276
00277
00278 IF( IUPLO.EQ.1 ) THEN
00279 CALL CLAIPD( N, A, 2, 1 )
00280 ELSE
00281 CALL CLAIPD( N, A, N, -1 )
00282 END IF
00283
00284
00285
00286 NPP = N*( N+1 ) / 2
00287 CALL CCOPY( NPP, A, 1, AFAC, 1 )
00288 SRNAMT = 'CHPTRF'
00289 CALL CHPTRF( UPLO, N, AFAC, IWORK, INFO )
00290
00291
00292
00293
00294 K = IZERO
00295 IF( K.GT.0 ) THEN
00296 100 CONTINUE
00297 IF( IWORK( K ).LT.0 ) THEN
00298 IF( IWORK( K ).NE.-K ) THEN
00299 K = -IWORK( K )
00300 GO TO 100
00301 END IF
00302 ELSE IF( IWORK( K ).NE.K ) THEN
00303 K = IWORK( K )
00304 GO TO 100
00305 END IF
00306 END IF
00307
00308
00309
00310 IF( INFO.NE.K )
00311 $ CALL ALAERH( PATH, 'CHPTRF', INFO, K, UPLO, N, N, -1,
00312 $ -1, -1, IMAT, NFAIL, NERRS, NOUT )
00313 IF( INFO.NE.0 ) THEN
00314 TRFCON = .TRUE.
00315 ELSE
00316 TRFCON = .FALSE.
00317 END IF
00318
00319
00320
00321
00322 CALL CHPT01( UPLO, N, A, AFAC, IWORK, AINV, LDA, RWORK,
00323 $ RESULT( 1 ) )
00324 NT = 1
00325
00326
00327
00328
00329 IF( .NOT.TRFCON ) THEN
00330 CALL CCOPY( NPP, AFAC, 1, AINV, 1 )
00331 SRNAMT = 'CHPTRI'
00332 CALL CHPTRI( UPLO, N, AINV, IWORK, WORK, INFO )
00333
00334
00335
00336 IF( INFO.NE.0 )
00337 $ CALL ALAERH( PATH, 'CHPTRI', INFO, 0, UPLO, N, N,
00338 $ -1, -1, -1, IMAT, NFAIL, NERRS, NOUT )
00339
00340 CALL CPPT03( UPLO, N, A, AINV, WORK, LDA, RWORK,
00341 $ RCONDC, RESULT( 2 ) )
00342 NT = 2
00343 END IF
00344
00345
00346
00347
00348 DO 110 K = 1, NT
00349 IF( RESULT( K ).GE.THRESH ) THEN
00350 IF( NFAIL.EQ.0 .AND. NERRS.EQ.0 )
00351 $ CALL ALAHD( NOUT, PATH )
00352 WRITE( NOUT, FMT = 9999 )UPLO, N, IMAT, K,
00353 $ RESULT( K )
00354 NFAIL = NFAIL + 1
00355 END IF
00356 110 CONTINUE
00357 NRUN = NRUN + NT
00358
00359
00360
00361 IF( TRFCON ) THEN
00362 RCONDC = ZERO
00363 GO TO 140
00364 END IF
00365
00366 DO 130 IRHS = 1, NNS
00367 NRHS = NSVAL( IRHS )
00368
00369
00370
00371
00372 SRNAMT = 'CLARHS'
00373 CALL CLARHS( PATH, XTYPE, UPLO, ' ', N, N, KL, KU,
00374 $ NRHS, A, LDA, XACT, LDA, B, LDA, ISEED,
00375 $ INFO )
00376 XTYPE = 'C'
00377 CALL CLACPY( 'Full', N, NRHS, B, LDA, X, LDA )
00378
00379 SRNAMT = 'CHPTRS'
00380 CALL CHPTRS( UPLO, N, NRHS, AFAC, IWORK, X, LDA,
00381 $ INFO )
00382
00383
00384
00385 IF( INFO.NE.0 )
00386 $ CALL ALAERH( PATH, 'CHPTRS', INFO, 0, UPLO, N, N,
00387 $ -1, -1, NRHS, IMAT, NFAIL, NERRS,
00388 $ NOUT )
00389
00390 CALL CLACPY( 'Full', N, NRHS, B, LDA, WORK, LDA )
00391 CALL CPPT02( UPLO, N, NRHS, A, X, LDA, WORK, LDA,
00392 $ RWORK, RESULT( 3 ) )
00393
00394
00395
00396
00397 CALL CGET04( N, NRHS, X, LDA, XACT, LDA, RCONDC,
00398 $ RESULT( 4 ) )
00399
00400
00401
00402
00403 SRNAMT = 'CHPRFS'
00404 CALL CHPRFS( UPLO, N, NRHS, A, AFAC, IWORK, B, LDA, X,
00405 $ LDA, RWORK, RWORK( NRHS+1 ), WORK,
00406 $ RWORK( 2*NRHS+1 ), INFO )
00407
00408
00409
00410 IF( INFO.NE.0 )
00411 $ CALL ALAERH( PATH, 'CHPRFS', INFO, 0, UPLO, N, N,
00412 $ -1, -1, NRHS, IMAT, NFAIL, NERRS,
00413 $ NOUT )
00414
00415 CALL CGET04( N, NRHS, X, LDA, XACT, LDA, RCONDC,
00416 $ RESULT( 5 ) )
00417 CALL CPPT05( UPLO, N, NRHS, A, B, LDA, X, LDA, XACT,
00418 $ LDA, RWORK, RWORK( NRHS+1 ),
00419 $ RESULT( 6 ) )
00420
00421
00422
00423
00424 DO 120 K = 3, 7
00425 IF( RESULT( K ).GE.THRESH ) THEN
00426 IF( NFAIL.EQ.0 .AND. NERRS.EQ.0 )
00427 $ CALL ALAHD( NOUT, PATH )
00428 WRITE( NOUT, FMT = 9998 )UPLO, N, NRHS, IMAT,
00429 $ K, RESULT( K )
00430 NFAIL = NFAIL + 1
00431 END IF
00432 120 CONTINUE
00433 NRUN = NRUN + 5
00434 130 CONTINUE
00435
00436
00437
00438
00439 140 CONTINUE
00440 ANORM = CLANHP( '1', UPLO, N, A, RWORK )
00441 SRNAMT = 'CHPCON'
00442 CALL CHPCON( UPLO, N, AFAC, IWORK, ANORM, RCOND, WORK,
00443 $ INFO )
00444
00445
00446
00447 IF( INFO.NE.0 )
00448 $ CALL ALAERH( PATH, 'CHPCON', INFO, 0, UPLO, N, N, -1,
00449 $ -1, -1, IMAT, NFAIL, NERRS, NOUT )
00450
00451 RESULT( 8 ) = SGET06( RCOND, RCONDC )
00452
00453
00454
00455 IF( RESULT( 8 ).GE.THRESH ) THEN
00456 IF( NFAIL.EQ.0 .AND. NERRS.EQ.0 )
00457 $ CALL ALAHD( NOUT, PATH )
00458 WRITE( NOUT, FMT = 9999 )UPLO, N, IMAT, 8,
00459 $ RESULT( 8 )
00460 NFAIL = NFAIL + 1
00461 END IF
00462 NRUN = NRUN + 1
00463 150 CONTINUE
00464 160 CONTINUE
00465 170 CONTINUE
00466
00467
00468
00469 CALL ALASUM( PATH, NOUT, NFAIL, NRUN, NERRS )
00470
00471 9999 FORMAT( ' UPLO = ''', A1, ''', N =', I5, ', type ', I2, ', test ',
00472 $ I2, ', ratio =', G12.5 )
00473 9998 FORMAT( ' UPLO = ''', A1, ''', N =', I5, ', NRHS=', I3, ', type ',
00474 $ I2, ', test(', I2, ') =', G12.5 )
00475 RETURN
00476
00477
00478
00479 END