1
       2
       3
       4
       5
       6
       7
       8
       9
      10
      11
      12
      13
      14
      15
      16
      17
      18
      19
      20
      21
      22
      23
      24
      25
      26
      27
      28
      29
      30
      31
      32
      33
      34
      35
      36
      37
      38
      39
      40
      41
      42
      43
      44
      45
      46
      47
      48
      49
      50
      51
      52
      53
      54
      55
      56
      57
      58
      59
      60
      61
      62
      63
      64
      65
      66
      67
      68
      69
      70
      71
      72
      73
      74
      75
      76
      77
      78
      79
      80
      81
      82
      83
      84
      85
      86
      87
      88
      89
      90
      91
      92
      93
      94
      95
      96
      97
      98
      99
     100
     101
     102
     103
     104
     105
     106
     107
     108
     109
     110
     111
     112
     113
     114
     115
     116
     117
     118
     119
     120
     121
     122
     123
     124
     125
     126
     127
     128
     129
     130
     131
     132
     133
     134
     135
     136
     137
     138
     139
     140
     141
     142
     143
     144
     145
     146
     147
     148
     149
     150
     151
     152
     153
     154
     155
     156
     157
     158
     159
     160
     161
     162
     163
     164
     165
     166
     167
     168
     169
     170
     171
     172
     173
     174
     175
     176
     177
     178
     179
     180
     181
     182
     183
     184
     185
     186
     187
     188
     189
     190
     191
     192
     193
     194
     195
     196
     197
     198
     199
     200
     201
     202
     203
     204
     205
     206
     207
     208
     209
     210
     211
     212
     213
     214
     215
     216
     217
     218
     219
     220
     221
     222
     223
     224
     225
     226
     227
     228
     229
     230
     231
     232
     233
     234
     235
     236
     237
     238
     239
     240
     241
     242
     243
     244
     245
     246
     247
     248
     249
     250
     251
     252
     253
     254
     255
     256
     257
     258
     259
     260
     261
     262
     263
     264
     265
     266
     267
     268
     269
     270
     271
     272
     273
     274
     275
     276
     277
     278
     279
     280
     281
     282
     283
     284
     285
     286
     287
     288
     289
     290
     291
     292
     293
     294
     295
     296
     297
     298
     299
     300
     301
     302
     303
     304
     305
     306
     307
     308
     309
     310
     311
     312
     313
     314
     315
     316
     317
     318
     319
     320
     321
     322
     323
     324
     325
     326
     327
     328
     329
     330
     331
     332
     333
     334
     335
     336
     337
     338
     339
     340
     341
     342
     343
     344
     345
     346
     347
     348
     349
     350
     351
     352
     353
     354
     355
     356
     357
     358
     359
     360
     361
     362
     363
     364
     365
     366
     367
     368
     369
     370
     371
     372
     373
     374
     375
     376
     377
     378
     379
     380
     381
     382
     383
     384
     385
     386
     387
     388
     389
     390
     391
     392
     393
     394
     395
     396
     397
     398
     399
     400
     401
     402
     403
     404
     405
     406
     407
     408
     409
     410
     411
     412
     413
     414
     415
     416
     417
     418
     419
     420
     421
     422
     423
     424
     425
     426
     427
     428
     429
     430
     431
     432
     433
     434
     435
     436
     437
     438
     439
     440
     441
     442
     443
     444
     445
     446
     447
     448
     449
     450
     451
     452
     453
     454
     455
     456
     457
     458
     459
     460
     461
     462
     463
     464
     465
     466
     467
     468
     469
     470
     471
     472
     473
     474
     475
     476
     477
     478
     479
     480
     481
     482
     483
     484
     485
     486
     487
     488
     489
     490
     491
     492
     493
     494
     495
     496
     497
     498
     499
     500
     501
     502
     503
     504
     505
     506
     507
     508
     509
     510
     511
     512
     513
     514
     515
     516
     517
     518
     519
     520
     521
     522
     523
     524
     525
     526
     527
     528
     529
     530
     531
     532
     533
     534
     535
     536
     537
     538
     539
     540
     541
     542
     543
     544
     545
     546
     547
     548
     549
     550
     551
     552
     553
     554
     555
     556
     557
     558
     559
     560
     561
     562
     563
     564
     565
     566
     567
     568
     569
     570
     571
     572
     573
     574
     575
     576
     577
     578
     579
     580
     581
     582
     583
     584
     585
     586
     587
     588
     589
     590
     591
     592
     593
     594
     595
     596
     597
     598
     599
     600
     601
     602
     603
     604
     605
     606
     607
     608
     609
     610
     611
     612
     613
     614
     615
     616
     617
     618
     619
     620
     621
     622
     623
     624
      SUBROUTINE DDRGVXNSIZETHRESHNINNOUTALDABAIBI,
     $                   ALPHARALPHAIBETAVLVRILOIHILSCALE,
     $                   RSCALESDTRUDIFDIFTRUWORKLWORK,
     $                   IWORKLIWORKRESULTBWORKINFO )
*
*  -- LAPACK test routine (version 3.1) --
*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
*     November 2006
*
*     .. Scalar Arguments ..
      INTEGER            IHIILOINFOLDALIWORKLWORKNINNOUT,
     $                   NSIZE
      DOUBLE PRECISION   THRESH
*     ..
*     .. Array Arguments ..
      LOGICAL            BWORK* )
      INTEGER            IWORK* )
      DOUBLE PRECISION   ALDA* ), AILDA* ), ALPHAI* ),
     $                   ALPHAR* ), BLDA* ), BETA* ),
     $                   BILDA* ), DIF* ), DIFTRU* ), DTRU* ),
     $                   LSCALE* ), RESULT4 ), RSCALE* ), S* ),
     $                   VLLDA* ), VRLDA* ), WORK* )
*     ..
*
*  Purpose
*  =======
*
*  DDRGVX checks the nonsymmetric generalized eigenvalue problem
*  expert driver DGGEVX.
*
*  DGGEVX computes the generalized eigenvalues, (optionally) the left
*  and/or right eigenvectors, (optionally) computes a balancing
*  transformation to improve the conditioning, and (optionally)
*  reciprocal condition numbers for the eigenvalues and eigenvectors.
*
*  When DDRGVX is called with NSIZE > 0, two types of test matrix pairs
*  are generated by the subroutine DLATM6 and test the driver DGGEVX.
*  The test matrices have the known exact condition numbers for
*  eigenvalues. For the condition numbers of the eigenvectors
*  corresponding the first and last eigenvalues are also know
*  ``exactly'' (see DLATM6).
*
*  For each matrix pair, the following tests will be performed and
*  compared with the threshhold THRESH.
*
*  (1) max over all left eigenvalue/-vector pairs (beta/alpha,l) of
*
*     | l**H * (beta A - alpha B) | / ( ulp max( |beta A|, |alpha B| ) )
*
*      where l**H is the conjugate tranpose of l.
*
*  (2) max over all right eigenvalue/-vector pairs (beta/alpha,r) of
*
*        | (beta A - alpha B) r | / ( ulp max( |beta A|, |alpha B| ) )
*
*  (3) The condition number S(i) of eigenvalues computed by DGGEVX
*      differs less than a factor THRESH from the exact S(i) (see
*      DLATM6).
*
*  (4) DIF(i) computed by DTGSNA differs less than a factor 10*THRESH
*      from the exact value (for the 1st and 5th vectors only).
*
*  Test Matrices
*  =============
*
*  Two kinds of test matrix pairs
*
*           (A, B) = inverse(YH) * (Da, Db) * inverse(X)
*
*  are used in the tests:
*
*  1: Da = 1+a   0    0    0    0    Db = 1   0   0   0   0
*           0   2+a   0    0    0         0   1   0   0   0
*           0    0   3+a   0    0         0   0   1   0   0
*           0    0    0   4+a   0         0   0   0   1   0
*           0    0    0    0   5+a ,      0   0   0   0   1 , and
*
*  2: Da =  1   -1    0    0    0    Db = 1   0   0   0   0
*           1    1    0    0    0         0   1   0   0   0
*           0    0    1    0    0         0   0   1   0   0
*           0    0    0   1+a  1+b        0   0   0   1   0
*           0    0    0  -1-b  1+a ,      0   0   0   0   1 .
*
*  In both cases the same inverse(YH) and inverse(X) are used to compute
*  (A, B), giving the exact eigenvectors to (A,B) as (YH, X):
*
*  YH:  =  1    0   -y    y   -y    X =  1   0  -x  -x   x
*          0    1   -y    y   -y         0   1   x  -x  -x
*          0    0    1    0    0         0   0   1   0   0
*          0    0    0    1    0         0   0   0   1   0
*          0    0    0    0    1,        0   0   0   0   1 , where
*
*  a, b, x and y will have all values independently of each other from
*  { sqrt(sqrt(ULP)),  0.1,  1,  10,  1/sqrt(sqrt(ULP)) }.
*
*  Arguments
*  =========
*
*  NSIZE   (input) INTEGER
*          The number of sizes of matrices to use.  NSIZE must be at
*          least zero. If it is zero, no randomly generated matrices
*          are tested, but any test matrices read from NIN will be
*          tested.
*
*  THRESH  (input) DOUBLE PRECISION
*          A test will count as "failed" if the "error", computed as
*          described above, exceeds THRESH.  Note that the error
*          is scaled to be O(1), so THRESH should be a reasonably
*          small multiple of 1, e.g., 10 or 100.  In particular,
*          it should not depend on the precision (single vs. double)
*          or the size of the matrix.  It must be at least zero.
*
*  NIN     (input) INTEGER
*          The FORTRAN unit number for reading in the data file of
*          problems to solve.
*
*  NOUT    (input) INTEGER
*          The FORTRAN unit number for printing out error messages
*          (e.g., if a routine returns IINFO not equal to 0.)
*
*  A       (workspace) DOUBLE PRECISION array, dimension (LDA, NSIZE)
*          Used to hold the matrix whose eigenvalues are to be
*          computed.  On exit, A contains the last matrix actually used.
*
*  LDA     (input) INTEGER
*          The leading dimension of A, B, AI, BI, Ao, and Bo.
*          It must be at least 1 and at least NSIZE.
*
*  B       (workspace) DOUBLE PRECISION array, dimension (LDA, NSIZE)
*          Used to hold the matrix whose eigenvalues are to be
*          computed.  On exit, B contains the last matrix actually used.
*
*  AI      (workspace) DOUBLE PRECISION array, dimension (LDA, NSIZE)
*          Copy of A, modified by DGGEVX.
*
*  BI      (workspace) DOUBLE PRECISION array, dimension (LDA, NSIZE)
*          Copy of B, modified by DGGEVX.
*
*  ALPHAR  (workspace) DOUBLE PRECISION array, dimension (NSIZE)
*  ALPHAI  (workspace) DOUBLE PRECISION array, dimension (NSIZE)
*  BETA    (workspace) DOUBLE PRECISION array, dimension (NSIZE)
*          On exit, (ALPHAR + ALPHAI*i)/BETA are the eigenvalues.
*
*  VL      (workspace) DOUBLE PRECISION array, dimension (LDA, NSIZE)
*          VL holds the left eigenvectors computed by DGGEVX.
*
*  VR      (workspace) DOUBLE PRECISION array, dimension (LDA, NSIZE)
*          VR holds the right eigenvectors computed by DGGEVX.
*
*  ILO     (output/workspace) INTEGER
*
*  IHI     (output/workspace) INTEGER
*
*  LSCALE  (output/workspace) DOUBLE PRECISION array, dimension (N)
*
*  RSCALE  (output/workspace) DOUBLE PRECISION array, dimension (N)
*
*  S       (output/workspace) DOUBLE PRECISION array, dimension (N)
*
*  DTRU    (output/workspace) DOUBLE PRECISION array, dimension (N)
*
*  DIF     (output/workspace) DOUBLE PRECISION array, dimension (N)
*
*  DIFTRU  (output/workspace) DOUBLE PRECISION array, dimension (N)
*
*  WORK    (workspace) DOUBLE PRECISION array, dimension (LWORK)
*
*  LWORK   (input) INTEGER
*          Leading dimension of WORK.  LWORK >= 2*N*N+12*N+16.
*
*  IWORK   (workspace) INTEGER array, dimension (LIWORK)
*
*  LIWORK  (input) INTEGER
*          Leading dimension of IWORK.  Must be at least N+6.
*
*  RESULT  (output/workspace) DOUBLE PRECISION array, dimension (4)
*
*  BWORK   (workspace) LOGICAL array, dimension (N)
*
*  INFO    (output) INTEGER
*          = 0:  successful exit
*          < 0:  if INFO = -i, the i-th argument had an illegal value.
*          > 0:  A routine returned an error code.
*
*  =====================================================================
*
*     .. Parameters ..
      DOUBLE PRECISION   ZEROONETENTNTH
      PARAMETER          ( ZERO = 0.0D+0ONE = 1.0D+0TEN = 1.0D+1,
     $                   TNTH = 1.0D-1 )
*     ..
*     .. Local Scalars ..
      INTEGER            IIPTYPEIWAIWBIWXIWYJLINFO,
     $                   MAXWRKMINWRKNNERRSNMAXNPTKNTNTESTT
      DOUBLE PRECISION   ABNORMANORMBNORMRATIO1RATIO2THRSH2,
     $                   ULPULPINV
*     ..
*     .. Local Arrays ..
      DOUBLE PRECISION   WEIGHT5 )
*     ..
*     .. External Functions ..
      INTEGER            ILAENV
      DOUBLE PRECISION   DLAMCHDLANGE
      EXTERNAL           ILAENVDLAMCHDLANGE
*     ..
*     .. External Subroutines ..
      EXTERNAL           ALASVMDGET52DGGEVXDLACPYDLATM6XERBLA
*     ..
*     .. Intrinsic Functions ..
      INTRINSIC          ABSMAXSQRT
*     ..
*     .. Executable Statements ..
*
*     Check for errors
*
      INFO = 0
*
      NMAX = 5
*
      IFNSIZE.LT.0 ) THEN
         INFO = -1
      ELSE IFTHRESH.LT.ZERO ) THEN
         INFO = -2
      ELSE IFNIN.LE.0 ) THEN
         INFO = -3
      ELSE IFNOUT.LE.0 ) THEN
         INFO = -4
      ELSE IFLDA.LT.1 .OR. LDA.LT.NMAX ) THEN
         INFO = -6
      ELSE IFLIWORK.LT.NMAX+6 ) THEN
         INFO = -26
      END IF
*
*     Compute workspace
*      (Note: Comments in the code beginning "Workspace:" describe the
*       minimal amount of workspace needed at that point in the code,
*       as well as the preferred amount for good performance.
*       NB refers to the optimal block size for the immediately
*       following subroutine, as returned by ILAENV.)
*
      MINWRK = 1
      IFINFO.EQ.0 .AND. LWORK.GE.1 ) THEN
         MINWRK = 2*NMAX*NMAX + 12*NMAX + 16
         MAXWRK = 6*NMAX + NMAX*ILAENV1'DGEQRF'' 'NMAX1NMAX,
     $            0 )
         MAXWRK = MAXMAXWRK2*NMAX*NMAX+12*NMAX+16 )
         WORK1 ) = MAXWRK
      END IF
*
      IFLWORK.LT.MINWRK )
     $   INFO = -24
*
      IFINFO.NE.0 ) THEN
         CALL XERBLA'DDRGVX'-INFO )
         RETURN
      END IF
*
      N = 5
      ULP = DLAMCH'P' )
      ULPINV = ONE / ULP
      THRSH2 = TEN*THRESH
      NERRS = 0
      NPTKNT = 0
      NTESTT = 0
*
      IFNSIZE.EQ.0 )
     $   GO TO 90
*
*     Parameters used for generating test matrices.
*
      WEIGHT1 ) = SQRTSQRTULP ) )
      WEIGHT2 ) = TNTH
      WEIGHT3 ) = ONE
      WEIGHT4 ) = ONE / WEIGHT2 )
      WEIGHT5 ) = ONE / WEIGHT1 )
*
      DO 80 IPTYPE = 12
         DO 70 IWA = 15
            DO 60 IWB = 15
               DO 50 IWX = 15
                  DO 40 IWY = 15
*
*                    generated a test matrix pair
*
                     CALL DLATM6IPTYPE5ALDABVRLDAVL,
     $                            LDAWEIGHTIWA ), WEIGHTIWB ),
     $                            WEIGHTIWX ), WEIGHTIWY ), DTRU,
     $                            DIFTRU )
*
*                    Compute eigenvalues/eigenvectors of (A, B).
*                    Compute eigenvalue/eigenvector condition numbers
*                    using computed eigenvectors.
*
                     CALL DLACPY'F'NNALDAAILDA )
                     CALL DLACPY'F'NNBLDABILDA )
*
                     CALL DGGEVX'N''V''V''B'NAILDABI,
     $                            LDAALPHARALPHAIBETAVLLDA,
     $                            VRLDAILOIHILSCALERSCALE,
     $                            ANORMBNORMSDIFWORKLWORK,
     $                            IWORKBWORKLINFO )
                     IFLINFO.NE.0 ) THEN
                        RESULT1 ) = ULPINV
                        WRITENOUT, FMT = 9999 )'DGGEVX', LINFO, N,
     $                     IPTYPE
                        GO TO 30
                     END IF
*
*                    Compute the norm(A, B)
*
                     CALL DLACPY'Full'NNAILDAWORKN )
                     CALL DLACPY'Full'NNBILDAWORKN*N+1 ),
     $                            N )
                     ABNORM = DLANGE'Fro'N2*NWORKNWORK )
*
*                    Tests (1) and (2)
*
                     RESULT1 ) = ZERO
                     CALL DGET52.TRUE.NALDABLDAVLLDA,
     $                            ALPHARALPHAIBETAWORK,
     $                            RESULT1 ) )
                     IFRESULT2 ).GT.THRESH ) THEN
                        WRITENOUT, FMT = 9998 )'Left''DGGEVX',
     $                     RESULT( 2 ), N, IPTYPE, IWA, IWB, IWX, IWY
                     END IF
*
                     RESULT2 ) = ZERO
                     CALL DGET52.FALSE.NALDABLDAVRLDA,
     $                            ALPHARALPHAIBETAWORK,
     $                            RESULT2 ) )
                     IFRESULT3 ).GT.THRESH ) THEN
                        WRITENOUT, FMT = 9998 )'Right''DGGEVX',
     $                     RESULT( 3 ), N, IPTYPE, IWA, IWB, IWX, IWY
                     END IF
*
*                    Test (3)
*
                     RESULT3 ) = ZERO
                     DO 10 I = 1N
                        IFSI ).EQ.ZERO ) THEN
                           IFDTRUI ).GT.ABNORM*ULP )
     $                        RESULT3 ) = ULPINV
                        ELSE IFDTRUI ).EQ.ZERO ) THEN
                           IFSI ).GT.ABNORM*ULP )
     $                        RESULT3 ) = ULPINV
                        ELSE
                           WORKI ) = MAXABSDTRUI ) / SI ) ),
     $                                 ABSSI ) / DTRUI ) ) )
                           RESULT3 ) = MAXRESULT3 ), WORKI ) )
                        END IF
   10                CONTINUE
*
*                    Test (4)
*
                     RESULT4 ) = ZERO
                     IFDIF1 ).EQ.ZERO ) THEN
                        IFDIFTRU1 ).GT.ABNORM*ULP )
     $                     RESULT4 ) = ULPINV
                     ELSE IFDIFTRU1 ).EQ.ZERO ) THEN
                        IFDIF1 ).GT.ABNORM*ULP )
     $                     RESULT4 ) = ULPINV
                     ELSE IFDIF5 ).EQ.ZERO ) THEN
                        IFDIFTRU5 ).GT.ABNORM*ULP )
     $                     RESULT4 ) = ULPINV
                     ELSE IFDIFTRU5 ).EQ.ZERO ) THEN
                        IFDIF5 ).GT.ABNORM*ULP )
     $                     RESULT4 ) = ULPINV
                     ELSE
                        RATIO1 = MAXABSDIFTRU1 ) / DIF1 ) ),
     $                           ABSDIF1 ) / DIFTRU1 ) ) )
                        RATIO2 = MAXABSDIFTRU5 ) / DIF5 ) ),
     $                           ABSDIF5 ) / DIFTRU5 ) ) )
                        RESULT4 ) = MAXRATIO1RATIO2 )
                     END IF
*
                     NTESTT = NTESTT + 4
*
*                    Print out tests which fail.
*
                     DO 20 J = 14
                        IF( ( RESULTJ ).GE.THRSH2 .AND. J.GE.4 ) .OR.
     $                      ( RESULTJ ).GE.THRESH .AND. J.LE.3 ) )
     $                       THEN
*
*                       If this is the first test to fail,
*                       print a header to the data file.
*
                           IFNERRS.EQ.0 ) THEN
                              WRITENOUT, FMT = 9997 )'DXV'
*
*                          Print out messages for built-in examples
*
*                          Matrix types
*
                              WRITENOUT, FMT = 9995 )
                              WRITENOUT, FMT = 9994 )
                              WRITENOUT, FMT = 9993 )
*
*                          Tests performed
*
                              WRITENOUT, FMT = 9992 )'''',
     $                           'transpose'''''
*
                           END IF
                           NERRS = NERRS + 1
                           IFRESULTJ ).LT.10000.0D0 ) THEN
                              WRITENOUT, FMT = 9991 )IPTYPE, IWA,
     $                           IWB, IWX, IWY, J, RESULT( J )
                           ELSE
                              WRITENOUT, FMT = 9990 )IPTYPE, IWA,
     $                           IWB, IWX, IWY, J, RESULT( J )
                           END IF
                        END IF
   20                CONTINUE
*
   30                CONTINUE
*
   40             CONTINUE
   50          CONTINUE
   60       CONTINUE
   70    CONTINUE
   80 CONTINUE
*
      GO TO 150
*
   90 CONTINUE
*
*     Read in data from file to check accuracy of condition estimation
*     Read input data until N=0
*
      READNIN, FMT = *, END = 150 )N
      IFN.EQ.0 )
     $   GO TO 150
      DO 100 I = 1N
         READNIN, FMT = * )( A( I, J ), J = 1, N )
  100 CONTINUE
      DO 110 I = 1N
         READNIN, FMT = * )( B( I, J ), J = 1, N )
  110 CONTINUE
      READNIN, FMT = * )( DTRU( I ), I = 1, N )
      READNIN, FMT = * )( DIFTRU( I ), I = 1, N )
*
      NPTKNT = NPTKNT + 1
*
*     Compute eigenvalues/eigenvectors of (A, B).
*     Compute eigenvalue/eigenvector condition numbers
*     using computed eigenvectors.
*
      CALL DLACPY'F'NNALDAAILDA )
      CALL DLACPY'F'NNBLDABILDA )
*
      CALL DGGEVX'N''V''V''B'NAILDABILDAALPHAR,
     $             ALPHAIBETAVLLDAVRLDAILOIHILSCALE,
     $             RSCALEANORMBNORMSDIFWORKLWORKIWORK,
     $             BWORKLINFO )
*
      IFLINFO.NE.0 ) THEN
         RESULT1 ) = ULPINV
         WRITENOUT, FMT = 9987 )'DGGEVX', LINFO, N, NPTKNT
         GO TO 140
      END IF
*
*     Compute the norm(A, B)
*
      CALL DLACPY'Full'NNAILDAWORKN )
      CALL DLACPY'Full'NNBILDAWORKN*N+1 ), N )
      ABNORM = DLANGE'Fro'N2*NWORKNWORK )
*
*     Tests (1) and (2)
*
      RESULT1 ) = ZERO
      CALL DGET52.TRUE.NALDABLDAVLLDAALPHARALPHAI,
     $             BETAWORKRESULT1 ) )
      IFRESULT2 ).GT.THRESH ) THEN
         WRITENOUT, FMT = 9986 )'Left''DGGEVX', RESULT( 2 ), N,
     $      NPTKNT
      END IF
*
      RESULT2 ) = ZERO
      CALL DGET52.FALSE.NALDABLDAVRLDAALPHARALPHAI,
     $             BETAWORKRESULT2 ) )
      IFRESULT3 ).GT.THRESH ) THEN
         WRITENOUT, FMT = 9986 )'Right''DGGEVX', RESULT( 3 ), N,
     $      NPTKNT
      END IF
*
*     Test (3)
*
      RESULT3 ) = ZERO
      DO 120 I = 1N
         IFSI ).EQ.ZERO ) THEN
            IFDTRUI ).GT.ABNORM*ULP )
     $         RESULT3 ) = ULPINV
         ELSE IFDTRUI ).EQ.ZERO ) THEN
            IFSI ).GT.ABNORM*ULP )
     $         RESULT3 ) = ULPINV
         ELSE
            WORKI ) = MAXABSDTRUI ) / SI ) ),
     $                  ABSSI ) / DTRUI ) ) )
            RESULT3 ) = MAXRESULT3 ), WORKI ) )
         END IF
  120 CONTINUE
*
*     Test (4)
*
      RESULT4 ) = ZERO
      IFDIF1 ).EQ.ZERO ) THEN
         IFDIFTRU1 ).GT.ABNORM*ULP )
     $      RESULT4 ) = ULPINV
      ELSE IFDIFTRU1 ).EQ.ZERO ) THEN
         IFDIF1 ).GT.ABNORM*ULP )
     $      RESULT4 ) = ULPINV
      ELSE IFDIF5 ).EQ.ZERO ) THEN
         IFDIFTRU5 ).GT.ABNORM*ULP )
     $      RESULT4 ) = ULPINV
      ELSE IFDIFTRU5 ).EQ.ZERO ) THEN
         IFDIF5 ).GT.ABNORM*ULP )
     $      RESULT4 ) = ULPINV
      ELSE
         RATIO1 = MAXABSDIFTRU1 ) / DIF1 ) ),
     $            ABSDIF1 ) / DIFTRU1 ) ) )
         RATIO2 = MAXABSDIFTRU5 ) / DIF5 ) ),
     $            ABSDIF5 ) / DIFTRU5 ) ) )
         RESULT4 ) = MAXRATIO1RATIO2 )
      END IF
*
      NTESTT = NTESTT + 4
*
*     Print out tests which fail.
*
      DO 130 J = 14
         IFRESULTJ ).GE.THRSH2 ) THEN
*
*           If this is the first test to fail,
*           print a header to the data file.
*
            IFNERRS.EQ.0 ) THEN
               WRITENOUT, FMT = 9997 )'DXV'
*
*              Print out messages for built-in examples
*
*              Matrix types
*
               WRITENOUT, FMT = 9996 )
*
*              Tests performed
*
               WRITENOUT, FMT = 9992 )'''''transpose'''''
*
            END IF
            NERRS = NERRS + 1
            IFRESULTJ ).LT.10000.0D0 ) THEN
               WRITENOUT, FMT = 9989 )NPTKNT, N, J, RESULT( J )
            ELSE
               WRITENOUT, FMT = 9988 )NPTKNT, N, J, RESULT( J )
            END IF
         END IF
  130 CONTINUE
*
  140 CONTINUE
*
      GO TO 90
  150 CONTINUE
*
*     Summary
*
      CALL ALASVM'DXV'NOUTNERRSNTESTT0 )
*
      WORK1 ) = MAXWRK
*
      RETURN
*
 9999 FORMAT( ' DDRGVX: ', A, ' returned INFO=', I6, '.', / 9X, 'N=',
     $      I6, ', JTYPE=', I6, ')' )
*
 9998 FORMAT( ' DDRGVX: ', A, ' Eigenvectors from ', A, ' incorrectly ',
     $      'normalized.', / ' Bits of error=', 0P, G10.3, ',', 9X,
     $      'N=', I6, ', JTYPE=', I6, ', IWA=', I5, ', IWB=', I5,
     $      ', IWX=', I5, ', IWY=', I5 )
*
 9997 FORMAT( / 1X, A3, ' -- Real Expert Eigenvalue/vector',
     $      ' problem driver' )
*
 9996 FORMAT( ' Input Example' )
*
 9995 FORMAT( ' Matrix types: ', / )
*
 9994 FORMAT( ' TYPE 1: Da is diagonal, Db is identity, ',
     $      / '     A = Y^(-H) Da X^(-1), B = Y^(-H) Db X^(-1) ',
     $      / '     YH and X are left and right eigenvectors. ', / )
*
 9993 FORMAT( ' TYPE 2: Da is quasi-diagonal, Db is identity, ',
     $      / '     A = Y^(-H) Da X^(-1), B = Y^(-H) Db X^(-1) ',
     $      / '     YH and X are left and right eigenvectors. ', / )
*
 9992 FORMAT( / ' Tests performed:  ', / 4X,
     $      ' a is alpha, b is beta, l is a left eigenvector, ', / 4X,
     $      ' r is a right eigenvector and ', A, ' means ', A, '.',
     $      / ' 1 = max | ( b A - a B )', A, ' l | / const.',
     $      / ' 2 = max | ( b A - a B ) r | / const.',
     $      / ' 3 = max ( Sest/Stru, Stru/Sest ) ',
     $      ' over all eigenvalues', /
     $      ' 4 = max( DIFest/DIFtru, DIFtru/DIFest ) ',
     $      ' over the 1st and 5th eigenvectors', / )
*
 9991 FORMAT( ' Type=', I2, ',', ' IWA=', I2, ', IWB=', I2, ', IWX=',
     $      I2, ', IWY=', I2, ', result ', I2, ' is', 0P, F8.2 )
 9990 FORMAT( ' Type=', I2, ',', ' IWA=', I2, ', IWB=', I2, ', IWX=',
     $      I2, ', IWY=', I2, ', result ', I2, ' is', 1P, D10.3 )
 9989 FORMAT( ' Input example #', I2, ', matrix order=', I4, ',',
     $      ' result ', I2, ' is', 0P, F8.2 )
 9988 FORMAT( ' Input example #', I2, ', matrix order=', I4, ',',
     $      ' result ', I2, ' is', 1P, D10.3 )
 9987 FORMAT( ' DDRGVX: ', A, ' returned INFO=', I6, '.', / 9X, 'N=',
     $      I6, ', Input example #', I2, ')' )
*
 9986 FORMAT( ' DDRGVX: ', A, ' Eigenvectors from ', A, ' incorrectly ',
     $      'normalized.', / ' Bits of error=', 0P, G10.3, ',', 9X,
     $      'N=', I6, ', Input Example #', I2, ')' )
*
*
*     End of DDRGVX
*
      END