00001 SUBROUTINE ZDRGVX( NSIZE, THRESH, NIN, NOUT, A, LDA, B, AI, BI,
00002 $ ALPHA, BETA, VL, VR, ILO, IHI, LSCALE, RSCALE,
00003 $ S, DTRU, DIF, DIFTRU, WORK, LWORK, RWORK,
00004 $ IWORK, LIWORK, RESULT, BWORK, INFO )
00005
00006
00007
00008
00009
00010
00011 INTEGER IHI, ILO, INFO, LDA, LIWORK, LWORK, NIN, NOUT,
00012 $ NSIZE
00013 DOUBLE PRECISION THRESH
00014
00015
00016 LOGICAL BWORK( * )
00017 INTEGER IWORK( * )
00018 DOUBLE PRECISION DIF( * ), DIFTRU( * ), DTRU( * ), LSCALE( * ),
00019 $ RESULT( 4 ), RSCALE( * ), RWORK( * ), S( * )
00020 COMPLEX*16 A( LDA, * ), AI( LDA, * ), ALPHA( * ),
00021 $ B( LDA, * ), BETA( * ), BI( LDA, * ),
00022 $ VL( LDA, * ), VR( LDA, * ), WORK( * )
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 DOUBLE PRECISION ZERO, ONE, TEN, TNTH
00187 PARAMETER ( ZERO = 0.0D+0, ONE = 1.0D+0, TEN = 1.0D+1,
00188 $ TNTH = 1.0D-1 )
00189
00190
00191 INTEGER I, IPTYPE, IWA, IWB, IWX, IWY, J, LINFO,
00192 $ MAXWRK, MINWRK, N, NERRS, NMAX, NPTKNT, NTESTT
00193 DOUBLE PRECISION ABNORM, ANORM, BNORM, RATIO1, RATIO2, THRSH2,
00194 $ ULP, ULPINV
00195
00196
00197 COMPLEX*16 WEIGHT( 5 )
00198
00199
00200 INTEGER ILAENV
00201 DOUBLE PRECISION DLAMCH, ZLANGE
00202 EXTERNAL ILAENV, DLAMCH, ZLANGE
00203
00204
00205 EXTERNAL ALASVM, XERBLA, ZGET52, ZGGEVX, ZLACPY, ZLATM6
00206
00207
00208 INTRINSIC ABS, DCMPLX, MAX, SQRT
00209
00210
00211
00212
00213
00214 INFO = 0
00215
00216 NMAX = 5
00217
00218 IF( NSIZE.LT.0 ) THEN
00219 INFO = -1
00220 ELSE IF( THRESH.LT.ZERO ) THEN
00221 INFO = -2
00222 ELSE IF( NIN.LE.0 ) THEN
00223 INFO = -3
00224 ELSE IF( NOUT.LE.0 ) THEN
00225 INFO = -4
00226 ELSE IF( LDA.LT.1 .OR. LDA.LT.NMAX ) THEN
00227 INFO = -6
00228 ELSE IF( LIWORK.LT.NMAX+2 ) THEN
00229 INFO = -26
00230 END IF
00231
00232
00233
00234
00235
00236
00237
00238
00239 MINWRK = 1
00240 IF( INFO.EQ.0 .AND. LWORK.GE.1 ) THEN
00241 MINWRK = 2*NMAX*( NMAX+1 )
00242 MAXWRK = NMAX*( 1+ILAENV( 1, 'ZGEQRF', ' ', NMAX, 1, NMAX,
00243 $ 0 ) )
00244 MAXWRK = MAX( MAXWRK, 2*NMAX*( NMAX+1 ) )
00245 WORK( 1 ) = MAXWRK
00246 END IF
00247
00248 IF( LWORK.LT.MINWRK )
00249 $ INFO = -23
00250
00251 IF( INFO.NE.0 ) THEN
00252 CALL XERBLA( 'ZDRGVX', -INFO )
00253 RETURN
00254 END IF
00255
00256 N = 5
00257 ULP = DLAMCH( 'P' )
00258 ULPINV = ONE / ULP
00259 THRSH2 = TEN*THRESH
00260 NERRS = 0
00261 NPTKNT = 0
00262 NTESTT = 0
00263
00264 IF( NSIZE.EQ.0 )
00265 $ GO TO 90
00266
00267
00268
00269 WEIGHT( 1 ) = DCMPLX( SQRT( SQRT( ULP ) ), ZERO )
00270 WEIGHT( 2 ) = DCMPLX( TNTH, ZERO )
00271 WEIGHT( 3 ) = ONE
00272 WEIGHT( 4 ) = ONE / WEIGHT( 2 )
00273 WEIGHT( 5 ) = ONE / WEIGHT( 1 )
00274
00275 DO 80 IPTYPE = 1, 2
00276 DO 70 IWA = 1, 5
00277 DO 60 IWB = 1, 5
00278 DO 50 IWX = 1, 5
00279 DO 40 IWY = 1, 5
00280
00281
00282
00283 CALL ZLATM6( IPTYPE, 5, A, LDA, B, VR, LDA, VL,
00284 $ LDA, WEIGHT( IWA ), WEIGHT( IWB ),
00285 $ WEIGHT( IWX ), WEIGHT( IWY ), DTRU,
00286 $ DIFTRU )
00287
00288
00289
00290
00291
00292 CALL ZLACPY( 'F', N, N, A, LDA, AI, LDA )
00293 CALL ZLACPY( 'F', N, N, B, LDA, BI, LDA )
00294
00295 CALL ZGGEVX( 'N', 'V', 'V', 'B', N, AI, LDA, BI,
00296 $ LDA, ALPHA, BETA, VL, LDA, VR, LDA,
00297 $ ILO, IHI, LSCALE, RSCALE, ANORM,
00298 $ BNORM, S, DIF, WORK, LWORK, RWORK,
00299 $ IWORK, BWORK, LINFO )
00300 IF( LINFO.NE.0 ) THEN
00301 WRITE( NOUT, FMT = 9999 )'ZGGEVX', LINFO, N,
00302 $ IPTYPE, IWA, IWB, IWX, IWY
00303 GO TO 30
00304 END IF
00305
00306
00307
00308 CALL ZLACPY( 'Full', N, N, AI, LDA, WORK, N )
00309 CALL ZLACPY( 'Full', N, N, BI, LDA, WORK( N*N+1 ),
00310 $ N )
00311 ABNORM = ZLANGE( 'Fro', N, 2*N, WORK, N, RWORK )
00312
00313
00314
00315 RESULT( 1 ) = ZERO
00316 CALL ZGET52( .TRUE., N, A, LDA, B, LDA, VL, LDA,
00317 $ ALPHA, BETA, WORK, RWORK,
00318 $ RESULT( 1 ) )
00319 IF( RESULT( 2 ).GT.THRESH ) THEN
00320 WRITE( NOUT, FMT = 9998 )'Left', 'ZGGEVX',
00321 $ RESULT( 2 ), N, IPTYPE, IWA, IWB, IWX, IWY
00322 END IF
00323
00324 RESULT( 2 ) = ZERO
00325 CALL ZGET52( .FALSE., N, A, LDA, B, LDA, VR, LDA,
00326 $ ALPHA, BETA, WORK, RWORK,
00327 $ RESULT( 2 ) )
00328 IF( RESULT( 3 ).GT.THRESH ) THEN
00329 WRITE( NOUT, FMT = 9998 )'Right', 'ZGGEVX',
00330 $ RESULT( 3 ), N, IPTYPE, IWA, IWB, IWX, IWY
00331 END IF
00332
00333
00334
00335 RESULT( 3 ) = ZERO
00336 DO 10 I = 1, N
00337 IF( S( I ).EQ.ZERO ) THEN
00338 IF( DTRU( I ).GT.ABNORM*ULP )
00339 $ RESULT( 3 ) = ULPINV
00340 ELSE IF( DTRU( I ).EQ.ZERO ) THEN
00341 IF( S( I ).GT.ABNORM*ULP )
00342 $ RESULT( 3 ) = ULPINV
00343 ELSE
00344 RWORK( I ) = MAX( ABS( DTRU( I ) / S( I ) ),
00345 $ ABS( S( I ) / DTRU( I ) ) )
00346 RESULT( 3 ) = MAX( RESULT( 3 ), RWORK( I ) )
00347 END IF
00348 10 CONTINUE
00349
00350
00351
00352 RESULT( 4 ) = ZERO
00353 IF( DIF( 1 ).EQ.ZERO ) THEN
00354 IF( DIFTRU( 1 ).GT.ABNORM*ULP )
00355 $ RESULT( 4 ) = ULPINV
00356 ELSE IF( DIFTRU( 1 ).EQ.ZERO ) THEN
00357 IF( DIF( 1 ).GT.ABNORM*ULP )
00358 $ RESULT( 4 ) = ULPINV
00359 ELSE IF( DIF( 5 ).EQ.ZERO ) THEN
00360 IF( DIFTRU( 5 ).GT.ABNORM*ULP )
00361 $ RESULT( 4 ) = ULPINV
00362 ELSE IF( DIFTRU( 5 ).EQ.ZERO ) THEN
00363 IF( DIF( 5 ).GT.ABNORM*ULP )
00364 $ RESULT( 4 ) = ULPINV
00365 ELSE
00366 RATIO1 = MAX( ABS( DIFTRU( 1 ) / DIF( 1 ) ),
00367 $ ABS( DIF( 1 ) / DIFTRU( 1 ) ) )
00368 RATIO2 = MAX( ABS( DIFTRU( 5 ) / DIF( 5 ) ),
00369 $ ABS( DIF( 5 ) / DIFTRU( 5 ) ) )
00370 RESULT( 4 ) = MAX( RATIO1, RATIO2 )
00371 END IF
00372
00373 NTESTT = NTESTT + 4
00374
00375
00376
00377 DO 20 J = 1, 4
00378 IF( ( RESULT( J ).GE.THRSH2 .AND. J.GE.4 ) .OR.
00379 $ ( RESULT( J ).GE.THRESH .AND. J.LE.3 ) )
00380 $ THEN
00381
00382
00383
00384
00385 IF( NERRS.EQ.0 ) THEN
00386 WRITE( NOUT, FMT = 9997 )'ZXV'
00387
00388
00389
00390
00391
00392 WRITE( NOUT, FMT = 9995 )
00393 WRITE( NOUT, FMT = 9994 )
00394 WRITE( NOUT, FMT = 9993 )
00395
00396
00397
00398 WRITE( NOUT, FMT = 9992 )'''',
00399 $ 'transpose', ''''
00400
00401 END IF
00402 NERRS = NERRS + 1
00403 IF( RESULT( J ).LT.10000.0D0 ) THEN
00404 WRITE( NOUT, FMT = 9991 )IPTYPE, IWA,
00405 $ IWB, IWX, IWY, J, RESULT( J )
00406 ELSE
00407 WRITE( NOUT, FMT = 9990 )IPTYPE, IWA,
00408 $ IWB, IWX, IWY, J, RESULT( J )
00409 END IF
00410 END IF
00411 20 CONTINUE
00412
00413 30 CONTINUE
00414
00415 40 CONTINUE
00416 50 CONTINUE
00417 60 CONTINUE
00418 70 CONTINUE
00419 80 CONTINUE
00420
00421 GO TO 150
00422
00423 90 CONTINUE
00424
00425
00426
00427
00428 READ( NIN, FMT = *, END = 150 )N
00429 IF( N.EQ.0 )
00430 $ GO TO 150
00431 DO 100 I = 1, N
00432 READ( NIN, FMT = * )( A( I, J ), J = 1, N )
00433 100 CONTINUE
00434 DO 110 I = 1, N
00435 READ( NIN, FMT = * )( B( I, J ), J = 1, N )
00436 110 CONTINUE
00437 READ( NIN, FMT = * )( DTRU( I ), I = 1, N )
00438 READ( NIN, FMT = * )( DIFTRU( I ), I = 1, N )
00439
00440 NPTKNT = NPTKNT + 1
00441
00442
00443
00444
00445
00446 CALL ZLACPY( 'F', N, N, A, LDA, AI, LDA )
00447 CALL ZLACPY( 'F', N, N, B, LDA, BI, LDA )
00448
00449 CALL ZGGEVX( 'N', 'V', 'V', 'B', N, AI, LDA, BI, LDA, ALPHA, BETA,
00450 $ VL, LDA, VR, LDA, ILO, IHI, LSCALE, RSCALE, ANORM,
00451 $ BNORM, S, DIF, WORK, LWORK, RWORK, IWORK, BWORK,
00452 $ LINFO )
00453
00454 IF( LINFO.NE.0 ) THEN
00455 WRITE( NOUT, FMT = 9987 )'ZGGEVX', LINFO, N, NPTKNT
00456 GO TO 140
00457 END IF
00458
00459
00460
00461 CALL ZLACPY( 'Full', N, N, AI, LDA, WORK, N )
00462 CALL ZLACPY( 'Full', N, N, BI, LDA, WORK( N*N+1 ), N )
00463 ABNORM = ZLANGE( 'Fro', N, 2*N, WORK, N, RWORK )
00464
00465
00466
00467 RESULT( 1 ) = ZERO
00468 CALL ZGET52( .TRUE., N, A, LDA, B, LDA, VL, LDA, ALPHA, BETA,
00469 $ WORK, RWORK, RESULT( 1 ) )
00470 IF( RESULT( 2 ).GT.THRESH ) THEN
00471 WRITE( NOUT, FMT = 9986 )'Left', 'ZGGEVX', RESULT( 2 ), N,
00472 $ NPTKNT
00473 END IF
00474
00475 RESULT( 2 ) = ZERO
00476 CALL ZGET52( .FALSE., N, A, LDA, B, LDA, VR, LDA, ALPHA, BETA,
00477 $ WORK, RWORK, RESULT( 2 ) )
00478 IF( RESULT( 3 ).GT.THRESH ) THEN
00479 WRITE( NOUT, FMT = 9986 )'Right', 'ZGGEVX', RESULT( 3 ), N,
00480 $ NPTKNT
00481 END IF
00482
00483
00484
00485 RESULT( 3 ) = ZERO
00486 DO 120 I = 1, N
00487 IF( S( I ).EQ.ZERO ) THEN
00488 IF( DTRU( I ).GT.ABNORM*ULP )
00489 $ RESULT( 3 ) = ULPINV
00490 ELSE IF( DTRU( I ).EQ.ZERO ) THEN
00491 IF( S( I ).GT.ABNORM*ULP )
00492 $ RESULT( 3 ) = ULPINV
00493 ELSE
00494 RWORK( I ) = MAX( ABS( DTRU( I ) / S( I ) ),
00495 $ ABS( S( I ) / DTRU( I ) ) )
00496 RESULT( 3 ) = MAX( RESULT( 3 ), RWORK( I ) )
00497 END IF
00498 120 CONTINUE
00499
00500
00501
00502 RESULT( 4 ) = ZERO
00503 IF( DIF( 1 ).EQ.ZERO ) THEN
00504 IF( DIFTRU( 1 ).GT.ABNORM*ULP )
00505 $ RESULT( 4 ) = ULPINV
00506 ELSE IF( DIFTRU( 1 ).EQ.ZERO ) THEN
00507 IF( DIF( 1 ).GT.ABNORM*ULP )
00508 $ RESULT( 4 ) = ULPINV
00509 ELSE IF( DIF( 5 ).EQ.ZERO ) THEN
00510 IF( DIFTRU( 5 ).GT.ABNORM*ULP )
00511 $ RESULT( 4 ) = ULPINV
00512 ELSE IF( DIFTRU( 5 ).EQ.ZERO ) THEN
00513 IF( DIF( 5 ).GT.ABNORM*ULP )
00514 $ RESULT( 4 ) = ULPINV
00515 ELSE
00516 RATIO1 = MAX( ABS( DIFTRU( 1 ) / DIF( 1 ) ),
00517 $ ABS( DIF( 1 ) / DIFTRU( 1 ) ) )
00518 RATIO2 = MAX( ABS( DIFTRU( 5 ) / DIF( 5 ) ),
00519 $ ABS( DIF( 5 ) / DIFTRU( 5 ) ) )
00520 RESULT( 4 ) = MAX( RATIO1, RATIO2 )
00521 END IF
00522
00523 NTESTT = NTESTT + 4
00524
00525
00526
00527 DO 130 J = 1, 4
00528 IF( RESULT( J ).GE.THRSH2 ) THEN
00529
00530
00531
00532
00533 IF( NERRS.EQ.0 ) THEN
00534 WRITE( NOUT, FMT = 9997 )'ZXV'
00535
00536
00537
00538
00539
00540 WRITE( NOUT, FMT = 9996 )
00541
00542
00543
00544 WRITE( NOUT, FMT = 9992 )'''', 'transpose', ''''
00545
00546 END IF
00547 NERRS = NERRS + 1
00548 IF( RESULT( J ).LT.10000.0D0 ) THEN
00549 WRITE( NOUT, FMT = 9989 )NPTKNT, N, J, RESULT( J )
00550 ELSE
00551 WRITE( NOUT, FMT = 9988 )NPTKNT, N, J, RESULT( J )
00552 END IF
00553 END IF
00554 130 CONTINUE
00555
00556 140 CONTINUE
00557
00558 GO TO 90
00559 150 CONTINUE
00560
00561
00562
00563 CALL ALASVM( 'ZXV', NOUT, NERRS, NTESTT, 0 )
00564
00565 WORK( 1 ) = MAXWRK
00566
00567 RETURN
00568
00569 9999 FORMAT( ' ZDRGVX: ', A, ' returned INFO=', I6, '.', / 9X, 'N=',
00570 $ I6, ', JTYPE=', I6, ')' )
00571
00572 9998 FORMAT( ' ZDRGVX: ', A, ' Eigenvectors from ', A, ' incorrectly ',
00573 $ 'normalized.', / ' Bits of error=', 0P, G10.3, ',', 9X,
00574 $ 'N=', I6, ', JTYPE=', I6, ', IWA=', I5, ', IWB=', I5,
00575 $ ', IWX=', I5, ', IWY=', I5 )
00576
00577 9997 FORMAT( / 1X, A3, ' -- Complex Expert Eigenvalue/vector',
00578 $ ' problem driver' )
00579
00580 9996 FORMAT( 'Input Example' )
00581
00582 9995 FORMAT( ' Matrix types: ', / )
00583
00584 9994 FORMAT( ' TYPE 1: Da is diagonal, Db is identity, ',
00585 $ / ' A = Y^(-H) Da X^(-1), B = Y^(-H) Db X^(-1) ',
00586 $ / ' YH and X are left and right eigenvectors. ', / )
00587
00588 9993 FORMAT( ' TYPE 2: Da is quasi-diagonal, Db is identity, ',
00589 $ / ' A = Y^(-H) Da X^(-1), B = Y^(-H) Db X^(-1) ',
00590 $ / ' YH and X are left and right eigenvectors. ', / )
00591
00592 9992 FORMAT( / ' Tests performed: ', / 4X,
00593 $ ' a is alpha, b is beta, l is a left eigenvector, ', / 4X,
00594 $ ' r is a right eigenvector and ', A, ' means ', A, '.',
00595 $ / ' 1 = max | ( b A - a B )', A, ' l | / const.',
00596 $ / ' 2 = max | ( b A - a B ) r | / const.',
00597 $ / ' 3 = max ( Sest/Stru, Stru/Sest ) ',
00598 $ ' over all eigenvalues', /
00599 $ ' 4 = max( DIFest/DIFtru, DIFtru/DIFest ) ',
00600 $ ' over the 1st and 5th eigenvectors', / )
00601
00602 9991 FORMAT( ' Type=', I2, ',', ' IWA=', I2, ', IWB=', I2, ', IWX=',
00603 $ I2, ', IWY=', I2, ', result ', I2, ' is', 0P, F8.2 )
00604
00605 9990 FORMAT( ' Type=', I2, ',', ' IWA=', I2, ', IWB=', I2, ', IWX=',
00606 $ I2, ', IWY=', I2, ', result ', I2, ' is', 1P, D10.3 )
00607
00608 9989 FORMAT( ' Input example #', I2, ', matrix order=', I4, ',',
00609 $ ' result ', I2, ' is', 0P, F8.2 )
00610
00611 9988 FORMAT( ' Input example #', I2, ', matrix order=', I4, ',',
00612 $ ' result ', I2, ' is', 1P, D10.3 )
00613
00614 9987 FORMAT( ' ZDRGVX: ', A, ' returned INFO=', I6, '.', / 9X, 'N=',
00615 $ I6, ', Input example #', I2, ')' )
00616
00617 9986 FORMAT( ' ZDRGVX: ', A, ' Eigenvectors from ', A, ' incorrectly ',
00618 $ 'normalized.', / ' Bits of error=', 0P, G10.3, ',', 9X,
00619 $ 'N=', I6, ', Input Example #', I2, ')' )
00620
00621
00622
00623 END