00001 SUBROUTINE DCHKSB( NSIZES, NN, NWDTHS, KK, NTYPES, DOTYPE, ISEED,
00002 $ THRESH, NOUNIT, A, LDA, SD, SE, U, LDU, WORK,
00003 $ LWORK, RESULT, INFO )
00004
00005
00006
00007
00008
00009
00010 INTEGER INFO, LDA, LDU, LWORK, NOUNIT, NSIZES, NTYPES,
00011 $ NWDTHS
00012 DOUBLE PRECISION THRESH
00013
00014
00015 LOGICAL DOTYPE( * )
00016 INTEGER ISEED( 4 ), KK( * ), NN( * )
00017 DOUBLE PRECISION A( LDA, * ), RESULT( * ), SD( * ), SE( * ),
00018 $ U( LDU, * ), WORK( * )
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
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215 DOUBLE PRECISION ZERO, ONE, TWO, TEN
00216 PARAMETER ( ZERO = 0.0D0, ONE = 1.0D0, TWO = 2.0D0,
00217 $ TEN = 10.0D0 )
00218 DOUBLE PRECISION HALF
00219 PARAMETER ( HALF = ONE / TWO )
00220 INTEGER MAXTYP
00221 PARAMETER ( MAXTYP = 15 )
00222
00223
00224 LOGICAL BADNN, BADNNB
00225 INTEGER I, IINFO, IMODE, ITYPE, J, JC, JCOL, JR, JSIZE,
00226 $ JTYPE, JWIDTH, K, KMAX, MTYPES, N, NERRS,
00227 $ NMATS, NMAX, NTEST, NTESTT
00228 DOUBLE PRECISION ANINV, ANORM, COND, OVFL, RTOVFL, RTUNFL,
00229 $ TEMP1, ULP, ULPINV, UNFL
00230
00231
00232 INTEGER IDUMMA( 1 ), IOLDSD( 4 ), KMAGN( MAXTYP ),
00233 $ KMODE( MAXTYP ), KTYPE( MAXTYP )
00234
00235
00236 DOUBLE PRECISION DLAMCH
00237 EXTERNAL DLAMCH
00238
00239
00240 EXTERNAL DLACPY, DLASET, DLASUM, DLATMR, DLATMS, DSBT21,
00241 $ DSBTRD, XERBLA
00242
00243
00244 INTRINSIC ABS, DBLE, MAX, MIN, SQRT
00245
00246
00247 DATA KTYPE / 1, 2, 5*4, 5*5, 3*8 /
00248 DATA KMAGN / 2*1, 1, 1, 1, 2, 3, 1, 1, 1, 2, 3, 1,
00249 $ 2, 3 /
00250 DATA KMODE / 2*0, 4, 3, 1, 4, 4, 4, 3, 1, 4, 4, 0,
00251 $ 0, 0 /
00252
00253
00254
00255
00256
00257 NTESTT = 0
00258 INFO = 0
00259
00260
00261
00262 BADNN = .FALSE.
00263 NMAX = 1
00264 DO 10 J = 1, NSIZES
00265 NMAX = MAX( NMAX, NN( J ) )
00266 IF( NN( J ).LT.0 )
00267 $ BADNN = .TRUE.
00268 10 CONTINUE
00269
00270 BADNNB = .FALSE.
00271 KMAX = 0
00272 DO 20 J = 1, NSIZES
00273 KMAX = MAX( KMAX, KK( J ) )
00274 IF( KK( J ).LT.0 )
00275 $ BADNNB = .TRUE.
00276 20 CONTINUE
00277 KMAX = MIN( NMAX-1, KMAX )
00278
00279
00280
00281 IF( NSIZES.LT.0 ) THEN
00282 INFO = -1
00283 ELSE IF( BADNN ) THEN
00284 INFO = -2
00285 ELSE IF( NWDTHS.LT.0 ) THEN
00286 INFO = -3
00287 ELSE IF( BADNNB ) THEN
00288 INFO = -4
00289 ELSE IF( NTYPES.LT.0 ) THEN
00290 INFO = -5
00291 ELSE IF( LDA.LT.KMAX+1 ) THEN
00292 INFO = -11
00293 ELSE IF( LDU.LT.NMAX ) THEN
00294 INFO = -15
00295 ELSE IF( ( MAX( LDA, NMAX )+1 )*NMAX.GT.LWORK ) THEN
00296 INFO = -17
00297 END IF
00298
00299 IF( INFO.NE.0 ) THEN
00300 CALL XERBLA( 'DCHKSB', -INFO )
00301 RETURN
00302 END IF
00303
00304
00305
00306 IF( NSIZES.EQ.0 .OR. NTYPES.EQ.0 .OR. NWDTHS.EQ.0 )
00307 $ RETURN
00308
00309
00310
00311 UNFL = DLAMCH( 'Safe minimum' )
00312 OVFL = ONE / UNFL
00313 ULP = DLAMCH( 'Epsilon' )*DLAMCH( 'Base' )
00314 ULPINV = ONE / ULP
00315 RTUNFL = SQRT( UNFL )
00316 RTOVFL = SQRT( OVFL )
00317
00318
00319
00320 NERRS = 0
00321 NMATS = 0
00322
00323 DO 190 JSIZE = 1, NSIZES
00324 N = NN( JSIZE )
00325 ANINV = ONE / DBLE( MAX( 1, N ) )
00326
00327 DO 180 JWIDTH = 1, NWDTHS
00328 K = KK( JWIDTH )
00329 IF( K.GT.N )
00330 $ GO TO 180
00331 K = MAX( 0, MIN( N-1, K ) )
00332
00333 IF( NSIZES.NE.1 ) THEN
00334 MTYPES = MIN( MAXTYP, NTYPES )
00335 ELSE
00336 MTYPES = MIN( MAXTYP+1, NTYPES )
00337 END IF
00338
00339 DO 170 JTYPE = 1, MTYPES
00340 IF( .NOT.DOTYPE( JTYPE ) )
00341 $ GO TO 170
00342 NMATS = NMATS + 1
00343 NTEST = 0
00344
00345 DO 30 J = 1, 4
00346 IOLDSD( J ) = ISEED( J )
00347 30 CONTINUE
00348
00349
00350
00351
00352
00353
00354
00355
00356
00357
00358
00359
00360
00361
00362
00363
00364
00365
00366 IF( MTYPES.GT.MAXTYP )
00367 $ GO TO 100
00368
00369 ITYPE = KTYPE( JTYPE )
00370 IMODE = KMODE( JTYPE )
00371
00372
00373
00374 GO TO ( 40, 50, 60 )KMAGN( JTYPE )
00375
00376 40 CONTINUE
00377 ANORM = ONE
00378 GO TO 70
00379
00380 50 CONTINUE
00381 ANORM = ( RTOVFL*ULP )*ANINV
00382 GO TO 70
00383
00384 60 CONTINUE
00385 ANORM = RTUNFL*N*ULPINV
00386 GO TO 70
00387
00388 70 CONTINUE
00389
00390 CALL DLASET( 'Full', LDA, N, ZERO, ZERO, A, LDA )
00391 IINFO = 0
00392 IF( JTYPE.LE.15 ) THEN
00393 COND = ULPINV
00394 ELSE
00395 COND = ULPINV*ANINV / TEN
00396 END IF
00397
00398
00399
00400
00401
00402 IF( ITYPE.EQ.1 ) THEN
00403 IINFO = 0
00404
00405 ELSE IF( ITYPE.EQ.2 ) THEN
00406
00407
00408
00409 DO 80 JCOL = 1, N
00410 A( K+1, JCOL ) = ANORM
00411 80 CONTINUE
00412
00413 ELSE IF( ITYPE.EQ.4 ) THEN
00414
00415
00416
00417 CALL DLATMS( N, N, 'S', ISEED, 'S', WORK, IMODE, COND,
00418 $ ANORM, 0, 0, 'Q', A( K+1, 1 ), LDA,
00419 $ WORK( N+1 ), IINFO )
00420
00421 ELSE IF( ITYPE.EQ.5 ) THEN
00422
00423
00424
00425 CALL DLATMS( N, N, 'S', ISEED, 'S', WORK, IMODE, COND,
00426 $ ANORM, K, K, 'Q', A, LDA, WORK( N+1 ),
00427 $ IINFO )
00428
00429 ELSE IF( ITYPE.EQ.7 ) THEN
00430
00431
00432
00433 CALL DLATMR( N, N, 'S', ISEED, 'S', WORK, 6, ONE, ONE,
00434 $ 'T', 'N', WORK( N+1 ), 1, ONE,
00435 $ WORK( 2*N+1 ), 1, ONE, 'N', IDUMMA, 0, 0,
00436 $ ZERO, ANORM, 'Q', A( K+1, 1 ), LDA,
00437 $ IDUMMA, IINFO )
00438
00439 ELSE IF( ITYPE.EQ.8 ) THEN
00440
00441
00442
00443 CALL DLATMR( N, N, 'S', ISEED, 'S', WORK, 6, ONE, ONE,
00444 $ 'T', 'N', WORK( N+1 ), 1, ONE,
00445 $ WORK( 2*N+1 ), 1, ONE, 'N', IDUMMA, K, K,
00446 $ ZERO, ANORM, 'Q', A, LDA, IDUMMA, IINFO )
00447
00448 ELSE IF( ITYPE.EQ.9 ) THEN
00449
00450
00451
00452 CALL DLATMS( N, N, 'S', ISEED, 'P', WORK, IMODE, COND,
00453 $ ANORM, K, K, 'Q', A, LDA, WORK( N+1 ),
00454 $ IINFO )
00455
00456 ELSE IF( ITYPE.EQ.10 ) THEN
00457
00458
00459
00460 IF( N.GT.1 )
00461 $ K = MAX( 1, K )
00462 CALL DLATMS( N, N, 'S', ISEED, 'P', WORK, IMODE, COND,
00463 $ ANORM, 1, 1, 'Q', A( K, 1 ), LDA,
00464 $ WORK( N+1 ), IINFO )
00465 DO 90 I = 2, N
00466 TEMP1 = ABS( A( K, I ) ) /
00467 $ SQRT( ABS( A( K+1, I-1 )*A( K+1, I ) ) )
00468 IF( TEMP1.GT.HALF ) THEN
00469 A( K, I ) = HALF*SQRT( ABS( A( K+1,
00470 $ I-1 )*A( K+1, I ) ) )
00471 END IF
00472 90 CONTINUE
00473
00474 ELSE
00475
00476 IINFO = 1
00477 END IF
00478
00479 IF( IINFO.NE.0 ) THEN
00480 WRITE( NOUNIT, FMT = 9999 )'Generator', IINFO, N,
00481 $ JTYPE, IOLDSD
00482 INFO = ABS( IINFO )
00483 RETURN
00484 END IF
00485
00486 100 CONTINUE
00487
00488
00489
00490 CALL DLACPY( ' ', K+1, N, A, LDA, WORK, LDA )
00491
00492 NTEST = 1
00493 CALL DSBTRD( 'V', 'U', N, K, WORK, LDA, SD, SE, U, LDU,
00494 $ WORK( LDA*N+1 ), IINFO )
00495
00496 IF( IINFO.NE.0 ) THEN
00497 WRITE( NOUNIT, FMT = 9999 )'DSBTRD(U)', IINFO, N,
00498 $ JTYPE, IOLDSD
00499 INFO = ABS( IINFO )
00500 IF( IINFO.LT.0 ) THEN
00501 RETURN
00502 ELSE
00503 RESULT( 1 ) = ULPINV
00504 GO TO 150
00505 END IF
00506 END IF
00507
00508
00509
00510 CALL DSBT21( 'Upper', N, K, 1, A, LDA, SD, SE, U, LDU,
00511 $ WORK, RESULT( 1 ) )
00512
00513
00514
00515
00516 DO 120 JC = 1, N
00517 DO 110 JR = 0, MIN( K, N-JC )
00518 A( JR+1, JC ) = A( K+1-JR, JC+JR )
00519 110 CONTINUE
00520 120 CONTINUE
00521 DO 140 JC = N + 1 - K, N
00522 DO 130 JR = MIN( K, N-JC ) + 1, K
00523 A( JR+1, JC ) = ZERO
00524 130 CONTINUE
00525 140 CONTINUE
00526
00527
00528
00529 CALL DLACPY( ' ', K+1, N, A, LDA, WORK, LDA )
00530
00531 NTEST = 3
00532 CALL DSBTRD( 'V', 'L', N, K, WORK, LDA, SD, SE, U, LDU,
00533 $ WORK( LDA*N+1 ), IINFO )
00534
00535 IF( IINFO.NE.0 ) THEN
00536 WRITE( NOUNIT, FMT = 9999 )'DSBTRD(L)', IINFO, N,
00537 $ JTYPE, IOLDSD
00538 INFO = ABS( IINFO )
00539 IF( IINFO.LT.0 ) THEN
00540 RETURN
00541 ELSE
00542 RESULT( 3 ) = ULPINV
00543 GO TO 150
00544 END IF
00545 END IF
00546 NTEST = 4
00547
00548
00549
00550 CALL DSBT21( 'Lower', N, K, 1, A, LDA, SD, SE, U, LDU,
00551 $ WORK, RESULT( 3 ) )
00552
00553
00554
00555 150 CONTINUE
00556 NTESTT = NTESTT + NTEST
00557
00558
00559
00560 DO 160 JR = 1, NTEST
00561 IF( RESULT( JR ).GE.THRESH ) THEN
00562
00563
00564
00565
00566 IF( NERRS.EQ.0 ) THEN
00567 WRITE( NOUNIT, FMT = 9998 )'DSB'
00568 WRITE( NOUNIT, FMT = 9997 )
00569 WRITE( NOUNIT, FMT = 9996 )
00570 WRITE( NOUNIT, FMT = 9995 )'Symmetric'
00571 WRITE( NOUNIT, FMT = 9994 )'orthogonal', '''',
00572 $ 'transpose', ( '''', J = 1, 4 )
00573 END IF
00574 NERRS = NERRS + 1
00575 WRITE( NOUNIT, FMT = 9993 )N, K, IOLDSD, JTYPE,
00576 $ JR, RESULT( JR )
00577 END IF
00578 160 CONTINUE
00579
00580 170 CONTINUE
00581 180 CONTINUE
00582 190 CONTINUE
00583
00584
00585
00586 CALL DLASUM( 'DSB', NOUNIT, NERRS, NTESTT )
00587 RETURN
00588
00589 9999 FORMAT( ' DCHKSB: ', A, ' returned INFO=', I6, '.', / 9X, 'N=',
00590 $ I6, ', JTYPE=', I6, ', ISEED=(', 3( I5, ',' ), I5, ')' )
00591
00592 9998 FORMAT( / 1X, A3,
00593 $ ' -- Real Symmetric Banded Tridiagonal Reduction Routines' )
00594 9997 FORMAT( ' Matrix types (see DCHKSB for details): ' )
00595
00596 9996 FORMAT( / ' Special Matrices:',
00597 $ / ' 1=Zero matrix. ',
00598 $ ' 5=Diagonal: clustered entries.',
00599 $ / ' 2=Identity matrix. ',
00600 $ ' 6=Diagonal: large, evenly spaced.',
00601 $ / ' 3=Diagonal: evenly spaced entries. ',
00602 $ ' 7=Diagonal: small, evenly spaced.',
00603 $ / ' 4=Diagonal: geometr. spaced entries.' )
00604 9995 FORMAT( ' Dense ', A, ' Banded Matrices:',
00605 $ / ' 8=Evenly spaced eigenvals. ',
00606 $ ' 12=Small, evenly spaced eigenvals.',
00607 $ / ' 9=Geometrically spaced eigenvals. ',
00608 $ ' 13=Matrix with random O(1) entries.',
00609 $ / ' 10=Clustered eigenvalues. ',
00610 $ ' 14=Matrix with large random entries.',
00611 $ / ' 11=Large, evenly spaced eigenvals. ',
00612 $ ' 15=Matrix with small random entries.' )
00613
00614 9994 FORMAT( / ' Tests performed: (S is Tridiag, U is ', A, ',',
00615 $ / 20X, A, ' means ', A, '.', / ' UPLO=''U'':',
00616 $ / ' 1= | A - U S U', A1, ' | / ( |A| n ulp ) ',
00617 $ ' 2= | I - U U', A1, ' | / ( n ulp )', / ' UPLO=''L'':',
00618 $ / ' 3= | A - U S U', A1, ' | / ( |A| n ulp ) ',
00619 $ ' 4= | I - U U', A1, ' | / ( n ulp )' )
00620 9993 FORMAT( ' N=', I5, ', K=', I4, ', seed=', 4( I4, ',' ), ' type ',
00621 $ I2, ', test(', I2, ')=', G10.3 )
00622
00623
00624
00625 END