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
     714
     715
     716
     717
     718
     719
     720
     721
     722
     723
     724
     725
     726
     727
     728
     729
     730
     731
     732
     733
     734
     735
     736
     737
     738
     739
     740
     741
     742
     743
     744
     745
     746
     747
     748
     749
     750
     751
     752
     753
     754
     755
     756
     757
     758
     759
     760
     761
     762
     763
     764
     765
     766
     767
     768
     769
     770
     771
     772
     773
     774
     775
     776
     777
     778
     779
     780
     781
     782
     783
     784
     785
     786
     787
     788
     789
     790
     791
     792
     793
     794
     795
     796
     797
     798
     799
     800
     801
     802
     803
     804
     805
     806
     807
     808
     809
     810
     811
     812
     813
     814
     815
     816
     817
     818
     819
     820
     821
     822
     823
     824
     825
     826
     827
     828
     829
     830
     831
     832
     833
     834
     835
     836
     837
     838
     839
     840
     841
     842
     843
     844
     845
     846
     847
     848
     849
     850
     851
     852
     853
     854
     855
      SUBROUTINE DGET24COMPJTYPETHRESHISEEDNOUNITNALDA,
     $                   HHTWRWIWRTWITWRTMPWITMPVS,
     $                   LDVSVS1RCDEINRCDVINNSLCTISLCT,
     $                   RESULTWORKLWORKIWORKBWORKINFO )
*
*  -- LAPACK test routine (version 3.1) --
*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
*     November 2006
*
*     .. Scalar Arguments ..
      LOGICAL            COMP
      INTEGER            INFOJTYPELDALDVSLWORKNNOUNITNSLCT
      DOUBLE PRECISION   RCDEINRCDVINTHRESH
*     ..
*     .. Array Arguments ..
      LOGICAL            BWORK* )
      INTEGER            ISEED4 ), ISLCT* ), IWORK* )
      DOUBLE PRECISION   ALDA* ), HLDA* ), HTLDA* ),
     $                   RESULT17 ), VSLDVS* ), VS1LDVS* ),
     $                   WI* ), WIT* ), WITMP* ), WORK* ),
     $                   WR* ), WRT* ), WRTMP* )
*     ..
*
*  Purpose
*  =======
*
*     DGET24 checks the nonsymmetric eigenvalue (Schur form) problem
*     expert driver DGEESX.
*
*     If COMP = .FALSE., the first 13 of the following tests will be
*     be performed on the input matrix A, and also tests 14 and 15
*     if LWORK is sufficiently large.
*     If COMP = .TRUE., all 17 test will be performed.
*
*     (1)     0 if T is in Schur form, 1/ulp otherwise
*            (no sorting of eigenvalues)
*
*     (2)     | A - VS T VS' | / ( n |A| ulp )
*
*       Here VS is the matrix of Schur eigenvectors, and T is in Schur
*       form  (no sorting of eigenvalues).
*
*     (3)     | I - VS VS' | / ( n ulp ) (no sorting of eigenvalues).
*
*     (4)     0     if WR+sqrt(-1)*WI are eigenvalues of T
*             1/ulp otherwise
*             (no sorting of eigenvalues)
*
*     (5)     0     if T(with VS) = T(without VS),
*             1/ulp otherwise
*             (no sorting of eigenvalues)
*
*     (6)     0     if eigenvalues(with VS) = eigenvalues(without VS),
*             1/ulp otherwise
*             (no sorting of eigenvalues)
*
*     (7)     0 if T is in Schur form, 1/ulp otherwise
*             (with sorting of eigenvalues)
*
*     (8)     | A - VS T VS' | / ( n |A| ulp )
*
*       Here VS is the matrix of Schur eigenvectors, and T is in Schur
*       form  (with sorting of eigenvalues).
*
*     (9)     | I - VS VS' | / ( n ulp ) (with sorting of eigenvalues).
*
*     (10)    0     if WR+sqrt(-1)*WI are eigenvalues of T
*             1/ulp otherwise
*             If workspace sufficient, also compare WR, WI with and
*             without reciprocal condition numbers
*             (with sorting of eigenvalues)
*
*     (11)    0     if T(with VS) = T(without VS),
*             1/ulp otherwise
*             If workspace sufficient, also compare T with and without
*             reciprocal condition numbers
*             (with sorting of eigenvalues)
*
*     (12)    0     if eigenvalues(with VS) = eigenvalues(without VS),
*             1/ulp otherwise
*             If workspace sufficient, also compare VS with and without
*             reciprocal condition numbers
*             (with sorting of eigenvalues)
*
*     (13)    if sorting worked and SDIM is the number of
*             eigenvalues which were SELECTed
*             If workspace sufficient, also compare SDIM with and
*             without reciprocal condition numbers
*
*     (14)    if RCONDE the same no matter if VS and/or RCONDV computed
*
*     (15)    if RCONDV the same no matter if VS and/or RCONDE computed
*
*     (16)  |RCONDE - RCDEIN| / cond(RCONDE)
*
*        RCONDE is the reciprocal average eigenvalue condition number
*        computed by DGEESX 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.
*
*     (17)  |RCONDV - RCDVIN| / cond(RCONDV)
*
*        RCONDV is the reciprocal right invariant subspace condition
*        number computed by DGEESX 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.
*
*  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
*
*  JTYPE   (input) INTEGER
*          Type of input matrix. Used to label output if error occurs.
*
*  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.
*
*  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.
*
*  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) DOUBLE PRECISION 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) DOUBLE PRECISION array, dimension (LDA, N)
*          Another copy of the test matrix A, modified by DGEESX.
*
*  HT      (workspace) DOUBLE PRECISION array, dimension (LDA, N)
*          Yet another copy of the test matrix A, modified by DGEESX.
*
*  WR      (workspace) DOUBLE PRECISION array, dimension (N)
*  WI      (workspace) DOUBLE PRECISION array, dimension (N)
*          The real and imaginary parts of the eigenvalues of A.
*          On exit, WR + WI*i are the eigenvalues of the matrix in A.
*
*  WRT     (workspace) DOUBLE PRECISION array, dimension (N)
*  WIT     (workspace) DOUBLE PRECISION array, dimension (N)
*          Like WR, WI, these arrays contain the eigenvalues of A,
*          but those computed when DGEESX only computes a partial
*          eigendecomposition, i.e. not Schur vectors
*
*  WRTMP   (workspace) DOUBLE PRECISION array, dimension (N)
*  WITMP   (workspace) DOUBLE PRECISION array, dimension (N)
*          Like WR, WI, these arrays contain the eigenvalues of A,
*          but sorted by increasing real part.
*
*  VS      (workspace) DOUBLE PRECISION array, dimension (LDVS, N)
*          VS holds the computed Schur vectors.
*
*  LDVS    (input) INTEGER
*          Leading dimension of VS. Must be at least max(1, N).
*
*  VS1     (workspace) DOUBLE PRECISION array, dimension (LDVS, N)
*          VS1 holds another copy of the computed Schur vectors.
*
*  RCDEIN  (input) DOUBLE PRECISION
*          When COMP = .TRUE. RCDEIN holds the precomputed reciprocal
*          condition number for the average of selected eigenvalues.
*
*  RCDVIN  (input) DOUBLE PRECISION
*          When COMP = .TRUE. RCDVIN holds the precomputed reciprocal
*          condition number for the selected right invariant subspace.
*
*  NSLCT   (input) INTEGER
*          When COMP = .TRUE. the number of selected eigenvalues
*          corresponding to the precomputed values RCDEIN and RCDVIN.
*
*  ISLCT   (input) INTEGER array, dimension (NSLCT)
*          When COMP = .TRUE. ISLCT selects the eigenvalues of the
*          input matrix corresponding to the precomputed values RCDEIN
*          and RCDVIN. For I=1, ... ,NSLCT, if ISLCT(I) = J, then the
*          eigenvalue with the J-th largest real part is selected.
*          Not referenced if COMP = .FALSE.
*
*  RESULT  (output) DOUBLE PRECISION array, dimension (17)
*          The values computed by the 17 tests described above.
*          The values are currently limited to 1/ulp, to avoid
*          overflow.
*
*  WORK    (workspace) DOUBLE PRECISION array, dimension (LWORK)
*
*  LWORK   (input) INTEGER
*          The number of entries in WORK to be passed to DGEESX. This
*          must be at least 3*N, and N+N**2 if tests 14--16 are to
*          be performed.
*
*  IWORK   (workspace) INTEGER array, dimension (N*N)
*
*  BWORK   (workspace) LOGICAL array, dimension (N)
*
*  INFO    (output) INTEGER
*          If 0,  successful exit.
*          If <0, input parameter -INFO had an incorrect value.
*          If >0, DGEESX returned an error code, the absolute
*                 value of which is returned.
*
*  =====================================================================
*
*     .. Parameters ..
      DOUBLE PRECISION   ZEROONE
      PARAMETER          ( ZERO = 0.0D0ONE = 1.0D0 )
      DOUBLE PRECISION   EPSIN
      PARAMETER          ( EPSIN = 5.9605D-8 )
*     ..
*     .. Local Scalars ..
      CHARACTER          SORT
      INTEGER            IIINFOISORTITMPJKMINKNTEIGLIWORK,
     $                   RSUBSDIMSDIM1
      DOUBLE PRECISION   ANORMEPSRCNDE1RCNDV1RCONDERCONDV,
     $                   SMLNUMTMPTOLTOLINULPULPINVVVIMIN,
     $                   VRMINWNORM
*     ..
*     .. Local Arrays ..
      INTEGER            IPNT20 )
*     ..
*     .. Arrays in Common ..
      LOGICAL            SELVAL20 )
      DOUBLE PRECISION   SELWI20 ), SELWR20 )
*     ..
*     .. Scalars in Common ..
      INTEGER            SELDIMSELOPT
*     ..
*     .. Common blocks ..
      COMMON             / SSLCT / SELOPTSELDIMSELVALSELWRSELWI
*     ..
*     .. External Functions ..
      LOGICAL            DSLECT
      DOUBLE PRECISION   DLAMCHDLANGE
      EXTERNAL           DSLECTDLAMCHDLANGE
*     ..
*     .. External Subroutines ..
      EXTERNAL           DCOPYDGEESXDGEMMDLACPYDORT01XERBLA
*     ..
*     .. Intrinsic Functions ..
      INTRINSIC          ABSDBLEMAXMINSIGNSQRT
*     ..
*     .. Executable Statements ..
*
*     Check for errors
*
      INFO = 0
      IFTHRESH.LT.ZERO ) THEN
         INFO = -3
      ELSE IFNOUNIT.LE.0 ) THEN
         INFO = -5
      ELSE IFN.LT.0 ) THEN
         INFO = -6
      ELSE IFLDA.LT.1 .OR. LDA.LT.N ) THEN
         INFO = -8
      ELSE IFLDVS.LT.1 .OR. LDVS.LT.N ) THEN
         INFO = -18
      ELSE IFLWORK.LT.3*N ) THEN
         INFO = -26
      END IF
*
      IFINFO.NE.0 ) THEN
         CALL XERBLA'DGET24'-INFO )
         RETURN
      END IF
*
*     Quick return if nothing to do
*
      DO 10 I = 117
         RESULTI ) = -ONE
   10 CONTINUE
*
      IFN.EQ.0 )
     $   RETURN
*
*     Important constants
*
      SMLNUM = DLAMCH'Safe minimum' )
      ULP = DLAMCH'Precision' )
      ULPINV = ONE / ULP
*
*     Perform tests (1)-(13)
*
      SELOPT = 0
      LIWORK = N*N
      DO 120 ISORT = 01
         IFISORT.EQ.0 ) THEN
            SORT = 'N'
            RSUB = 0
         ELSE
            SORT = 'S'
            RSUB = 6
         END IF
*
*        Compute Schur form and Schur vectors, and test them
*
         CALL DLACPY'F'NNALDAHLDA )
         CALL DGEESX'V'SORTDSLECT'N'NHLDASDIMWRWI,
     $                VSLDVSRCONDERCONDVWORKLWORKIWORK,
     $                LIWORKBWORKIINFO )
         IFIINFO.NE.0 .AND. IINFO.NE.N+2 ) THEN
            RESULT1+RSUB ) = ULPINV
            IFJTYPE.NE.22 ) THEN
               WRITENOUNIT, FMT = 9998 )'DGEESX1', IINFO, N, JTYPE,
     $            ISEED
            ELSE
               WRITENOUNIT, FMT = 9999 )'DGEESX1', IINFO, N,
     $            ISEED( 1 )
            END IF
            INFO = ABSIINFO )
            RETURN
         END IF
         IFISORT.EQ.0 ) THEN
            CALL DCOPYNWR1WRTMP1 )
            CALL DCOPYNWI1WITMP1 )
         END IF
*
*        Do Test (1) or Test (7)
*
         RESULT1+RSUB ) = ZERO
         DO 30 J = 1N - 2
            DO 20 I = J + 2N
               IFHIJ ).NE.ZERO )
     $            RESULT1+RSUB ) = ULPINV
   20       CONTINUE
   30    CONTINUE
         DO 40 I = 1N - 2
            IFHI+1I ).NE.ZERO .AND. HI+2I+1 ).NE.ZERO )
     $         RESULT1+RSUB ) = ULPINV
   40    CONTINUE
         DO 50 I = 1N - 1
            IFHI+1I ).NE.ZERO ) THEN
               IFHII ).NE.HI+1I+1 ) .OR. HII+1 ).EQ.
     $             ZERO .OR. SIGNONEHI+1I ) ).EQ.
     $             SIGNONEHII+1 ) ) )RESULT1+RSUB ) = ULPINV
            END IF
   50    CONTINUE
*
*        Test (2) or (8): Compute norm(A - Q*H*Q') / (norm(A) * N * ULP)
*
*        Copy A to VS1, used as workspace
*
         CALL DLACPY' 'NNALDAVS1LDVS )
*
*        Compute Q*H and store in HT.
*
         CALL DGEMM'No transpose''No transpose'NNNONEVS,
     $               LDVSHLDAZEROHTLDA )
*
*        Compute A - Q*H*Q'
*
         CALL DGEMM'No transpose''Transpose'NNN-ONEHT,
     $               LDAVSLDVSONEVS1LDVS )
*
         ANORM = MAXDLANGE'1'NNALDAWORK ), SMLNUM )
         WNORM = DLANGE'1'NNVS1LDVSWORK )
*
         IFANORM.GT.WNORM ) THEN
            RESULT2+RSUB ) = ( WNORM / ANORM ) / ( N*ULP )
         ELSE
            IFANORM.LT.ONE ) THEN
               RESULT2+RSUB ) = ( MINWNORMN*ANORM ) / ANORM ) /
     $                            ( N*ULP )
            ELSE
               RESULT2+RSUB ) = MINWNORM / ANORMDBLEN ) ) /
     $                            ( N*ULP )
            END IF
         END IF
*
*        Test (3) or (9):  Compute norm( I - Q'*Q ) / ( N * ULP )
*
         CALL DORT01'Columns'NNVSLDVSWORKLWORK,
     $                RESULT3+RSUB ) )
*
*        Do Test (4) or Test (10)
*
         RESULT4+RSUB ) = ZERO
         DO 60 I = 1N
            IFHII ).NE.WRI ) )
     $         RESULT4+RSUB ) = ULPINV
   60    CONTINUE
         IFN.GT.1 ) THEN
            IFH21 ).EQ.ZERO .AND. WI1 ).NE.ZERO )
     $         RESULT4+RSUB ) = ULPINV
            IFHNN-1 ).EQ.ZERO .AND. WIN ).NE.ZERO )
     $         RESULT4+RSUB ) = ULPINV
         END IF
         DO 70 I = 1N - 1
            IFHI+1I ).NE.ZERO ) THEN
               TMP = SQRTABSHI+1I ) ) )*
     $               SQRTABSHII+1 ) ) )
               RESULT4+RSUB ) = MAXRESULT4+RSUB ),
     $                            ABSWII )-TMP ) /
     $                            MAXULP*TMPSMLNUM ) )
               RESULT4+RSUB ) = MAXRESULT4+RSUB ),
     $                            ABSWII+1 )+TMP ) /
     $                            MAXULP*TMPSMLNUM ) )
            ELSE IFI.GT.1 ) THEN
               IFHI+1I ).EQ.ZERO .AND. HII-1 ).EQ.ZERO .AND.
     $             WII ).NE.ZERO )RESULT4+RSUB ) = ULPINV
            END IF
   70    CONTINUE
*
*        Do Test (5) or Test (11)
*
         CALL DLACPY'F'NNALDAHTLDA )
         CALL DGEESX'N'SORTDSLECT'N'NHTLDASDIMWRT,
     $                WITVSLDVSRCONDERCONDVWORKLWORKIWORK,
     $                LIWORKBWORKIINFO )
         IFIINFO.NE.0 .AND. IINFO.NE.N+2 ) THEN
            RESULT5+RSUB ) = ULPINV
            IFJTYPE.NE.22 ) THEN
               WRITENOUNIT, FMT = 9998 )'DGEESX2', IINFO, N, JTYPE,
     $            ISEED
            ELSE
               WRITENOUNIT, FMT = 9999 )'DGEESX2', IINFO, N,
     $            ISEED( 1 )
            END IF
            INFO = ABSIINFO )
            GO TO 250
         END IF
*
         RESULT5+RSUB ) = ZERO
         DO 90 J = 1N
            DO 80 I = 1N
               IFHIJ ).NE.HTIJ ) )
     $            RESULT5+RSUB ) = ULPINV
   80       CONTINUE
   90    CONTINUE
*
*        Do Test (6) or Test (12)
*
         RESULT6+RSUB ) = ZERO
         DO 100 I = 1N
            IFWRI ).NE.WRTI ) .OR. WII ).NE.WITI ) )
     $         RESULT6+RSUB ) = ULPINV
  100    CONTINUE
*
*        Do Test (13)
*
         IFISORT.EQ.1 ) THEN
            RESULT13 ) = ZERO
            KNTEIG = 0
            DO 110 I = 1N
               IFDSLECTWRI ), WII ) ) .OR.
     $             DSLECTWRI ), -WII ) ) )KNTEIG = KNTEIG + 1
               IFI.LT.N ) THEN
                  IF( ( DSLECTWRI+1 ), WII+1 ) ) .OR.
     $                DSLECTWRI+1 ), -WII+1 ) ) ) .AND.
     $                ( .NOT.DSLECTWRI ),
     $                WII ) ) .OR. DSLECTWRI ),
     $                -WII ) ) ) ) .AND. IINFO.NE.N+2 )RESULT13 )
     $                = ULPINV
               END IF
  110       CONTINUE
            IFSDIM.NE.KNTEIG )
     $         RESULT13 ) = ULPINV
         END IF
*
  120 CONTINUE
*
*     If there is enough workspace, perform tests (14) and (15)
*     as well as (10) through (13)
*
      IFLWORK.GE.N+N*N ) / 2 ) THEN
*
*        Compute both RCONDE and RCONDV with VS
*
         SORT = 'S'
         RESULT14 ) = ZERO
         RESULT15 ) = ZERO
         CALL DLACPY'F'NNALDAHTLDA )
         CALL DGEESX'V'SORTDSLECT'B'NHTLDASDIM1WRT,
     $                WITVS1LDVSRCONDERCONDVWORKLWORK,
     $                IWORKLIWORKBWORKIINFO )
         IFIINFO.NE.0 .AND. IINFO.NE.N+2 ) THEN
            RESULT14 ) = ULPINV
            RESULT15 ) = ULPINV
            IFJTYPE.NE.22 ) THEN
               WRITENOUNIT, FMT = 9998 )'DGEESX3', IINFO, N, JTYPE,
     $            ISEED
            ELSE
               WRITENOUNIT, FMT = 9999 )'DGEESX3', IINFO, N,
     $            ISEED( 1 )
            END IF
            INFO = ABSIINFO )
            GO TO 250
         END IF
*
*        Perform tests (10), (11), (12), and (13)
*
         DO 140 I = 1N
            IFWRI ).NE.WRTI ) .OR. WII ).NE.WITI ) )
     $         RESULT10 ) = ULPINV
            DO 130 J = 1N
               IFHIJ ).NE.HTIJ ) )
     $            RESULT11 ) = ULPINV
               IFVSIJ ).NE.VS1IJ ) )
     $            RESULT12 ) = ULPINV
  130       CONTINUE
  140    CONTINUE
         IFSDIM.NE.SDIM1 )
     $      RESULT13 ) = ULPINV
*
*        Compute both RCONDE and RCONDV without VS, and compare
*
         CALL DLACPY'F'NNALDAHTLDA )
         CALL DGEESX'N'SORTDSLECT'B'NHTLDASDIM1WRT,
     $                WITVS1LDVSRCNDE1RCNDV1WORKLWORK,
     $                IWORKLIWORKBWORKIINFO )
         IFIINFO.NE.0 .AND. IINFO.NE.N+2 ) THEN
            RESULT14 ) = ULPINV
            RESULT15 ) = ULPINV
            IFJTYPE.NE.22 ) THEN
               WRITENOUNIT, FMT = 9998 )'DGEESX4', IINFO, N, JTYPE,
     $            ISEED
            ELSE
               WRITENOUNIT, FMT = 9999 )'DGEESX4', IINFO, N,
     $            ISEED( 1 )
            END IF
            INFO = ABSIINFO )
            GO TO 250
         END IF
*
*        Perform tests (14) and (15)
*
         IFRCNDE1.NE.RCONDE )
     $      RESULT14 ) = ULPINV
         IFRCNDV1.NE.RCONDV )
     $      RESULT15 ) = ULPINV
*
*        Perform tests (10), (11), (12), and (13)
*
         DO 160 I = 1N
            IFWRI ).NE.WRTI ) .OR. WII ).NE.WITI ) )
     $         RESULT10 ) = ULPINV
            DO 150 J = 1N
               IFHIJ ).NE.HTIJ ) )
     $            RESULT11 ) = ULPINV
               IFVSIJ ).NE.VS1IJ ) )
     $            RESULT12 ) = ULPINV
  150       CONTINUE
  160    CONTINUE
         IFSDIM.NE.SDIM1 )
     $      RESULT13 ) = ULPINV
*
*        Compute RCONDE with VS, and compare
*
         CALL DLACPY'F'NNALDAHTLDA )
         CALL DGEESX'V'SORTDSLECT'E'NHTLDASDIM1WRT,
     $                WITVS1LDVSRCNDE1RCNDV1WORKLWORK,
     $                IWORKLIWORKBWORKIINFO )
         IFIINFO.NE.0 .AND. IINFO.NE.N+2 ) THEN
            RESULT14 ) = ULPINV
            IFJTYPE.NE.22 ) THEN
               WRITENOUNIT, FMT = 9998 )'DGEESX5', IINFO, N, JTYPE,
     $            ISEED
            ELSE
               WRITENOUNIT, FMT = 9999 )'DGEESX5', IINFO, N,
     $            ISEED( 1 )
            END IF
            INFO = ABSIINFO )
            GO TO 250
         END IF
*
*        Perform test (14)
*
         IFRCNDE1.NE.RCONDE )
     $      RESULT14 ) = ULPINV
*
*        Perform tests (10), (11), (12), and (13)
*
         DO 180 I = 1N
            IFWRI ).NE.WRTI ) .OR. WII ).NE.WITI ) )
     $         RESULT10 ) = ULPINV
            DO 170 J = 1N
               IFHIJ ).NE.HTIJ ) )
     $            RESULT11 ) = ULPINV
               IFVSIJ ).NE.VS1IJ ) )
     $            RESULT12 ) = ULPINV
  170       CONTINUE
  180    CONTINUE
         IFSDIM.NE.SDIM1 )
     $      RESULT13 ) = ULPINV
*
*        Compute RCONDE without VS, and compare
*
         CALL DLACPY'F'NNALDAHTLDA )
         CALL DGEESX'N'SORTDSLECT'E'NHTLDASDIM1WRT,
     $                WITVS1LDVSRCNDE1RCNDV1WORKLWORK,
     $                IWORKLIWORKBWORKIINFO )
         IFIINFO.NE.0 .AND. IINFO.NE.N+2 ) THEN
            RESULT14 ) = ULPINV
            IFJTYPE.NE.22 ) THEN
               WRITENOUNIT, FMT = 9998 )'DGEESX6', IINFO, N, JTYPE,
     $            ISEED
            ELSE
               WRITENOUNIT, FMT = 9999 )'DGEESX6', IINFO, N,
     $            ISEED( 1 )
            END IF
            INFO = ABSIINFO )
            GO TO 250
         END IF
*
*        Perform test (14)
*
         IFRCNDE1.NE.RCONDE )
     $      RESULT14 ) = ULPINV
*
*        Perform tests (10), (11), (12), and (13)
*
         DO 200 I = 1N
            IFWRI ).NE.WRTI ) .OR. WII ).NE.WITI ) )
     $         RESULT10 ) = ULPINV
            DO 190 J = 1N
               IFHIJ ).NE.HTIJ ) )
     $            RESULT11 ) = ULPINV
               IFVSIJ ).NE.VS1IJ ) )
     $            RESULT12 ) = ULPINV
  190       CONTINUE
  200    CONTINUE
         IFSDIM.NE.SDIM1 )
     $      RESULT13 ) = ULPINV
*
*        Compute RCONDV with VS, and compare
*
         CALL DLACPY'F'NNALDAHTLDA )
         CALL DGEESX'V'SORTDSLECT'V'NHTLDASDIM1WRT,
     $                WITVS1LDVSRCNDE1RCNDV1WORKLWORK,
     $                IWORKLIWORKBWORKIINFO )
         IFIINFO.NE.0 .AND. IINFO.NE.N+2 ) THEN
            RESULT15 ) = ULPINV
            IFJTYPE.NE.22 ) THEN
               WRITENOUNIT, FMT = 9998 )'DGEESX7', IINFO, N, JTYPE,
     $            ISEED
            ELSE
               WRITENOUNIT, FMT = 9999 )'DGEESX7', IINFO, N,
     $            ISEED( 1 )
            END IF
            INFO = ABSIINFO )
            GO TO 250
         END IF
*
*        Perform test (15)
*
         IFRCNDV1.NE.RCONDV )
     $      RESULT15 ) = ULPINV
*
*        Perform tests (10), (11), (12), and (13)
*
         DO 220 I = 1N
            IFWRI ).NE.WRTI ) .OR. WII ).NE.WITI ) )
     $         RESULT10 ) = ULPINV
            DO 210 J = 1N
               IFHIJ ).NE.HTIJ ) )
     $            RESULT11 ) = ULPINV
               IFVSIJ ).NE.VS1IJ ) )
     $            RESULT12 ) = ULPINV
  210       CONTINUE
  220    CONTINUE
         IFSDIM.NE.SDIM1 )
     $      RESULT13 ) = ULPINV
*
*        Compute RCONDV without VS, and compare
*
         CALL DLACPY'F'NNALDAHTLDA )
         CALL DGEESX'N'SORTDSLECT'V'NHTLDASDIM1WRT,
     $                WITVS1LDVSRCNDE1RCNDV1WORKLWORK,
     $                IWORKLIWORKBWORKIINFO )
         IFIINFO.NE.0 .AND. IINFO.NE.N+2 ) THEN
            RESULT15 ) = ULPINV
            IFJTYPE.NE.22 ) THEN
               WRITENOUNIT, FMT = 9998 )'DGEESX8', IINFO, N, JTYPE,
     $            ISEED
            ELSE
               WRITENOUNIT, FMT = 9999 )'DGEESX8', IINFO, N,
     $            ISEED( 1 )
            END IF
            INFO = ABSIINFO )
            GO TO 250
         END IF
*
*        Perform test (15)
*
         IFRCNDV1.NE.RCONDV )
     $      RESULT15 ) = ULPINV
*
*        Perform tests (10), (11), (12), and (13)
*
         DO 240 I = 1N
            IFWRI ).NE.WRTI ) .OR. WII ).NE.WITI ) )
     $         RESULT10 ) = ULPINV
            DO 230 J = 1N
               IFHIJ ).NE.HTIJ ) )
     $            RESULT11 ) = ULPINV
               IFVSIJ ).NE.VS1IJ ) )
     $            RESULT12 ) = ULPINV
  230       CONTINUE
  240    CONTINUE
         IFSDIM.NE.SDIM1 )
     $      RESULT13 ) = ULPINV
*
      END IF
*
  250 CONTINUE
*
*     If there are precomputed reciprocal condition numbers, compare
*     computed values with them.
*
      IFCOMP ) THEN
*
*        First set up SELOPT, SELDIM, SELVAL, SELWR, and SELWI so that
*        the logical function DSLECT selects the eigenvalues specified
*        by NSLCT and ISLCT.
*
         SELDIM = N
         SELOPT = 1
         EPS = MAXULPEPSIN )
         DO 260 I = 1N
            IPNTI ) = I
            SELVALI ) = .FALSE.
            SELWRI ) = WRTMPI )
            SELWII ) = WITMPI )
  260    CONTINUE
         DO 280 I = 1N - 1
            KMIN = I
            VRMIN = WRTMPI )
            VIMIN = WITMPI )
            DO 270 J = I + 1N
               IFWRTMPJ ).LT.VRMIN ) THEN
                  KMIN = J
                  VRMIN = WRTMPJ )
                  VIMIN = WITMPJ )
               END IF
  270       CONTINUE
            WRTMPKMIN ) = WRTMPI )
            WITMPKMIN ) = WITMPI )
            WRTMPI ) = VRMIN
            WITMPI ) = VIMIN
            ITMP = IPNTI )
            IPNTI ) = IPNTKMIN )
            IPNTKMIN ) = ITMP
  280    CONTINUE
         DO 290 I = 1NSLCT
            SELVALIPNTISLCTI ) ) ) = .TRUE.
  290    CONTINUE
*
*        Compute condition numbers
*
         CALL DLACPY'F'NNALDAHTLDA )
         CALL DGEESX'N''S'DSLECT'B'NHTLDASDIM1WRT,
     $                WITVS1LDVSRCONDERCONDVWORKLWORK,
     $                IWORKLIWORKBWORKIINFO )
         IFIINFO.NE.0 .AND. IINFO.NE.N+2 ) THEN
            RESULT16 ) = ULPINV
            RESULT17 ) = ULPINV
            WRITENOUNIT, FMT = 9999 )'DGEESX9', IINFO, N, ISEED( 1 )
            INFO = ABSIINFO )
            GO TO 300
         END IF
*
*        Compare condition number for average of selected eigenvalues
*        taking its condition number into account
*
         ANORM = DLANGE'1'NNALDAWORK )
         V = MAXDBLEN )*EPS*ANORMSMLNUM )
         IFANORM.EQ.ZERO )
     $      V = ONE
         IFV.GT.RCONDV ) THEN
            TOL = ONE
         ELSE
            TOL = V / RCONDV
         END IF
         IFV.GT.RCDVIN ) THEN
            TOLIN = ONE
         ELSE
            TOLIN = V / RCDVIN
         END IF
         TOL = MAXTOLSMLNUM / EPS )
         TOLIN = MAXTOLINSMLNUM / EPS )
         IFEPS*RCDEIN-TOLIN ).GT.RCONDE+TOL ) THEN
            RESULT16 ) = ULPINV
         ELSE IFRCDEIN-TOLIN.GT.RCONDE+TOL ) THEN
            RESULT16 ) = ( RCDEIN-TOLIN ) / ( RCONDE+TOL )
         ELSE IFRCDEIN+TOLIN.LT.EPS*RCONDE-TOL ) ) THEN
            RESULT16 ) = ULPINV
         ELSE IFRCDEIN+TOLIN.LT.RCONDE-TOL ) THEN
            RESULT16 ) = ( RCONDE-TOL ) / ( RCDEIN+TOLIN )
         ELSE
            RESULT16 ) = ONE
         END IF
*
*        Compare condition numbers for right invariant subspace
*        taking its condition number into account
*
         IFV.GT.RCONDV*RCONDE ) THEN
            TOL = RCONDV
         ELSE
            TOL = V / RCONDE
         END IF
         IFV.GT.RCDVIN*RCDEIN ) THEN
            TOLIN = RCDVIN
         ELSE
            TOLIN = V / RCDEIN
         END IF
         TOL = MAXTOLSMLNUM / EPS )
         TOLIN = MAXTOLINSMLNUM / EPS )
         IFEPS*RCDVIN-TOLIN ).GT.RCONDV+TOL ) THEN
            RESULT17 ) = ULPINV
         ELSE IFRCDVIN-TOLIN.GT.RCONDV+TOL ) THEN
            RESULT17 ) = ( RCDVIN-TOLIN ) / ( RCONDV+TOL )
         ELSE IFRCDVIN+TOLIN.LT.EPS*RCONDV-TOL ) ) THEN
            RESULT17 ) = ULPINV
         ELSE IFRCDVIN+TOLIN.LT.RCONDV-TOL ) THEN
            RESULT17 ) = ( RCONDV-TOL ) / ( RCDVIN+TOLIN )
         ELSE
            RESULT17 ) = ONE
         END IF
*
  300    CONTINUE
*
      END IF
*
 9999 FORMAT( ' DGET24: ', A, ' returned INFO=', I6, '.', / 9X, 'N=',
     $      I6, ', INPUT EXAMPLE NUMBER = ', I4 )
 9998 FORMAT( ' DGET24: ', A, ' returned INFO=', I6, '.', / 9X, 'N=',
     $      I6, ', JTYPE=', I6, ', ISEED=(', 3( I5, ',' ), I5, ')' )
*
      RETURN
*
*     End of DGET24
*
      END