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