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