00001 SUBROUTINE DCHKGB( DOTYPE, NM, MVAL, NN, NVAL, NNB, NBVAL, NNS,
00002 $ NSVAL, THRESH, TSTERR, A, LA, AFAC, LAFAC, B,
00003 $ X, XACT, WORK, RWORK, IWORK, NOUT )
00004
00005
00006
00007
00008
00009
00010 LOGICAL TSTERR
00011 INTEGER LA, LAFAC, NM, NN, NNB, NNS, NOUT
00012 DOUBLE PRECISION THRESH
00013
00014
00015 LOGICAL DOTYPE( * )
00016 INTEGER IWORK( * ), MVAL( * ), NBVAL( * ), NSVAL( * ),
00017 $ NVAL( * )
00018 DOUBLE PRECISION A( * ), AFAC( * ), B( * ), RWORK( * ),
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
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104 DOUBLE PRECISION ONE, ZERO
00105 PARAMETER ( ONE = 1.0D+0, ZERO = 0.0D+0 )
00106 INTEGER NTYPES, NTESTS
00107 PARAMETER ( NTYPES = 8, NTESTS = 7 )
00108 INTEGER NBW, NTRAN
00109 PARAMETER ( NBW = 4, NTRAN = 3 )
00110
00111
00112 LOGICAL TRFCON, ZEROT
00113 CHARACTER DIST, NORM, TRANS, TYPE, XTYPE
00114 CHARACTER*3 PATH
00115 INTEGER I, I1, I2, IKL, IKU, IM, IMAT, IN, INB, INFO,
00116 $ IOFF, IRHS, ITRAN, IZERO, J, K, KL, KOFF, KU,
00117 $ LDA, LDAFAC, LDB, M, MODE, N, NB, NERRS, NFAIL,
00118 $ NIMAT, NKL, NKU, NRHS, NRUN
00119 DOUBLE PRECISION AINVNM, ANORM, ANORMI, ANORMO, CNDNUM, RCOND,
00120 $ RCONDC, RCONDI, RCONDO
00121
00122
00123 CHARACTER TRANSS( NTRAN )
00124 INTEGER ISEED( 4 ), ISEEDY( 4 ), KLVAL( NBW ),
00125 $ KUVAL( NBW )
00126 DOUBLE PRECISION RESULT( NTESTS )
00127
00128
00129 DOUBLE PRECISION DGET06, DLANGB, DLANGE
00130 EXTERNAL DGET06, DLANGB, DLANGE
00131
00132
00133 EXTERNAL ALAERH, ALAHD, ALASUM, DCOPY, DERRGE, DGBCON,
00134 $ DGBRFS, DGBT01, DGBT02, DGBT05, DGBTRF, DGBTRS,
00135 $ DGET04, DLACPY, DLARHS, DLASET, DLATB4, DLATMS,
00136 $ XLAENV
00137
00138
00139 INTRINSIC MAX, MIN
00140
00141
00142 LOGICAL LERR, OK
00143 CHARACTER*32 SRNAMT
00144 INTEGER INFOT, NUNIT
00145
00146
00147 COMMON / INFOC / INFOT, NUNIT, OK, LERR
00148 COMMON / SRNAMC / SRNAMT
00149
00150
00151 DATA ISEEDY / 1988, 1989, 1990, 1991 / ,
00152 $ TRANSS / 'N', 'T', 'C' /
00153
00154
00155
00156
00157
00158 PATH( 1: 1 ) = 'Double precision'
00159 PATH( 2: 3 ) = 'GB'
00160 NRUN = 0
00161 NFAIL = 0
00162 NERRS = 0
00163 DO 10 I = 1, 4
00164 ISEED( I ) = ISEEDY( I )
00165 10 CONTINUE
00166
00167
00168
00169 IF( TSTERR )
00170 $ CALL DERRGE( PATH, NOUT )
00171 INFOT = 0
00172 CALL XLAENV( 2, 2 )
00173
00174
00175
00176 KLVAL( 1 ) = 0
00177 KUVAL( 1 ) = 0
00178
00179
00180
00181 DO 160 IM = 1, NM
00182 M = MVAL( IM )
00183
00184
00185
00186 KLVAL( 2 ) = M + ( M+1 ) / 4
00187
00188
00189
00190 KLVAL( 3 ) = ( 3*M-1 ) / 4
00191 KLVAL( 4 ) = ( M+1 ) / 4
00192
00193
00194
00195 DO 150 IN = 1, NN
00196 N = NVAL( IN )
00197 XTYPE = 'N'
00198
00199
00200
00201 KUVAL( 2 ) = N + ( N+1 ) / 4
00202
00203
00204
00205 KUVAL( 3 ) = ( 3*N-1 ) / 4
00206 KUVAL( 4 ) = ( N+1 ) / 4
00207
00208
00209
00210 NKL = MIN( M+1, 4 )
00211 IF( N.EQ.0 )
00212 $ NKL = 2
00213 NKU = MIN( N+1, 4 )
00214 IF( M.EQ.0 )
00215 $ NKU = 2
00216 NIMAT = NTYPES
00217 IF( M.LE.0 .OR. N.LE.0 )
00218 $ NIMAT = 1
00219
00220 DO 140 IKL = 1, NKL
00221
00222
00223
00224
00225
00226 KL = KLVAL( IKL )
00227 DO 130 IKU = 1, NKU
00228
00229
00230
00231
00232
00233 KU = KUVAL( IKU )
00234
00235
00236
00237
00238 LDA = KL + KU + 1
00239 LDAFAC = 2*KL + KU + 1
00240 IF( ( LDA*N ).GT.LA .OR. ( LDAFAC*N ).GT.LAFAC ) THEN
00241 IF( NFAIL.EQ.0 .AND. NERRS.EQ.0 )
00242 $ CALL ALAHD( NOUT, PATH )
00243 IF( N*( KL+KU+1 ).GT.LA ) THEN
00244 WRITE( NOUT, FMT = 9999 )LA, M, N, KL, KU,
00245 $ N*( KL+KU+1 )
00246 NERRS = NERRS + 1
00247 END IF
00248 IF( N*( 2*KL+KU+1 ).GT.LAFAC ) THEN
00249 WRITE( NOUT, FMT = 9998 )LAFAC, M, N, KL, KU,
00250 $ N*( 2*KL+KU+1 )
00251 NERRS = NERRS + 1
00252 END IF
00253 GO TO 130
00254 END IF
00255
00256 DO 120 IMAT = 1, NIMAT
00257
00258
00259
00260 IF( .NOT.DOTYPE( IMAT ) )
00261 $ GO TO 120
00262
00263
00264
00265
00266 ZEROT = IMAT.GE.2 .AND. IMAT.LE.4
00267 IF( ZEROT .AND. N.LT.IMAT-1 )
00268 $ GO TO 120
00269
00270 IF( .NOT.ZEROT .OR. .NOT.DOTYPE( 1 ) ) THEN
00271
00272
00273
00274
00275 CALL DLATB4( PATH, IMAT, M, N, TYPE, KL, KU,
00276 $ ANORM, MODE, CNDNUM, DIST )
00277
00278 KOFF = MAX( 1, KU+2-N )
00279 DO 20 I = 1, KOFF - 1
00280 A( I ) = ZERO
00281 20 CONTINUE
00282 SRNAMT = 'DLATMS'
00283 CALL DLATMS( M, N, DIST, ISEED, TYPE, RWORK,
00284 $ MODE, CNDNUM, ANORM, KL, KU, 'Z',
00285 $ A( KOFF ), LDA, WORK, INFO )
00286
00287
00288
00289 IF( INFO.NE.0 ) THEN
00290 CALL ALAERH( PATH, 'DLATMS', INFO, 0, ' ', M,
00291 $ N, KL, KU, -1, IMAT, NFAIL,
00292 $ NERRS, NOUT )
00293 GO TO 120
00294 END IF
00295 ELSE IF( IZERO.GT.0 ) THEN
00296
00297
00298
00299
00300 CALL DCOPY( I2-I1+1, B, 1, A( IOFF+I1 ), 1 )
00301 END IF
00302
00303
00304
00305
00306 IZERO = 0
00307 IF( ZEROT ) THEN
00308 IF( IMAT.EQ.2 ) THEN
00309 IZERO = 1
00310 ELSE IF( IMAT.EQ.3 ) THEN
00311 IZERO = MIN( M, N )
00312 ELSE
00313 IZERO = MIN( M, N ) / 2 + 1
00314 END IF
00315 IOFF = ( IZERO-1 )*LDA
00316 IF( IMAT.LT.4 ) THEN
00317
00318
00319
00320 I1 = MAX( 1, KU+2-IZERO )
00321 I2 = MIN( KL+KU+1, KU+1+( M-IZERO ) )
00322 CALL DCOPY( I2-I1+1, A( IOFF+I1 ), 1, B, 1 )
00323
00324 DO 30 I = I1, I2
00325 A( IOFF+I ) = ZERO
00326 30 CONTINUE
00327 ELSE
00328 DO 50 J = IZERO, N
00329 DO 40 I = MAX( 1, KU+2-J ),
00330 $ MIN( KL+KU+1, KU+1+( M-J ) )
00331 A( IOFF+I ) = ZERO
00332 40 CONTINUE
00333 IOFF = IOFF + LDA
00334 50 CONTINUE
00335 END IF
00336 END IF
00337
00338
00339
00340
00341
00342
00343
00344
00345
00346
00347 DO 110 INB = 1, NNB
00348 NB = NBVAL( INB )
00349 CALL XLAENV( 1, NB )
00350
00351
00352
00353 IF( M.GT.0 .AND. N.GT.0 )
00354 $ CALL DLACPY( 'Full', KL+KU+1, N, A, LDA,
00355 $ AFAC( KL+1 ), LDAFAC )
00356 SRNAMT = 'DGBTRF'
00357 CALL DGBTRF( M, N, KL, KU, AFAC, LDAFAC, IWORK,
00358 $ INFO )
00359
00360
00361
00362 IF( INFO.NE.IZERO )
00363 $ CALL ALAERH( PATH, 'DGBTRF', INFO, IZERO,
00364 $ ' ', M, N, KL, KU, NB, IMAT,
00365 $ NFAIL, NERRS, NOUT )
00366 TRFCON = .FALSE.
00367
00368
00369
00370
00371
00372 CALL DGBT01( M, N, KL, KU, A, LDA, AFAC, LDAFAC,
00373 $ IWORK, WORK, RESULT( 1 ) )
00374
00375
00376
00377
00378 IF( RESULT( 1 ).GE.THRESH ) THEN
00379 IF( NFAIL.EQ.0 .AND. NERRS.EQ.0 )
00380 $ CALL ALAHD( NOUT, PATH )
00381 WRITE( NOUT, FMT = 9997 )M, N, KL, KU, NB,
00382 $ IMAT, 1, RESULT( 1 )
00383 NFAIL = NFAIL + 1
00384 END IF
00385 NRUN = NRUN + 1
00386
00387
00388
00389
00390 IF( INB.GT.1 .OR. M.NE.N )
00391 $ GO TO 110
00392
00393 ANORMO = DLANGB( 'O', N, KL, KU, A, LDA, RWORK )
00394 ANORMI = DLANGB( 'I', N, KL, KU, A, LDA, RWORK )
00395
00396 IF( INFO.EQ.0 ) THEN
00397
00398
00399
00400
00401 LDB = MAX( 1, N )
00402 CALL DLASET( 'Full', N, N, ZERO, ONE, WORK,
00403 $ LDB )
00404 SRNAMT = 'DGBTRS'
00405 CALL DGBTRS( 'No transpose', N, KL, KU, N,
00406 $ AFAC, LDAFAC, IWORK, WORK, LDB,
00407 $ INFO )
00408
00409
00410
00411 AINVNM = DLANGE( 'O', N, N, WORK, LDB,
00412 $ RWORK )
00413 IF( ANORMO.LE.ZERO .OR. AINVNM.LE.ZERO ) THEN
00414 RCONDO = ONE
00415 ELSE
00416 RCONDO = ( ONE / ANORMO ) / AINVNM
00417 END IF
00418
00419
00420
00421
00422 AINVNM = DLANGE( 'I', N, N, WORK, LDB,
00423 $ RWORK )
00424 IF( ANORMI.LE.ZERO .OR. AINVNM.LE.ZERO ) THEN
00425 RCONDI = ONE
00426 ELSE
00427 RCONDI = ( ONE / ANORMI ) / AINVNM
00428 END IF
00429 ELSE
00430
00431
00432
00433 TRFCON = .TRUE.
00434 RCONDO = ZERO
00435 RCONDI = ZERO
00436 END IF
00437
00438
00439
00440 IF( TRFCON )
00441 $ GO TO 90
00442
00443 DO 80 IRHS = 1, NNS
00444 NRHS = NSVAL( IRHS )
00445 XTYPE = 'N'
00446
00447 DO 70 ITRAN = 1, NTRAN
00448 TRANS = TRANSS( ITRAN )
00449 IF( ITRAN.EQ.1 ) THEN
00450 RCONDC = RCONDO
00451 NORM = 'O'
00452 ELSE
00453 RCONDC = RCONDI
00454 NORM = 'I'
00455 END IF
00456
00457
00458
00459
00460 SRNAMT = 'DLARHS'
00461 CALL DLARHS( PATH, XTYPE, ' ', TRANS, N,
00462 $ N, KL, KU, NRHS, A, LDA,
00463 $ XACT, LDB, B, LDB, ISEED,
00464 $ INFO )
00465 XTYPE = 'C'
00466 CALL DLACPY( 'Full', N, NRHS, B, LDB, X,
00467 $ LDB )
00468
00469 SRNAMT = 'DGBTRS'
00470 CALL DGBTRS( TRANS, N, KL, KU, NRHS, AFAC,
00471 $ LDAFAC, IWORK, X, LDB, INFO )
00472
00473
00474
00475 IF( INFO.NE.0 )
00476 $ CALL ALAERH( PATH, 'DGBTRS', INFO, 0,
00477 $ TRANS, N, N, KL, KU, -1,
00478 $ IMAT, NFAIL, NERRS, NOUT )
00479
00480 CALL DLACPY( 'Full', N, NRHS, B, LDB,
00481 $ WORK, LDB )
00482 CALL DGBT02( TRANS, M, N, KL, KU, NRHS, A,
00483 $ LDA, X, LDB, WORK, LDB,
00484 $ RESULT( 2 ) )
00485
00486
00487
00488
00489
00490 CALL DGET04( N, NRHS, X, LDB, XACT, LDB,
00491 $ RCONDC, RESULT( 3 ) )
00492
00493
00494
00495
00496
00497 SRNAMT = 'DGBRFS'
00498 CALL DGBRFS( TRANS, N, KL, KU, NRHS, A,
00499 $ LDA, AFAC, LDAFAC, IWORK, B,
00500 $ LDB, X, LDB, RWORK,
00501 $ RWORK( NRHS+1 ), WORK,
00502 $ IWORK( N+1 ), INFO )
00503
00504
00505
00506 IF( INFO.NE.0 )
00507 $ CALL ALAERH( PATH, 'DGBRFS', INFO, 0,
00508 $ TRANS, N, N, KL, KU, NRHS,
00509 $ IMAT, NFAIL, NERRS, NOUT )
00510
00511 CALL DGET04( N, NRHS, X, LDB, XACT, LDB,
00512 $ RCONDC, RESULT( 4 ) )
00513 CALL DGBT05( TRANS, N, KL, KU, NRHS, A,
00514 $ LDA, B, LDB, X, LDB, XACT,
00515 $ LDB, RWORK, RWORK( NRHS+1 ),
00516 $ RESULT( 5 ) )
00517 DO 60 K = 2, 6
00518 IF( RESULT( K ).GE.THRESH ) THEN
00519 IF( NFAIL.EQ.0 .AND. NERRS.EQ.0 )
00520 $ CALL ALAHD( NOUT, PATH )
00521 WRITE( NOUT, FMT = 9996 )TRANS, N,
00522 $ KL, KU, NRHS, IMAT, K,
00523 $ RESULT( K )
00524 NFAIL = NFAIL + 1
00525 END IF
00526 60 CONTINUE
00527 NRUN = NRUN + 5
00528 70 CONTINUE
00529 80 CONTINUE
00530
00531
00532
00533
00534 90 CONTINUE
00535 DO 100 ITRAN = 1, 2
00536 IF( ITRAN.EQ.1 ) THEN
00537 ANORM = ANORMO
00538 RCONDC = RCONDO
00539 NORM = 'O'
00540 ELSE
00541 ANORM = ANORMI
00542 RCONDC = RCONDI
00543 NORM = 'I'
00544 END IF
00545 SRNAMT = 'DGBCON'
00546 CALL DGBCON( NORM, N, KL, KU, AFAC, LDAFAC,
00547 $ IWORK, ANORM, RCOND, WORK,
00548 $ IWORK( N+1 ), INFO )
00549
00550
00551
00552 IF( INFO.NE.0 )
00553 $ CALL ALAERH( PATH, 'DGBCON', INFO, 0,
00554 $ NORM, N, N, KL, KU, -1, IMAT,
00555 $ NFAIL, NERRS, NOUT )
00556
00557 RESULT( 7 ) = DGET06( RCOND, RCONDC )
00558
00559
00560
00561
00562 IF( RESULT( 7 ).GE.THRESH ) THEN
00563 IF( NFAIL.EQ.0 .AND. NERRS.EQ.0 )
00564 $ CALL ALAHD( NOUT, PATH )
00565 WRITE( NOUT, FMT = 9995 )NORM, N, KL, KU,
00566 $ IMAT, 7, RESULT( 7 )
00567 NFAIL = NFAIL + 1
00568 END IF
00569 NRUN = NRUN + 1
00570 100 CONTINUE
00571
00572 110 CONTINUE
00573 120 CONTINUE
00574 130 CONTINUE
00575 140 CONTINUE
00576 150 CONTINUE
00577 160 CONTINUE
00578
00579
00580
00581 CALL ALASUM( PATH, NOUT, NFAIL, NRUN, NERRS )
00582
00583 9999 FORMAT( ' *** In DCHKGB, LA=', I5, ' is too small for M=', I5,
00584 $ ', N=', I5, ', KL=', I4, ', KU=', I4,
00585 $ / ' ==> Increase LA to at least ', I5 )
00586 9998 FORMAT( ' *** In DCHKGB, LAFAC=', I5, ' is too small for M=', I5,
00587 $ ', N=', I5, ', KL=', I4, ', KU=', I4,
00588 $ / ' ==> Increase LAFAC to at least ', I5 )
00589 9997 FORMAT( ' M =', I5, ', N =', I5, ', KL=', I5, ', KU=', I5,
00590 $ ', NB =', I4, ', type ', I1, ', test(', I1, ')=', G12.5 )
00591 9996 FORMAT( ' TRANS=''', A1, ''', N=', I5, ', KL=', I5, ', KU=', I5,
00592 $ ', NRHS=', I3, ', type ', I1, ', test(', I1, ')=', G12.5 )
00593 9995 FORMAT( ' NORM =''', A1, ''', N=', I5, ', KL=', I5, ', KU=', I5,
00594 $ ',', 10X, ' type ', I1, ', test(', I1, ')=', G12.5 )
00595
00596 RETURN
00597
00598
00599
00600 END