00001 SUBROUTINE ZDRVSX( NSIZES, NN, NTYPES, DOTYPE, ISEED, THRESH,
00002 $ NIUNIT, NOUNIT, A, LDA, H, HT, W, WT, WTMP, VS,
00003 $ LDVS, VS1, RESULT, WORK, LWORK, RWORK, BWORK,
00004 $ INFO )
00005
00006
00007
00008
00009
00010
00011 INTEGER INFO, LDA, LDVS, LWORK, NIUNIT, NOUNIT, NSIZES,
00012 $ NTYPES
00013 DOUBLE PRECISION THRESH
00014
00015
00016 LOGICAL BWORK( * ), DOTYPE( * )
00017 INTEGER ISEED( 4 ), NN( * )
00018 DOUBLE PRECISION RESULT( 17 ), RWORK( * )
00019 COMPLEX*16 A( LDA, * ), H( LDA, * ), HT( LDA, * ),
00020 $ VS( LDVS, * ), VS1( LDVS, * ), W( * ),
00021 $ WORK( * ), WT( * ), WTMP( * )
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 COMPLEX*16 CZERO
00342 PARAMETER ( CZERO = ( 0.0D+0, 0.0D+0 ) )
00343 COMPLEX*16 CONE
00344 PARAMETER ( CONE = ( 1.0D+0, 0.0D+0 ) )
00345 DOUBLE PRECISION ZERO, ONE
00346 PARAMETER ( ZERO = 0.0D+0, ONE = 1.0D+0 )
00347 INTEGER MAXTYP
00348 PARAMETER ( MAXTYP = 21 )
00349
00350
00351 LOGICAL BADNN
00352 CHARACTER*3 PATH
00353 INTEGER I, IINFO, IMODE, ISRT, ITYPE, IWK, J, JCOL,
00354 $ JSIZE, JTYPE, MTYPES, N, NERRS, NFAIL, NMAX,
00355 $ NNWORK, NSLCT, NTEST, NTESTF, NTESTT
00356 DOUBLE PRECISION ANORM, COND, CONDS, OVFL, RCDEIN, RCDVIN,
00357 $ RTULP, RTULPI, ULP, ULPINV, UNFL
00358
00359
00360 INTEGER IDUMMA( 1 ), IOLDSD( 4 ), ISLCT( 20 ),
00361 $ KCONDS( MAXTYP ), KMAGN( MAXTYP ),
00362 $ KMODE( MAXTYP ), KTYPE( MAXTYP )
00363
00364
00365 LOGICAL SELVAL( 20 )
00366 DOUBLE PRECISION SELWI( 20 ), SELWR( 20 )
00367
00368
00369 INTEGER SELDIM, SELOPT
00370
00371
00372 COMMON / SSLCT / SELOPT, SELDIM, SELVAL, SELWR, SELWI
00373
00374
00375 DOUBLE PRECISION DLAMCH
00376 EXTERNAL DLAMCH
00377
00378
00379 EXTERNAL DLABAD, DLASUM, XERBLA, ZGET24, ZLASET, ZLATME,
00380 $ ZLATMR, ZLATMS
00381
00382
00383 INTRINSIC ABS, MAX, MIN, SQRT
00384
00385
00386 DATA KTYPE / 1, 2, 3, 5*4, 4*6, 6*6, 3*9 /
00387 DATA KMAGN / 3*1, 1, 1, 1, 2, 3, 4*1, 1, 1, 1, 1, 2,
00388 $ 3, 1, 2, 3 /
00389 DATA KMODE / 3*0, 4, 3, 1, 4, 4, 4, 3, 1, 5, 4, 3,
00390 $ 1, 5, 5, 5, 4, 3, 1 /
00391 DATA KCONDS / 3*0, 5*0, 4*1, 6*2, 3*0 /
00392
00393
00394
00395 PATH( 1: 1 ) = 'Zomplex precision'
00396 PATH( 2: 3 ) = 'SX'
00397
00398
00399
00400 NTESTT = 0
00401 NTESTF = 0
00402 INFO = 0
00403
00404
00405
00406 BADNN = .FALSE.
00407
00408
00409
00410
00411 NMAX = 8
00412 DO 10 J = 1, NSIZES
00413 NMAX = MAX( NMAX, NN( J ) )
00414 IF( NN( J ).LT.0 )
00415 $ BADNN = .TRUE.
00416 10 CONTINUE
00417
00418
00419
00420 IF( NSIZES.LT.0 ) THEN
00421 INFO = -1
00422 ELSE IF( BADNN ) THEN
00423 INFO = -2
00424 ELSE IF( NTYPES.LT.0 ) THEN
00425 INFO = -3
00426 ELSE IF( THRESH.LT.ZERO ) THEN
00427 INFO = -6
00428 ELSE IF( NIUNIT.LE.0 ) THEN
00429 INFO = -7
00430 ELSE IF( NOUNIT.LE.0 ) THEN
00431 INFO = -8
00432 ELSE IF( LDA.LT.1 .OR. LDA.LT.NMAX ) THEN
00433 INFO = -10
00434 ELSE IF( LDVS.LT.1 .OR. LDVS.LT.NMAX ) THEN
00435 INFO = -20
00436 ELSE IF( MAX( 3*NMAX, 2*NMAX**2 ).GT.LWORK ) THEN
00437 INFO = -24
00438 END IF
00439
00440 IF( INFO.NE.0 ) THEN
00441 CALL XERBLA( 'ZDRVSX', -INFO )
00442 RETURN
00443 END IF
00444
00445
00446
00447 IF( NSIZES.EQ.0 .OR. NTYPES.EQ.0 )
00448 $ GO TO 150
00449
00450
00451
00452 UNFL = DLAMCH( 'Safe minimum' )
00453 OVFL = ONE / UNFL
00454 CALL DLABAD( UNFL, OVFL )
00455 ULP = DLAMCH( 'Precision' )
00456 ULPINV = ONE / ULP
00457 RTULP = SQRT( ULP )
00458 RTULPI = ONE / RTULP
00459
00460
00461
00462 NERRS = 0
00463
00464 DO 140 JSIZE = 1, NSIZES
00465 N = NN( JSIZE )
00466 IF( NSIZES.NE.1 ) THEN
00467 MTYPES = MIN( MAXTYP, NTYPES )
00468 ELSE
00469 MTYPES = MIN( MAXTYP+1, NTYPES )
00470 END IF
00471
00472 DO 130 JTYPE = 1, MTYPES
00473 IF( .NOT.DOTYPE( JTYPE ) )
00474 $ GO TO 130
00475
00476
00477
00478 DO 20 J = 1, 4
00479 IOLDSD( J ) = ISEED( J )
00480 20 CONTINUE
00481
00482
00483
00484
00485
00486
00487
00488
00489
00490
00491
00492
00493
00494
00495
00496
00497
00498 IF( MTYPES.GT.MAXTYP )
00499 $ GO TO 90
00500
00501 ITYPE = KTYPE( JTYPE )
00502 IMODE = KMODE( JTYPE )
00503
00504
00505
00506 GO TO ( 30, 40, 50 )KMAGN( JTYPE )
00507
00508 30 CONTINUE
00509 ANORM = ONE
00510 GO TO 60
00511
00512 40 CONTINUE
00513 ANORM = OVFL*ULP
00514 GO TO 60
00515
00516 50 CONTINUE
00517 ANORM = UNFL*ULPINV
00518 GO TO 60
00519
00520 60 CONTINUE
00521
00522 CALL ZLASET( 'Full', LDA, N, CZERO, CZERO, A, LDA )
00523 IINFO = 0
00524 COND = ULPINV
00525
00526
00527
00528 IF( ITYPE.EQ.1 ) THEN
00529
00530
00531
00532 IINFO = 0
00533
00534 ELSE IF( ITYPE.EQ.2 ) THEN
00535
00536
00537
00538 DO 70 JCOL = 1, N
00539 A( JCOL, JCOL ) = ANORM
00540 70 CONTINUE
00541
00542 ELSE IF( ITYPE.EQ.3 ) THEN
00543
00544
00545
00546 DO 80 JCOL = 1, N
00547 A( JCOL, JCOL ) = ANORM
00548 IF( JCOL.GT.1 )
00549 $ A( JCOL, JCOL-1 ) = CONE
00550 80 CONTINUE
00551
00552 ELSE IF( ITYPE.EQ.4 ) THEN
00553
00554
00555
00556 CALL ZLATMS( N, N, 'S', ISEED, 'H', RWORK, IMODE, COND,
00557 $ ANORM, 0, 0, 'N', A, LDA, WORK( N+1 ),
00558 $ IINFO )
00559
00560 ELSE IF( ITYPE.EQ.5 ) THEN
00561
00562
00563
00564 CALL ZLATMS( N, N, 'S', ISEED, 'H', RWORK, IMODE, COND,
00565 $ ANORM, N, N, 'N', A, LDA, WORK( N+1 ),
00566 $ IINFO )
00567
00568 ELSE IF( ITYPE.EQ.6 ) THEN
00569
00570
00571
00572 IF( KCONDS( JTYPE ).EQ.1 ) THEN
00573 CONDS = ONE
00574 ELSE IF( KCONDS( JTYPE ).EQ.2 ) THEN
00575 CONDS = RTULPI
00576 ELSE
00577 CONDS = ZERO
00578 END IF
00579
00580 CALL ZLATME( N, 'D', ISEED, WORK, IMODE, COND, CONE, ' ',
00581 $ 'T', 'T', 'T', RWORK, 4, CONDS, N, N, ANORM,
00582 $ A, LDA, WORK( 2*N+1 ), IINFO )
00583
00584 ELSE IF( ITYPE.EQ.7 ) THEN
00585
00586
00587
00588 CALL ZLATMR( N, N, 'D', ISEED, 'N', WORK, 6, ONE, CONE,
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, IDUMMA, IINFO )
00592
00593 ELSE IF( ITYPE.EQ.8 ) THEN
00594
00595
00596
00597 CALL ZLATMR( N, N, 'D', ISEED, 'H', WORK, 6, ONE, CONE,
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, IDUMMA, IINFO )
00601
00602 ELSE IF( ITYPE.EQ.9 ) THEN
00603
00604
00605
00606 CALL ZLATMR( N, N, 'D', ISEED, 'N', WORK, 6, ONE, CONE,
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, IDUMMA, IINFO )
00610 IF( N.GE.4 ) THEN
00611 CALL ZLASET( 'Full', 2, N, CZERO, CZERO, A, LDA )
00612 CALL ZLASET( 'Full', N-3, 1, CZERO, CZERO, A( 3, 1 ),
00613 $ LDA )
00614 CALL ZLASET( 'Full', N-3, 2, CZERO, CZERO,
00615 $ A( 3, N-1 ), LDA )
00616 CALL ZLASET( 'Full', 1, N, CZERO, CZERO, A( N, 1 ),
00617 $ LDA )
00618 END IF
00619
00620 ELSE IF( ITYPE.EQ.10 ) THEN
00621
00622
00623
00624 CALL ZLATMR( N, N, 'D', ISEED, 'N', WORK, 6, ONE, CONE,
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, IDUMMA, 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 = 2*N
00648 ELSE
00649 NNWORK = MAX( 2*N, N*( N+1 ) / 2 )
00650 END IF
00651 NNWORK = MAX( NNWORK, 1 )
00652
00653 CALL ZGET24( .FALSE., JTYPE, THRESH, IOLDSD, NOUNIT, N,
00654 $ A, LDA, H, HT, W, WT, WTMP, VS, LDVS, VS1,
00655 $ RCDEIN, RCDVIN, NSLCT, ISLCT, 0, RESULT,
00656 $ WORK, NNWORK, RWORK, BWORK, INFO )
00657
00658
00659
00660 NTEST = 0
00661 NFAIL = 0
00662 DO 100 J = 1, 15
00663 IF( RESULT( J ).GE.ZERO )
00664 $ NTEST = NTEST + 1
00665 IF( RESULT( J ).GE.THRESH )
00666 $ NFAIL = NFAIL + 1
00667 100 CONTINUE
00668
00669 IF( NFAIL.GT.0 )
00670 $ NTESTF = NTESTF + 1
00671 IF( NTESTF.EQ.1 ) THEN
00672 WRITE( NOUNIT, FMT = 9999 )PATH
00673 WRITE( NOUNIT, FMT = 9998 )
00674 WRITE( NOUNIT, FMT = 9997 )
00675 WRITE( NOUNIT, FMT = 9996 )
00676 WRITE( NOUNIT, FMT = 9995 )THRESH
00677 WRITE( NOUNIT, FMT = 9994 )
00678 NTESTF = 2
00679 END IF
00680
00681 DO 110 J = 1, 15
00682 IF( RESULT( J ).GE.THRESH ) THEN
00683 WRITE( NOUNIT, FMT = 9993 )N, IWK, IOLDSD, JTYPE,
00684 $ J, RESULT( J )
00685 END IF
00686 110 CONTINUE
00687
00688 NERRS = NERRS + NFAIL
00689 NTESTT = NTESTT + NTEST
00690
00691 120 CONTINUE
00692 130 CONTINUE
00693 140 CONTINUE
00694
00695 150 CONTINUE
00696
00697
00698
00699
00700 JTYPE = 0
00701 160 CONTINUE
00702 READ( NIUNIT, FMT = *, END = 200 )N, NSLCT, ISRT
00703 IF( N.EQ.0 )
00704 $ GO TO 200
00705 JTYPE = JTYPE + 1
00706 ISEED( 1 ) = JTYPE
00707 READ( NIUNIT, FMT = * )( ISLCT( I ), I = 1, NSLCT )
00708 DO 170 I = 1, N
00709 READ( NIUNIT, FMT = * )( A( I, J ), J = 1, N )
00710 170 CONTINUE
00711 READ( NIUNIT, FMT = * )RCDEIN, RCDVIN
00712
00713 CALL ZGET24( .TRUE., 22, THRESH, ISEED, NOUNIT, N, A, LDA, H, HT,
00714 $ W, WT, WTMP, VS, LDVS, VS1, RCDEIN, RCDVIN, NSLCT,
00715 $ ISLCT, ISRT, RESULT, WORK, LWORK, RWORK, BWORK,
00716 $ INFO )
00717
00718
00719
00720 NTEST = 0
00721 NFAIL = 0
00722 DO 180 J = 1, 17
00723 IF( RESULT( J ).GE.ZERO )
00724 $ NTEST = NTEST + 1
00725 IF( RESULT( J ).GE.THRESH )
00726 $ NFAIL = NFAIL + 1
00727 180 CONTINUE
00728
00729 IF( NFAIL.GT.0 )
00730 $ NTESTF = NTESTF + 1
00731 IF( NTESTF.EQ.1 ) THEN
00732 WRITE( NOUNIT, FMT = 9999 )PATH
00733 WRITE( NOUNIT, FMT = 9998 )
00734 WRITE( NOUNIT, FMT = 9997 )
00735 WRITE( NOUNIT, FMT = 9996 )
00736 WRITE( NOUNIT, FMT = 9995 )THRESH
00737 WRITE( NOUNIT, FMT = 9994 )
00738 NTESTF = 2
00739 END IF
00740 DO 190 J = 1, 17
00741 IF( RESULT( J ).GE.THRESH ) THEN
00742 WRITE( NOUNIT, FMT = 9992 )N, JTYPE, J, RESULT( J )
00743 END IF
00744 190 CONTINUE
00745
00746 NERRS = NERRS + NFAIL
00747 NTESTT = NTESTT + NTEST
00748 GO TO 160
00749 200 CONTINUE
00750
00751
00752
00753 CALL DLASUM( PATH, NOUNIT, NERRS, NTESTT )
00754
00755 9999 FORMAT( / 1X, A3, ' -- Complex Schur Form Decomposition Expert ',
00756 $ 'Driver', / ' Matrix types (see ZDRVSX for details): ' )
00757
00758 9998 FORMAT( / ' Special Matrices:', / ' 1=Zero matrix. ',
00759 $ ' ', ' 5=Diagonal: geometr. spaced entries.',
00760 $ / ' 2=Identity matrix. ', ' 6=Diagona',
00761 $ 'l: clustered entries.', / ' 3=Transposed Jordan block. ',
00762 $ ' ', ' 7=Diagonal: large, evenly spaced.', / ' ',
00763 $ '4=Diagonal: evenly spaced entries. ', ' 8=Diagonal: s',
00764 $ 'mall, evenly spaced.' )
00765 9997 FORMAT( ' Dense, Non-Symmetric Matrices:', / ' 9=Well-cond., ev',
00766 $ 'enly spaced eigenvals.', ' 14=Ill-cond., geomet. spaced e',
00767 $ 'igenals.', / ' 10=Well-cond., geom. spaced eigenvals. ',
00768 $ ' 15=Ill-conditioned, clustered e.vals.', / ' 11=Well-cond',
00769 $ 'itioned, clustered e.vals. ', ' 16=Ill-cond., random comp',
00770 $ 'lex ', / ' 12=Well-cond., random complex ', ' ',
00771 $ ' 17=Ill-cond., large rand. complx ', / ' 13=Ill-condi',
00772 $ 'tioned, evenly spaced. ', ' 18=Ill-cond., small rand.',
00773 $ ' complx ' )
00774 9996 FORMAT( ' 19=Matrix with random O(1) entries. ', ' 21=Matrix ',
00775 $ 'with small random entries.', / ' 20=Matrix with large ran',
00776 $ 'dom entries. ', / )
00777 9995 FORMAT( ' Tests performed with test threshold =', F8.2,
00778 $ / ' ( A denotes A on input and T denotes A on output)',
00779 $ / / ' 1 = 0 if T in Schur form (no sort), ',
00780 $ ' 1/ulp otherwise', /
00781 $ ' 2 = | A - VS T transpose(VS) | / ( n |A| ulp ) (no sort)',
00782 $ / ' 3 = | I - VS transpose(VS) | / ( n ulp ) (no sort) ',
00783 $ / ' 4 = 0 if W are eigenvalues of T (no sort),',
00784 $ ' 1/ulp otherwise', /
00785 $ ' 5 = 0 if T same no matter if VS computed (no sort),',
00786 $ ' 1/ulp otherwise', /
00787 $ ' 6 = 0 if W same no matter if VS computed (no sort)',
00788 $ ', 1/ulp otherwise' )
00789 9994 FORMAT( ' 7 = 0 if T in Schur form (sort), ', ' 1/ulp otherwise',
00790 $ / ' 8 = | A - VS T transpose(VS) | / ( n |A| ulp ) (sort)',
00791 $ / ' 9 = | I - VS transpose(VS) | / ( n ulp ) (sort) ',
00792 $ / ' 10 = 0 if W are eigenvalues of T (sort),',
00793 $ ' 1/ulp otherwise', /
00794 $ ' 11 = 0 if T same no matter what else computed (sort),',
00795 $ ' 1/ulp otherwise', /
00796 $ ' 12 = 0 if W same no matter what else computed ',
00797 $ '(sort), 1/ulp otherwise', /
00798 $ ' 13 = 0 if sorting succesful, 1/ulp otherwise',
00799 $ / ' 14 = 0 if RCONDE same no matter what else computed,',
00800 $ ' 1/ulp otherwise', /
00801 $ ' 15 = 0 if RCONDv same no matter what else computed,',
00802 $ ' 1/ulp otherwise', /
00803 $ ' 16 = | RCONDE - RCONDE(precomputed) | / cond(RCONDE),',
00804 $ / ' 17 = | RCONDV - RCONDV(precomputed) | / cond(RCONDV),' )
00805 9993 FORMAT( ' N=', I5, ', IWK=', I2, ', seed=', 4( I4, ',' ),
00806 $ ' type ', I2, ', test(', I2, ')=', G10.3 )
00807 9992 FORMAT( ' N=', I5, ', input example =', I3, ', test(', I2, ')=',
00808 $ G10.3 )
00809 9991 FORMAT( ' ZDRVSX: ', A, ' returned INFO=', I6, '.', / 9X, 'N=',
00810 $ I6, ', JTYPE=', I6, ', ISEED=(', 3( I5, ',' ), I5, ')' )
00811
00812 RETURN
00813
00814
00815
00816 END