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
     625
     626
     627
     628
     629
     630
     631
     632
     633
     634
     635
     636
     637
     638
     639
     640
     641
     642
     643
     644
     645
     646
     647
     648
     649
     650
     651
     652
     653
     654
     655
     656
     657
     658
     659
     660
     661
     662
     663
     664
     665
     666
     667
     668
     669
     670
     671
     672
     673
     674
     675
     676
     677
     678
     679
     680
     681
     682
     683
     684
     685
     686
     687
     688
     689
     690
     691
     692
     693
     694
     695
     696
     697
     698
     699
     700
     701
     702
     703
     704
     705
     706
     707
     708
     709
     710
     711
     712
     713
      SUBROUTINE ZGET23COMPISRTBALANCJTYPETHRESHISEED,
     $                   NOUNITNALDAHWW1VLLDVLVR,
     $                   LDVRLRELDLRERCONDVRCNDV1RCDVIN,
     $                   RCONDERCNDE1RCDEINSCALESCALE1RESULT,
     $                   WORKLWORKRWORKINFO )
*
*  -- LAPACK test routine (version 3.1) --
*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
*     November 2006
*
*     .. Scalar Arguments ..
      LOGICAL            COMP
      CHARACTER          BALANC
      INTEGER            INFOISRTJTYPELDALDLRELDVLLDVR,
     $                   LWORKNNOUNIT
      DOUBLE PRECISION   THRESH
*     ..
*     .. Array Arguments ..
      INTEGER            ISEED4 )
      DOUBLE PRECISION   RCDEIN* ), RCDVIN* ), RCNDE1* ),
     $                   RCNDV1* ), RCONDE* ), RCONDV* ),
     $                   RESULT11 ), RWORK* ), SCALE* ),
     $                   SCALE1* )
      COMPLEX*16         ALDA* ), HLDA* ), LRELDLRE* ),
     $                   VLLDVL* ), VRLDVR* ), W* ), W1* ),
     $                   WORK* )
*     ..
*
*  Purpose
*  =======
*
*     ZGET23  checks the nonsymmetric eigenvalue problem driver CGEEVX.
*     If COMP = .FALSE., the first 8 of the following tests will be
*     performed on the input matrix A, and also test 9 if LWORK is
*     sufficiently large.
*     if COMP is .TRUE. all 11 tests will be performed.
*
*     (1)     | A * VR - VR * W | / ( n |A| ulp )
*
*       Here VR is the matrix of unit right eigenvectors.
*       W is a diagonal matrix with diagonal entries W(j).
*
*     (2)     | A**H * VL - VL * W**H | / ( n |A| ulp )
*
*       Here VL is the matrix of unit left eigenvectors, A**H is the
*       conjugate transpose of A, and W is as above.
*
*     (3)     | |VR(i)| - 1 | / ulp and largest component real
*
*       VR(i) denotes the i-th column of VR.
*
*     (4)     | |VL(i)| - 1 | / ulp and largest component real
*
*       VL(i) denotes the i-th column of VL.
*
*     (5)     0 if W(full) = W(partial), 1/ulp otherwise
*
*       W(full) denotes the eigenvalues computed when VR, VL, RCONDV
*       and RCONDE are also computed, and W(partial) denotes the
*       eigenvalues computed when only some of VR, VL, RCONDV, and
*       RCONDE are computed.
*
*     (6)     0 if VR(full) = VR(partial), 1/ulp otherwise
*
*       VR(full) denotes the right eigenvectors computed when VL, RCONDV
*       and RCONDE are computed, and VR(partial) denotes the result
*       when only some of VL and RCONDV are computed.
*
*     (7)     0 if VL(full) = VL(partial), 1/ulp otherwise
*
*       VL(full) denotes the left eigenvectors computed when VR, RCONDV
*       and RCONDE are computed, and VL(partial) denotes the result
*       when only some of VR and RCONDV are computed.
*
*     (8)     0 if SCALE, ILO, IHI, ABNRM (full) =
*                  SCALE, ILO, IHI, ABNRM (partial)
*             1/ulp otherwise
*
*       SCALE, ILO, IHI and ABNRM describe how the matrix is balanced.
*       (full) is when VR, VL, RCONDE and RCONDV are also computed, and
*       (partial) is when some are not computed.
*
*     (9)     0 if RCONDV(full) = RCONDV(partial), 1/ulp otherwise
*
*       RCONDV(full) denotes the reciprocal condition numbers of the
*       right eigenvectors computed when VR, VL and RCONDE are also
*       computed. RCONDV(partial) denotes the reciprocal condition
*       numbers when only some of VR, VL and RCONDE are computed.
*
*    (10)     |RCONDV - RCDVIN| / cond(RCONDV)
*
*       RCONDV is the reciprocal right eigenvector condition number
*       computed by ZGEEVX and RCDVIN (the precomputed true value)
*       is supplied as input. cond(RCONDV) is the condition number of
*       RCONDV, and takes errors in computing RCONDV into account, so
*       that the resulting quantity should be O(ULP). cond(RCONDV) is
*       essentially given by norm(A)/RCONDE.
*
*    (11)     |RCONDE - RCDEIN| / cond(RCONDE)
*
*       RCONDE is the reciprocal eigenvalue condition number
*       computed by ZGEEVX and RCDEIN (the precomputed true value)
*       is supplied as input.  cond(RCONDE) is the condition number
*       of RCONDE, and takes errors in computing RCONDE into account,
*       so that the resulting quantity should be O(ULP). cond(RCONDE)
*       is essentially given by norm(A)/RCONDV.
*
*  Arguments
*  =========
*
*  COMP    (input) LOGICAL
*          COMP describes which input tests to perform:
*            = .FALSE. if the computed condition numbers are not to
*                      be tested against RCDVIN and RCDEIN
*            = .TRUE.  if they are to be compared
*
*  ISRT    (input) INTEGER
*          If COMP = .TRUE., ISRT indicates in how the eigenvalues
*          corresponding to values in RCDVIN and RCDEIN are ordered:
*            = 0 means the eigenvalues are sorted by
*                increasing real part
*            = 1 means the eigenvalues are sorted by
*                increasing imaginary part
*          If COMP = .FALSE., ISRT is not referenced.
*
*  BALANC  (input) CHARACTER
*          Describes the balancing option to be tested.
*            = 'N' for no permuting or diagonal scaling
*            = 'P' for permuting but no diagonal scaling
*            = 'S' for no permuting but diagonal scaling
*            = 'B' for permuting and diagonal scaling
*
*  JTYPE   (input) INTEGER
*          Type of input matrix. Used to label output if error occurs.
*
*  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.
*
*  ISEED   (input) INTEGER array, dimension (4)
*          If COMP = .FALSE., the random number generator seed
*          used to produce matrix.
*          If COMP = .TRUE., ISEED(1) = the number of the example.
*          Used to label output if error occurs.
*
*  NOUNIT  (input) INTEGER
*          The FORTRAN unit number for printing out error messages
*          (e.g., if a routine returns INFO not equal to 0.)
*
*  N       (input) INTEGER
*          The dimension of A. N must be at least 0.
*
*  A       (input/output) COMPLEX*16 array, dimension (LDA,N)
*          Used to hold the matrix whose eigenvalues are to be
*          computed.
*
*  LDA     (input) INTEGER
*          The leading dimension of A, and H. LDA must be at
*          least 1 and at least N.
*
*  H       (workspace) COMPLEX*16 array, dimension (LDA,N)
*          Another copy of the test matrix A, modified by ZGEEVX.
*
*  W       (workspace) COMPLEX*16 array, dimension (N)
*          Contains the eigenvalues of A.
*
*  W1      (workspace) COMPLEX*16 array, dimension (N)
*          Like W, this array contains the eigenvalues of A,
*          but those computed when ZGEEVX only computes a partial
*          eigendecomposition, i.e. not the eigenvalues and left
*          and right eigenvectors.
*
*  VL      (workspace) COMPLEX*16 array, dimension (LDVL,N)
*          VL holds the computed left eigenvectors.
*
*  LDVL    (input) INTEGER
*          Leading dimension of VL. Must be at least max(1,N).
*
*  VR      (workspace) COMPLEX*16 array, dimension (LDVR,N)
*          VR holds the computed right eigenvectors.
*
*  LDVR    (input) INTEGER
*          Leading dimension of VR. Must be at least max(1,N).
*
*  LRE     (workspace) COMPLEX*16 array, dimension (LDLRE,N)
*          LRE holds the computed right or left eigenvectors.
*
*  LDLRE   (input) INTEGER
*          Leading dimension of LRE. Must be at least max(1,N).
*
*  RCONDV  (workspace) DOUBLE PRECISION array, dimension (N)
*          RCONDV holds the computed reciprocal condition numbers
*          for eigenvectors.
*
*  RCNDV1  (workspace) DOUBLE PRECISION array, dimension (N)
*          RCNDV1 holds more computed reciprocal condition numbers
*          for eigenvectors.
*
*  RCDVIN  (input) DOUBLE PRECISION array, dimension (N)
*          When COMP = .TRUE. RCDVIN holds the precomputed reciprocal
*          condition numbers for eigenvectors to be compared with
*          RCONDV.
*
*  RCONDE  (workspace) DOUBLE PRECISION array, dimension (N)
*          RCONDE holds the computed reciprocal condition numbers
*          for eigenvalues.
*
*  RCNDE1  (workspace) DOUBLE PRECISION array, dimension (N)
*          RCNDE1 holds more computed reciprocal condition numbers
*          for eigenvalues.
*
*  RCDEIN  (input) DOUBLE PRECISION array, dimension (N)
*          When COMP = .TRUE. RCDEIN holds the precomputed reciprocal
*          condition numbers for eigenvalues to be compared with
*          RCONDE.
*
*  SCALE   (workspace) DOUBLE PRECISION array, dimension (N)
*          Holds information describing balancing of matrix.
*
*  SCALE1  (workspace) DOUBLE PRECISION array, dimension (N)
*          Holds information describing balancing of matrix.
*
*  RESULT  (output) DOUBLE PRECISION array, dimension (11)
*          The values computed by the 11 tests described above.
*          The values are currently limited to 1/ulp, to avoid
*          overflow.
*
*  WORK    (workspace) COMPLEX*16 array, dimension (LWORK)
*
*  LWORK   (input) INTEGER
*          The number of entries in WORK.  This must be at least
*          2*N, and 2*N+N**2 if tests 9, 10 or 11 are to be performed.
*
*  RWORK   (workspace) DOUBLE PRECISION array, dimension (2*N)
*
*  INFO    (output) INTEGER
*          If 0,  successful exit.
*          If <0, input parameter -INFO had an incorrect value.
*          If >0, ZGEEVX returned an error code, the absolute
*                 value of which is returned.
*
*  =====================================================================
*
*     .. Parameters ..
      DOUBLE PRECISION   ZEROONETWO
      PARAMETER          ( ZERO = 0.0D0ONE = 1.0D0TWO = 2.0D0 )
      DOUBLE PRECISION   EPSIN
      PARAMETER          ( EPSIN = 5.9605D-8 )
*     ..
*     .. Local Scalars ..
      LOGICAL            BALOKNOBAL
      CHARACTER          SENSE
      INTEGER            IIHIIHI1IINFOILOILO1ISENSISENSM,
     $                   JJJKMIN
      DOUBLE PRECISION   ABNRMABNRM1EPSSMLNUMTNRMTOLTOLIN,
     $                   ULPULPINVVVMAXVMXVRICMPVRIMIN,
     $                   VRMXVTST
      COMPLEX*16         CTMP
*     ..
*     .. Local Arrays ..
      CHARACTER          SENS2 )
      DOUBLE PRECISION   RES2 )
      COMPLEX*16         CDUM1 )
*     ..
*     .. External Functions ..
      LOGICAL            LSAME
      DOUBLE PRECISION   DLAMCHDZNRM2
      EXTERNAL           LSAMEDLAMCHDZNRM2
*     ..
*     .. External Subroutines ..
      EXTERNAL           XERBLAZGEEVXZGET22ZLACPY
*     ..
*     .. Intrinsic Functions ..
      INTRINSIC          ABSDBLEDIMAGMAXMIN
*     ..
*     .. Data statements ..
      DATA               SENS / 'N''V' /
*     ..
*     .. Executable Statements ..
*
*     Check for errors
*
      NOBAL = LSAMEBALANC'N' )
      BALOK = NOBAL .OR. LSAMEBALANC'P' ) .OR.
     $        LSAMEBALANC'S' ) .OR. LSAMEBALANC'B' )
      INFO = 0
      IFISRT.NE.0 .AND. ISRT.NE.1 ) THEN
         INFO = -2
      ELSE IF.NOT.BALOK ) THEN
         INFO = -3
      ELSE IFTHRESH.LT.ZERO ) THEN
         INFO = -5
      ELSE IFNOUNIT.LE.0 ) THEN
         INFO = -7
      ELSE IFN.LT.0 ) THEN
         INFO = -8
      ELSE IFLDA.LT.1 .OR. LDA.LT.N ) THEN
         INFO = -10
      ELSE IFLDVL.LT.1 .OR. LDVL.LT.N ) THEN
         INFO = -15
      ELSE IFLDVR.LT.1 .OR. LDVR.LT.N ) THEN
         INFO = -17
      ELSE IFLDLRE.LT.1 .OR. LDLRE.LT.N ) THEN
         INFO = -19
      ELSE IFLWORK.LT.2*N .OR. ( COMP .AND. LWORK.LT.2*N+N*N ) ) THEN
         INFO = -30
      END IF
*
      IFINFO.NE.0 ) THEN
         CALL XERBLA'ZGET23'-INFO )
         RETURN
      END IF
*
*     Quick return if nothing to do
*
      DO 10 I = 111
         RESULTI ) = -ONE
   10 CONTINUE
*
      IFN.EQ.0 )
     $   RETURN
*
*     More Important constants
*
      ULP = DLAMCH'Precision' )
      SMLNUM = DLAMCH'S' )
      ULPINV = ONE / ULP
*
*     Compute eigenvalues and eigenvectors, and test them
*
      IFLWORK.GE.2*N+N*N ) THEN
         SENSE = 'B'
         ISENSM = 2
      ELSE
         SENSE = 'E'
         ISENSM = 1
      END IF
      CALL ZLACPY'F'NNALDAHLDA )
      CALL ZGEEVXBALANC'V''V'SENSENHLDAWVLLDVLVR,
     $             LDVRILOIHISCALEABNRMRCONDERCONDVWORK,
     $             LWORKRWORKIINFO )
      IFIINFO.NE.0 ) THEN
         RESULT1 ) = ULPINV
         IFJTYPE.NE.22 ) THEN
            WRITENOUNIT, FMT = 9998 )'ZGEEVX1', IINFO, N, JTYPE,
     $         BALANC, ISEED
         ELSE
            WRITENOUNIT, FMT = 9999 )'ZGEEVX1', IINFO, N, ISEED( 1 )
         END IF
         INFO = ABSIINFO )
         RETURN
      END IF
*
*     Do Test (1)
*
      CALL ZGET22'N''N''N'NALDAVRLDVRWWORKRWORK,
     $             RES )
      RESULT1 ) = RES1 )
*
*     Do Test (2)
*
      CALL ZGET22'C''N''C'NALDAVLLDVLWWORKRWORK,
     $             RES )
      RESULT2 ) = RES1 )
*
*     Do Test (3)
*
      DO 30 J = 1N
         TNRM = DZNRM2NVR1J ), 1 )
         RESULT3 ) = MAXRESULT3 ),
     $                 MINULPINVABSTNRM-ONE ) / ULP ) )
         VMX = ZERO
         VRMX = ZERO
         DO 20 JJ = 1N
            VTST = ABSVRJJJ ) )
            IFVTST.GT.VMX )
     $         VMX = VTST
            IFDIMAGVRJJJ ) ).EQ.ZERO .AND.
     $          ABSDBLEVRJJJ ) ) ).GT.VRMX )
     $          VRMX = ABSDBLEVRJJJ ) ) )
   20    CONTINUE
         IFVRMX / VMX.LT.ONE-TWO*ULP )
     $      RESULT3 ) = ULPINV
   30 CONTINUE
*
*     Do Test (4)
*
      DO 50 J = 1N
         TNRM = DZNRM2NVL1J ), 1 )
         RESULT4 ) = MAXRESULT4 ),
     $                 MINULPINVABSTNRM-ONE ) / ULP ) )
         VMX = ZERO
         VRMX = ZERO
         DO 40 JJ = 1N
            VTST = ABSVLJJJ ) )
            IFVTST.GT.VMX )
     $         VMX = VTST
            IFDIMAGVLJJJ ) ).EQ.ZERO .AND.
     $          ABSDBLEVLJJJ ) ) ).GT.VRMX )
     $          VRMX = ABSDBLEVLJJJ ) ) )
   40    CONTINUE
         IFVRMX / VMX.LT.ONE-TWO*ULP )
     $      RESULT4 ) = ULPINV
   50 CONTINUE
*
*     Test for all options of computing condition numbers
*
      DO 200 ISENS = 1ISENSM
*
         SENSE = SENSISENS )
*
*        Compute eigenvalues only, and test them
*
         CALL ZLACPY'F'NNALDAHLDA )
         CALL ZGEEVXBALANC'N''N'SENSENHLDAW1CDUM1,
     $                CDUM1ILO1IHI1SCALE1ABNRM1RCNDE1,
     $                RCNDV1WORKLWORKRWORKIINFO )
         IFIINFO.NE.0 ) THEN
            RESULT1 ) = ULPINV
            IFJTYPE.NE.22 ) THEN
               WRITENOUNIT, FMT = 9998 )'ZGEEVX2', IINFO, N, JTYPE,
     $            BALANC, ISEED
            ELSE
               WRITENOUNIT, FMT = 9999 )'ZGEEVX2', IINFO, N,
     $            ISEED( 1 )
            END IF
            INFO = ABSIINFO )
            GO TO 190
         END IF
*
*        Do Test (5)
*
         DO 60 J = 1N
            IFWJ ).NE.W1J ) )
     $         RESULT5 ) = ULPINV
   60    CONTINUE
*
*        Do Test (8)
*
         IF.NOT.NOBAL ) THEN
            DO 70 J = 1N
               IFSCALEJ ).NE.SCALE1J ) )
     $            RESULT8 ) = ULPINV
   70       CONTINUE
            IFILO.NE.ILO1 )
     $         RESULT8 ) = ULPINV
            IFIHI.NE.IHI1 )
     $         RESULT8 ) = ULPINV
            IFABNRM.NE.ABNRM1 )
     $         RESULT8 ) = ULPINV
         END IF
*
*        Do Test (9)
*
         IFISENS.EQ.2 .AND. N.GT.1 ) THEN
            DO 80 J = 1N
               IFRCONDVJ ).NE.RCNDV1J ) )
     $            RESULT9 ) = ULPINV
   80       CONTINUE
         END IF
*
*        Compute eigenvalues and right eigenvectors, and test them
*
         CALL ZLACPY'F'NNALDAHLDA )
         CALL ZGEEVXBALANC'N''V'SENSENHLDAW1CDUM1,
     $                LRELDLREILO1IHI1SCALE1ABNRM1RCNDE1,
     $                RCNDV1WORKLWORKRWORKIINFO )
         IFIINFO.NE.0 ) THEN
            RESULT1 ) = ULPINV
            IFJTYPE.NE.22 ) THEN
               WRITENOUNIT, FMT = 9998 )'ZGEEVX3', IINFO, N, JTYPE,
     $            BALANC, ISEED
            ELSE
               WRITENOUNIT, FMT = 9999 )'ZGEEVX3', IINFO, N,
     $            ISEED( 1 )
            END IF
            INFO = ABSIINFO )
            GO TO 190
         END IF
*
*        Do Test (5) again
*
         DO 90 J = 1N
            IFWJ ).NE.W1J ) )
     $         RESULT5 ) = ULPINV
   90    CONTINUE
*
*        Do Test (6)
*
         DO 110 J = 1N
            DO 100 JJ = 1N
               IFVRJJJ ).NE.LREJJJ ) )
     $            RESULT6 ) = ULPINV
  100       CONTINUE
  110    CONTINUE
*
*        Do Test (8) again
*
         IF.NOT.NOBAL ) THEN
            DO 120 J = 1N
               IFSCALEJ ).NE.SCALE1J ) )
     $            RESULT8 ) = ULPINV
  120       CONTINUE
            IFILO.NE.ILO1 )
     $         RESULT8 ) = ULPINV
            IFIHI.NE.IHI1 )
     $         RESULT8 ) = ULPINV
            IFABNRM.NE.ABNRM1 )
     $         RESULT8 ) = ULPINV
         END IF
*
*        Do Test (9) again
*
         IFISENS.EQ.2 .AND. N.GT.1 ) THEN
            DO 130 J = 1N
               IFRCONDVJ ).NE.RCNDV1J ) )
     $            RESULT9 ) = ULPINV
  130       CONTINUE
         END IF
*
*        Compute eigenvalues and left eigenvectors, and test them
*
         CALL ZLACPY'F'NNALDAHLDA )
         CALL ZGEEVXBALANC'V''N'SENSENHLDAW1LRE,
     $                LDLRECDUM1ILO1IHI1SCALE1ABNRM1,
     $                RCNDE1RCNDV1WORKLWORKRWORKIINFO )
         IFIINFO.NE.0 ) THEN
            RESULT1 ) = ULPINV
            IFJTYPE.NE.22 ) THEN
               WRITENOUNIT, FMT = 9998 )'ZGEEVX4', IINFO, N, JTYPE,
     $            BALANC, ISEED
            ELSE
               WRITENOUNIT, FMT = 9999 )'ZGEEVX4', IINFO, N,
     $            ISEED( 1 )
            END IF
            INFO = ABSIINFO )
            GO TO 190
         END IF
*
*        Do Test (5) again
*
         DO 140 J = 1N
            IFWJ ).NE.W1J ) )
     $         RESULT5 ) = ULPINV
  140    CONTINUE
*
*        Do Test (7)
*
         DO 160 J = 1N
            DO 150 JJ = 1N
               IFVLJJJ ).NE.LREJJJ ) )
     $            RESULT7 ) = ULPINV
  150       CONTINUE
  160    CONTINUE
*
*        Do Test (8) again
*
         IF.NOT.NOBAL ) THEN
            DO 170 J = 1N
               IFSCALEJ ).NE.SCALE1J ) )
     $            RESULT8 ) = ULPINV
  170       CONTINUE
            IFILO.NE.ILO1 )
     $         RESULT8 ) = ULPINV
            IFIHI.NE.IHI1 )
     $         RESULT8 ) = ULPINV
            IFABNRM.NE.ABNRM1 )
     $         RESULT8 ) = ULPINV
         END IF
*
*        Do Test (9) again
*
         IFISENS.EQ.2 .AND. N.GT.1 ) THEN
            DO 180 J = 1N
               IFRCONDVJ ).NE.RCNDV1J ) )
     $            RESULT9 ) = ULPINV
  180       CONTINUE
         END IF
*
  190    CONTINUE
*
  200 CONTINUE
*
*     If COMP, compare condition numbers to precomputed ones
*
      IFCOMP ) THEN
         CALL ZLACPY'F'NNALDAHLDA )
         CALL ZGEEVX'N''V''V''B'NHLDAWVLLDVLVR,
     $                LDVRILOIHISCALEABNRMRCONDERCONDV,
     $                WORKLWORKRWORKIINFO )
         IFIINFO.NE.0 ) THEN
            RESULT1 ) = ULPINV
            WRITENOUNIT, FMT = 9999 )'ZGEEVX5', IINFO, N, ISEED( 1 )
            INFO = ABSIINFO )
            GO TO 250
         END IF
*
*        Sort eigenvalues and condition numbers lexicographically
*        to compare with inputs
*
         DO 220 I = 1N - 1
            KMIN = I
            IFISRT.EQ.0 ) THEN
               VRIMIN = DBLEWI ) )
            ELSE
               VRIMIN = DIMAGWI ) )
            END IF
            DO 210 J = I + 1N
               IFISRT.EQ.0 ) THEN
                  VRICMP = DBLEWJ ) )
               ELSE
                  VRICMP = DIMAGWJ ) )
               END IF
               IFVRICMP.LT.VRIMIN ) THEN
                  KMIN = J
                  VRIMIN = VRICMP
               END IF
  210       CONTINUE
            CTMP = WKMIN )
            WKMIN ) = WI )
            WI ) = CTMP
            VRIMIN = RCONDEKMIN )
            RCONDEKMIN ) = RCONDEI )
            RCONDEI ) = VRIMIN
            VRIMIN = RCONDVKMIN )
            RCONDVKMIN ) = RCONDVI )
            RCONDVI ) = VRIMIN
  220    CONTINUE
*
*        Compare condition numbers for eigenvectors
*        taking their condition numbers into account
*
         RESULT10 ) = ZERO
         EPS = MAXEPSINULP )
         V = MAXDBLEN )*EPS*ABNRMSMLNUM )
         IFABNRM.EQ.ZERO )
     $      V = ONE
         DO 230 I = 1N
            IFV.GT.RCONDVI )*RCONDEI ) ) THEN
               TOL = RCONDVI )
            ELSE
               TOL = V / RCONDEI )
            END IF
            IFV.GT.RCDVINI )*RCDEINI ) ) THEN
               TOLIN = RCDVINI )
            ELSE
               TOLIN = V / RCDEINI )
            END IF
            TOL = MAXTOLSMLNUM / EPS )
            TOLIN = MAXTOLINSMLNUM / EPS )
            IFEPS*RCDVINI )-TOLIN ).GT.RCONDVI )+TOL ) THEN
               VMAX = ONE / EPS
            ELSE IFRCDVINI )-TOLIN.GT.RCONDVI )+TOL ) THEN
               VMAX = ( RCDVINI )-TOLIN ) / ( RCONDVI )+TOL )
            ELSE IFRCDVINI )+TOLIN.LT.EPS*RCONDVI )-TOL ) ) THEN
               VMAX = ONE / EPS
            ELSE IFRCDVINI )+TOLIN.LT.RCONDVI )-TOL ) THEN
               VMAX = ( RCONDVI )-TOL ) / ( RCDVINI )+TOLIN )
            ELSE
               VMAX = ONE
            END IF
            RESULT10 ) = MAXRESULT10 ), VMAX )
  230    CONTINUE
*
*        Compare condition numbers for eigenvalues
*        taking their condition numbers into account
*
         RESULT11 ) = ZERO
         DO 240 I = 1N
            IFV.GT.RCONDVI ) ) THEN
               TOL = ONE
            ELSE
               TOL = V / RCONDVI )
            END IF
            IFV.GT.RCDVINI ) ) THEN
               TOLIN = ONE
            ELSE
               TOLIN = V / RCDVINI )
            END IF
            TOL = MAXTOLSMLNUM / EPS )
            TOLIN = MAXTOLINSMLNUM / EPS )
            IFEPS*RCDEINI )-TOLIN ).GT.RCONDEI )+TOL ) THEN
               VMAX = ONE / EPS
            ELSE IFRCDEINI )-TOLIN.GT.RCONDEI )+TOL ) THEN
               VMAX = ( RCDEINI )-TOLIN ) / ( RCONDEI )+TOL )
            ELSE IFRCDEINI )+TOLIN.LT.EPS*RCONDEI )-TOL ) ) THEN
               VMAX = ONE / EPS
            ELSE IFRCDEINI )+TOLIN.LT.RCONDEI )-TOL ) THEN
               VMAX = ( RCONDEI )-TOL ) / ( RCDEINI )+TOLIN )
            ELSE
               VMAX = ONE
            END IF
            RESULT11 ) = MAXRESULT11 ), VMAX )
  240    CONTINUE
  250    CONTINUE
*
      END IF
*
 9999 FORMAT( ' ZGET23: ', A, ' returned INFO=', I6, '.', / 9X, 'N=',
     $      I6, ', INPUT EXAMPLE NUMBER = ', I4 )
 9998 FORMAT( ' ZGET23: ', A, ' returned INFO=', I6, '.', / 9X, 'N=',
     $      I6, ', JTYPE=', I6, ', BALANC = ', A, ', ISEED=(',
     $      3( I5, ',' ), I5, ')' )
*
      RETURN
*
*     End of ZGET23
*
      END