00001 SUBROUTINE SDRVSX( NSIZES, NN, NTYPES, DOTYPE, ISEED, THRESH,
00002 $ NIUNIT, NOUNIT, A, LDA, H, HT, WR, WI, WRT,
00003 $ WIT, WRTMP, WITMP, VS, LDVS, VS1, RESULT, WORK,
00004 $ LWORK, IWORK, BWORK, INFO )
00005
00006
00007
00008
00009
00010
00011 INTEGER INFO, LDA, LDVS, LWORK, NIUNIT, NOUNIT, NSIZES,
00012 $ NTYPES
00013 REAL THRESH
00014
00015
00016 LOGICAL BWORK( * ), DOTYPE( * )
00017 INTEGER ISEED( 4 ), IWORK( * ), NN( * )
00018 REAL A( LDA, * ), H( LDA, * ), HT( LDA, * ),
00019 $ RESULT( 17 ), VS( LDVS, * ), VS1( LDVS, * ),
00020 $ WI( * ), WIT( * ), WITMP( * ), WORK( * ),
00021 $ WR( * ), WRT( * ), WRTMP( * )
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
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342
00343 REAL ZERO, ONE
00344 PARAMETER ( ZERO = 0.0E0, ONE = 1.0E0 )
00345 INTEGER MAXTYP
00346 PARAMETER ( MAXTYP = 21 )
00347
00348
00349 LOGICAL BADNN
00350 CHARACTER*3 PATH
00351 INTEGER I, IINFO, IMODE, ITYPE, IWK, J, JCOL, JSIZE,
00352 $ JTYPE, MTYPES, N, NERRS, NFAIL, NMAX,
00353 $ NNWORK, NSLCT, NTEST, NTESTF, NTESTT
00354 REAL ANORM, COND, CONDS, OVFL, RCDEIN, RCDVIN,
00355 $ RTULP, RTULPI, ULP, ULPINV, UNFL
00356
00357
00358 CHARACTER ADUMMA( 1 )
00359 INTEGER IDUMMA( 1 ), IOLDSD( 4 ), ISLCT( 20 ),
00360 $ KCONDS( MAXTYP ), KMAGN( MAXTYP ),
00361 $ KMODE( MAXTYP ), KTYPE( MAXTYP )
00362
00363
00364 LOGICAL SELVAL( 20 )
00365 REAL SELWI( 20 ), SELWR( 20 )
00366
00367
00368 INTEGER SELDIM, SELOPT
00369
00370
00371 COMMON / SSLCT / SELOPT, SELDIM, SELVAL, SELWR, SELWI
00372
00373
00374 REAL SLAMCH
00375 EXTERNAL SLAMCH
00376
00377
00378 EXTERNAL SGET24, SLABAD, SLASUM, SLATME, SLATMR, SLATMS,
00379 $ SLASET, XERBLA
00380
00381
00382 INTRINSIC ABS, MAX, MIN, SQRT
00383
00384
00385 DATA KTYPE / 1, 2, 3, 5*4, 4*6, 6*6, 3*9 /
00386 DATA KMAGN / 3*1, 1, 1, 1, 2, 3, 4*1, 1, 1, 1, 1, 2,
00387 $ 3, 1, 2, 3 /
00388 DATA KMODE / 3*0, 4, 3, 1, 4, 4, 4, 3, 1, 5, 4, 3,
00389 $ 1, 5, 5, 5, 4, 3, 1 /
00390 DATA KCONDS / 3*0, 5*0, 4*1, 6*2, 3*0 /
00391
00392
00393
00394 PATH( 1: 1 ) = 'Single precision'
00395 PATH( 2: 3 ) = 'SX'
00396
00397
00398
00399 NTESTT = 0
00400 NTESTF = 0
00401 INFO = 0
00402
00403
00404
00405 BADNN = .FALSE.
00406
00407
00408
00409
00410 NMAX = 12
00411 DO 10 J = 1, NSIZES
00412 NMAX = MAX( NMAX, NN( J ) )
00413 IF( NN( J ).LT.0 )
00414 $ BADNN = .TRUE.
00415 10 CONTINUE
00416
00417
00418
00419 IF( NSIZES.LT.0 ) THEN
00420 INFO = -1
00421 ELSE IF( BADNN ) THEN
00422 INFO = -2
00423 ELSE IF( NTYPES.LT.0 ) THEN
00424 INFO = -3
00425 ELSE IF( THRESH.LT.ZERO ) THEN
00426 INFO = -6
00427 ELSE IF( NIUNIT.LE.0 ) THEN
00428 INFO = -7
00429 ELSE IF( NOUNIT.LE.0 ) THEN
00430 INFO = -8
00431 ELSE IF( LDA.LT.1 .OR. LDA.LT.NMAX ) THEN
00432 INFO = -10
00433 ELSE IF( LDVS.LT.1 .OR. LDVS.LT.NMAX ) THEN
00434 INFO = -20
00435 ELSE IF( MAX( 3*NMAX, 2*NMAX**2 ).GT.LWORK ) THEN
00436 INFO = -24
00437 END IF
00438
00439 IF( INFO.NE.0 ) THEN
00440 CALL XERBLA( 'SDRVSX', -INFO )
00441 RETURN
00442 END IF
00443
00444
00445
00446 IF( NSIZES.EQ.0 .OR. NTYPES.EQ.0 )
00447 $ GO TO 150
00448
00449
00450
00451 UNFL = SLAMCH( 'Safe minimum' )
00452 OVFL = ONE / UNFL
00453 CALL SLABAD( UNFL, OVFL )
00454 ULP = SLAMCH( 'Precision' )
00455 ULPINV = ONE / ULP
00456 RTULP = SQRT( ULP )
00457 RTULPI = ONE / RTULP
00458
00459
00460
00461 NERRS = 0
00462
00463 DO 140 JSIZE = 1, NSIZES
00464 N = NN( JSIZE )
00465 IF( NSIZES.NE.1 ) THEN
00466 MTYPES = MIN( MAXTYP, NTYPES )
00467 ELSE
00468 MTYPES = MIN( MAXTYP+1, NTYPES )
00469 END IF
00470
00471 DO 130 JTYPE = 1, MTYPES
00472 IF( .NOT.DOTYPE( JTYPE ) )
00473 $ GO TO 130
00474
00475
00476
00477 DO 20 J = 1, 4
00478 IOLDSD( J ) = ISEED( J )
00479 20 CONTINUE
00480
00481
00482
00483
00484
00485
00486
00487
00488
00489
00490
00491
00492
00493
00494
00495
00496
00497 IF( MTYPES.GT.MAXTYP )
00498 $ GO TO 90
00499
00500 ITYPE = KTYPE( JTYPE )
00501 IMODE = KMODE( JTYPE )
00502
00503
00504
00505 GO TO ( 30, 40, 50 )KMAGN( JTYPE )
00506
00507 30 CONTINUE
00508 ANORM = ONE
00509 GO TO 60
00510
00511 40 CONTINUE
00512 ANORM = OVFL*ULP
00513 GO TO 60
00514
00515 50 CONTINUE
00516 ANORM = UNFL*ULPINV
00517 GO TO 60
00518
00519 60 CONTINUE
00520
00521 CALL SLASET( 'Full', LDA, N, ZERO, ZERO, A, LDA )
00522 IINFO = 0
00523 COND = ULPINV
00524
00525
00526
00527
00528
00529 IF( ITYPE.EQ.1 ) THEN
00530 IINFO = 0
00531
00532 ELSE IF( ITYPE.EQ.2 ) THEN
00533
00534
00535
00536 DO 70 JCOL = 1, N
00537 A( JCOL, JCOL ) = ANORM
00538 70 CONTINUE
00539
00540 ELSE IF( ITYPE.EQ.3 ) THEN
00541
00542
00543
00544 DO 80 JCOL = 1, N
00545 A( JCOL, JCOL ) = ANORM
00546 IF( JCOL.GT.1 )
00547 $ A( JCOL, JCOL-1 ) = ONE
00548 80 CONTINUE
00549
00550 ELSE IF( ITYPE.EQ.4 ) THEN
00551
00552
00553
00554 CALL SLATMS( N, N, 'S', ISEED, 'S', WORK, IMODE, COND,
00555 $ ANORM, 0, 0, 'N', A, LDA, WORK( N+1 ),
00556 $ IINFO )
00557
00558 ELSE IF( ITYPE.EQ.5 ) THEN
00559
00560
00561
00562 CALL SLATMS( N, N, 'S', ISEED, 'S', WORK, IMODE, COND,
00563 $ ANORM, N, N, 'N', A, LDA, WORK( N+1 ),
00564 $ IINFO )
00565
00566 ELSE IF( ITYPE.EQ.6 ) THEN
00567
00568
00569
00570 IF( KCONDS( JTYPE ).EQ.1 ) THEN
00571 CONDS = ONE
00572 ELSE IF( KCONDS( JTYPE ).EQ.2 ) THEN
00573 CONDS = RTULPI
00574 ELSE
00575 CONDS = ZERO
00576 END IF
00577
00578 ADUMMA( 1 ) = ' '
00579 CALL SLATME( N, 'S', ISEED, WORK, IMODE, COND, ONE,
00580 $ ADUMMA, 'T', 'T', 'T', WORK( N+1 ), 4,
00581 $ CONDS, N, N, ANORM, A, LDA, WORK( 2*N+1 ),
00582 $ IINFO )
00583
00584 ELSE IF( ITYPE.EQ.7 ) THEN
00585
00586
00587
00588 CALL SLATMR( N, N, 'S', ISEED, 'S', WORK, 6, ONE, ONE,
00589 $ 'T', 'N', WORK( N+1 ), 1, ONE,
00590 $ WORK( 2*N+1 ), 1, ONE, 'N', IDUMMA, 0, 0,
00591 $ ZERO, ANORM, 'NO', A, LDA, IWORK, IINFO )
00592
00593 ELSE IF( ITYPE.EQ.8 ) THEN
00594
00595
00596
00597 CALL SLATMR( N, N, 'S', ISEED, 'S', WORK, 6, ONE, ONE,
00598 $ 'T', 'N', WORK( N+1 ), 1, ONE,
00599 $ WORK( 2*N+1 ), 1, ONE, 'N', IDUMMA, N, N,
00600 $ ZERO, ANORM, 'NO', A, LDA, IWORK, IINFO )
00601
00602 ELSE IF( ITYPE.EQ.9 ) THEN
00603
00604
00605
00606 CALL SLATMR( N, N, 'S', ISEED, 'N', WORK, 6, ONE, ONE,
00607 $ 'T', 'N', WORK( N+1 ), 1, ONE,
00608 $ WORK( 2*N+1 ), 1, ONE, 'N', IDUMMA, N, N,
00609 $ ZERO, ANORM, 'NO', A, LDA, IWORK, IINFO )
00610 IF( N.GE.4 ) THEN
00611 CALL SLASET( 'Full', 2, N, ZERO, ZERO, A, LDA )
00612 CALL SLASET( 'Full', N-3, 1, ZERO, ZERO, A( 3, 1 ),
00613 $ LDA )
00614 CALL SLASET( 'Full', N-3, 2, ZERO, ZERO, A( 3, N-1 ),
00615 $ LDA )
00616 CALL SLASET( 'Full', 1, N, ZERO, ZERO, A( N, 1 ),
00617 $ LDA )
00618 END IF
00619
00620 ELSE IF( ITYPE.EQ.10 ) THEN
00621
00622
00623
00624 CALL SLATMR( N, N, 'S', ISEED, 'N', WORK, 6, ONE, ONE,
00625 $ 'T', 'N', WORK( N+1 ), 1, ONE,
00626 $ WORK( 2*N+1 ), 1, ONE, 'N', IDUMMA, N, 0,
00627 $ ZERO, ANORM, 'NO', A, LDA, IWORK, IINFO )
00628
00629 ELSE
00630
00631 IINFO = 1
00632 END IF
00633
00634 IF( IINFO.NE.0 ) THEN
00635 WRITE( NOUNIT, FMT = 9991 )'Generator', IINFO, N, JTYPE,
00636 $ IOLDSD
00637 INFO = ABS( IINFO )
00638 RETURN
00639 END IF
00640
00641 90 CONTINUE
00642
00643
00644
00645 DO 120 IWK = 1, 2
00646 IF( IWK.EQ.1 ) THEN
00647 NNWORK = 3*N
00648 ELSE
00649 NNWORK = MAX( 3*N, 2*N*N )
00650 END IF
00651 NNWORK = MAX( NNWORK, 1 )
00652
00653 CALL SGET24( .FALSE., JTYPE, THRESH, IOLDSD, NOUNIT, N,
00654 $ A, LDA, H, HT, WR, WI, WRT, WIT, WRTMP,
00655 $ WITMP, VS, LDVS, VS1, RCDEIN, RCDVIN, NSLCT,
00656 $ ISLCT, RESULT, WORK, NNWORK, IWORK, BWORK,
00657 $ INFO )
00658
00659
00660
00661 NTEST = 0
00662 NFAIL = 0
00663 DO 100 J = 1, 15
00664 IF( RESULT( J ).GE.ZERO )
00665 $ NTEST = NTEST + 1
00666 IF( RESULT( J ).GE.THRESH )
00667 $ NFAIL = NFAIL + 1
00668 100 CONTINUE
00669
00670 IF( NFAIL.GT.0 )
00671 $ NTESTF = NTESTF + 1
00672 IF( NTESTF.EQ.1 ) THEN
00673 WRITE( NOUNIT, FMT = 9999 )PATH
00674 WRITE( NOUNIT, FMT = 9998 )
00675 WRITE( NOUNIT, FMT = 9997 )
00676 WRITE( NOUNIT, FMT = 9996 )
00677 WRITE( NOUNIT, FMT = 9995 )THRESH
00678 WRITE( NOUNIT, FMT = 9994 )
00679 NTESTF = 2
00680 END IF
00681
00682 DO 110 J = 1, 15
00683 IF( RESULT( J ).GE.THRESH ) THEN
00684 WRITE( NOUNIT, FMT = 9993 )N, IWK, IOLDSD, JTYPE,
00685 $ J, RESULT( J )
00686 END IF
00687 110 CONTINUE
00688
00689 NERRS = NERRS + NFAIL
00690 NTESTT = NTESTT + NTEST
00691
00692 120 CONTINUE
00693 130 CONTINUE
00694 140 CONTINUE
00695
00696 150 CONTINUE
00697
00698
00699
00700
00701 JTYPE = 0
00702 160 CONTINUE
00703 READ( NIUNIT, FMT = *, END = 200 )N, NSLCT
00704 IF( N.EQ.0 )
00705 $ GO TO 200
00706 JTYPE = JTYPE + 1
00707 ISEED( 1 ) = JTYPE
00708 IF( NSLCT.GT.0 )
00709 $ READ( NIUNIT, FMT = * )( ISLCT( I ), I = 1, NSLCT )
00710 DO 170 I = 1, N
00711 READ( NIUNIT, FMT = * )( A( I, J ), J = 1, N )
00712 170 CONTINUE
00713 READ( NIUNIT, FMT = * )RCDEIN, RCDVIN
00714
00715 CALL SGET24( .TRUE., 22, THRESH, ISEED, NOUNIT, N, A, LDA, H, HT,
00716 $ WR, WI, WRT, WIT, WRTMP, WITMP, VS, LDVS, VS1,
00717 $ RCDEIN, RCDVIN, NSLCT, ISLCT, RESULT, WORK, LWORK,
00718 $ IWORK, BWORK, INFO )
00719
00720
00721
00722 NTEST = 0
00723 NFAIL = 0
00724 DO 180 J = 1, 17
00725 IF( RESULT( J ).GE.ZERO )
00726 $ NTEST = NTEST + 1
00727 IF( RESULT( J ).GE.THRESH )
00728 $ NFAIL = NFAIL + 1
00729 180 CONTINUE
00730
00731 IF( NFAIL.GT.0 )
00732 $ NTESTF = NTESTF + 1
00733 IF( NTESTF.EQ.1 ) THEN
00734 WRITE( NOUNIT, FMT = 9999 )PATH
00735 WRITE( NOUNIT, FMT = 9998 )
00736 WRITE( NOUNIT, FMT = 9997 )
00737 WRITE( NOUNIT, FMT = 9996 )
00738 WRITE( NOUNIT, FMT = 9995 )THRESH
00739 WRITE( NOUNIT, FMT = 9994 )
00740 NTESTF = 2
00741 END IF
00742 DO 190 J = 1, 17
00743 IF( RESULT( J ).GE.THRESH ) THEN
00744 WRITE( NOUNIT, FMT = 9992 )N, JTYPE, J, RESULT( J )
00745 END IF
00746 190 CONTINUE
00747
00748 NERRS = NERRS + NFAIL
00749 NTESTT = NTESTT + NTEST
00750 GO TO 160
00751 200 CONTINUE
00752
00753
00754
00755 CALL SLASUM( PATH, NOUNIT, NERRS, NTESTT )
00756
00757 9999 FORMAT( / 1X, A3, ' -- Real Schur Form Decomposition Expert ',
00758 $ 'Driver', / ' Matrix types (see SDRVSX for details):' )
00759
00760 9998 FORMAT( / ' Special Matrices:', / ' 1=Zero matrix. ',
00761 $ ' ', ' 5=Diagonal: geometr. spaced entries.',
00762 $ / ' 2=Identity matrix. ', ' 6=Diagona',
00763 $ 'l: clustered entries.', / ' 3=Transposed Jordan block. ',
00764 $ ' ', ' 7=Diagonal: large, evenly spaced.', / ' ',
00765 $ '4=Diagonal: evenly spaced entries. ', ' 8=Diagonal: s',
00766 $ 'mall, evenly spaced.' )
00767 9997 FORMAT( ' Dense, Non-Symmetric Matrices:', / ' 9=Well-cond., ev',
00768 $ 'enly spaced eigenvals.', ' 14=Ill-cond., geomet. spaced e',
00769 $ 'igenals.', / ' 10=Well-cond., geom. spaced eigenvals. ',
00770 $ ' 15=Ill-conditioned, clustered e.vals.', / ' 11=Well-cond',
00771 $ 'itioned, clustered e.vals. ', ' 16=Ill-cond., random comp',
00772 $ 'lex ', / ' 12=Well-cond., random complex ', ' ',
00773 $ ' 17=Ill-cond., large rand. complx ', / ' 13=Ill-condi',
00774 $ 'tioned, evenly spaced. ', ' 18=Ill-cond., small rand.',
00775 $ ' complx ' )
00776 9996 FORMAT( ' 19=Matrix with random O(1) entries. ', ' 21=Matrix ',
00777 $ 'with small random entries.', / ' 20=Matrix with large ran',
00778 $ 'dom entries. ', / )
00779 9995 FORMAT( ' Tests performed with test threshold =', F8.2,
00780 $ / ' ( A denotes A on input and T denotes A on output)',
00781 $ / / ' 1 = 0 if T in Schur form (no sort), ',
00782 $ ' 1/ulp otherwise', /
00783 $ ' 2 = | A - VS T transpose(VS) | / ( n |A| ulp ) (no sort)',
00784 $ / ' 3 = | I - VS transpose(VS) | / ( n ulp ) (no sort) ', /
00785 $ ' 4 = 0 if WR+sqrt(-1)*WI are eigenvalues of T (no sort),',
00786 $ ' 1/ulp otherwise', /
00787 $ ' 5 = 0 if T same no matter if VS computed (no sort),',
00788 $ ' 1/ulp otherwise', /
00789 $ ' 6 = 0 if WR, WI same no matter if VS computed (no sort)',
00790 $ ', 1/ulp otherwise' )
00791 9994 FORMAT( ' 7 = 0 if T in Schur form (sort), ', ' 1/ulp otherwise',
00792 $ / ' 8 = | A - VS T transpose(VS) | / ( n |A| ulp ) (sort)',
00793 $ / ' 9 = | I - VS transpose(VS) | / ( n ulp ) (sort) ',
00794 $ / ' 10 = 0 if WR+sqrt(-1)*WI are eigenvalues of T (sort),',
00795 $ ' 1/ulp otherwise', /
00796 $ ' 11 = 0 if T same no matter what else computed (sort),',
00797 $ ' 1/ulp otherwise', /
00798 $ ' 12 = 0 if WR, WI same no matter what else computed ',
00799 $ '(sort), 1/ulp otherwise', /
00800 $ ' 13 = 0 if sorting succesful, 1/ulp otherwise',
00801 $ / ' 14 = 0 if RCONDE same no matter what else computed,',
00802 $ ' 1/ulp otherwise', /
00803 $ ' 15 = 0 if RCONDv same no matter what else computed,',
00804 $ ' 1/ulp otherwise', /
00805 $ ' 16 = | RCONDE - RCONDE(precomputed) | / cond(RCONDE),',
00806 $ / ' 17 = | RCONDV - RCONDV(precomputed) | / cond(RCONDV),' )
00807 9993 FORMAT( ' N=', I5, ', IWK=', I2, ', seed=', 4( I4, ',' ),
00808 $ ' type ', I2, ', test(', I2, ')=', G10.3 )
00809 9992 FORMAT( ' N=', I5, ', input example =', I3, ', test(', I2, ')=',
00810 $ G10.3 )
00811 9991 FORMAT( ' SDRVSX: ', A, ' returned INFO=', I6, '.', / 9X, 'N=',
00812 $ I6, ', JTYPE=', I6, ', ISEED=(', 3( I5, ',' ), I5, ')' )
00813
00814 RETURN
00815
00816
00817
00818 END