1*> \brief \b CDRVHEX
2*
3*  =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6*            http://www.netlib.org/lapack/explore-html/
7*
8*  Definition:
9*  ===========
10*
11*       SUBROUTINE CDRVHE( DOTYPE, NN, NVAL, NRHS, THRESH, TSTERR, NMAX,
12*                          A, AFAC, AINV, B, X, XACT, WORK, RWORK, IWORK,
13*                          NOUT )
14*
15*       .. Scalar Arguments ..
16*       LOGICAL            TSTERR
17*       INTEGER            NMAX, NN, NOUT, NRHS
18*       REAL               THRESH
19*       ..
20*       .. Array Arguments ..
21*       LOGICAL            DOTYPE( * )
22*       INTEGER            IWORK( * ), NVAL( * )
23*       REAL               RWORK( * )
24*       COMPLEX            A( * ), AFAC( * ), AINV( * ), B( * ),
25*      $                   WORK( * ), X( * ), XACT( * )
26*       ..
27*
28*
29*> \par Purpose:
30*  =============
31*>
32*> \verbatim
33*>
34*> CDRVHE tests the driver routines CHESV, -SVX, and -SVXX.
35*>
36*> Note that this file is used only when the XBLAS are available,
37*> otherwise cdrvhe.f defines this subroutine.
38*> \endverbatim
39*
40*  Arguments:
41*  ==========
42*
43*> \param[in] DOTYPE
44*> \verbatim
45*>          DOTYPE is LOGICAL array, dimension (NTYPES)
46*>          The matrix types to be used for testing.  Matrices of type j
47*>          (for 1 <= j <= NTYPES) are used for testing if DOTYPE(j) =
48*>          .TRUE.; if DOTYPE(j) = .FALSE., then type j is not used.
49*> \endverbatim
50*>
51*> \param[in] NN
52*> \verbatim
53*>          NN is INTEGER
54*>          The number of values of N contained in the vector NVAL.
55*> \endverbatim
56*>
57*> \param[in] NVAL
58*> \verbatim
59*>          NVAL is INTEGER array, dimension (NN)
60*>          The values of the matrix dimension N.
61*> \endverbatim
62*>
63*> \param[in] NRHS
64*> \verbatim
65*>          NRHS is INTEGER
66*>          The number of right hand side vectors to be generated for
67*>          each linear system.
68*> \endverbatim
69*>
70*> \param[in] THRESH
71*> \verbatim
72*>          THRESH is REAL
73*>          The threshold value for the test ratios.  A result is
74*>          included in the output file if RESULT >= THRESH.  To have
75*>          every test ratio printed, use THRESH = 0.
76*> \endverbatim
77*>
78*> \param[in] TSTERR
79*> \verbatim
80*>          TSTERR is LOGICAL
81*>          Flag that indicates whether error exits are to be tested.
82*> \endverbatim
83*>
84*> \param[in] NMAX
85*> \verbatim
86*>          NMAX is INTEGER
87*>          The maximum value permitted for N, used in dimensioning the
88*>          work arrays.
89*> \endverbatim
90*>
91*> \param[out] A
92*> \verbatim
93*>          A is COMPLEX array, dimension (NMAX*NMAX)
94*> \endverbatim
95*>
96*> \param[out] AFAC
97*> \verbatim
98*>          AFAC is COMPLEX array, dimension (NMAX*NMAX)
99*> \endverbatim
100*>
101*> \param[out] AINV
102*> \verbatim
103*>          AINV is COMPLEX array, dimension (NMAX*NMAX)
104*> \endverbatim
105*>
106*> \param[out] B
107*> \verbatim
108*>          B is COMPLEX array, dimension (NMAX*NRHS)
109*> \endverbatim
110*>
111*> \param[out] X
112*> \verbatim
113*>          X is COMPLEX array, dimension (NMAX*NRHS)
114*> \endverbatim
115*>
116*> \param[out] XACT
117*> \verbatim
118*>          XACT is COMPLEX array, dimension (NMAX*NRHS)
119*> \endverbatim
120*>
121*> \param[out] WORK
122*> \verbatim
123*>          WORK is COMPLEX array, dimension
124*>                      (NMAX*max(2,NRHS))
125*> \endverbatim
126*>
127*> \param[out] RWORK
128*> \verbatim
129*>          RWORK is REAL array, dimension (2*NMAX+2*NRHS)
130*> \endverbatim
131*>
132*> \param[out] IWORK
133*> \verbatim
134*>          IWORK is INTEGER array, dimension (NMAX)
135*> \endverbatim
136*>
137*> \param[in] NOUT
138*> \verbatim
139*>          NOUT is INTEGER
140*>          The unit number for output.
141*> \endverbatim
142*
143*  Authors:
144*  ========
145*
146*> \author Univ. of Tennessee
147*> \author Univ. of California Berkeley
148*> \author Univ. of Colorado Denver
149*> \author NAG Ltd.
150*
151*> \ingroup complex_lin
152*
153*  =====================================================================
154      SUBROUTINE CDRVHE( DOTYPE, NN, NVAL, NRHS, THRESH, TSTERR, NMAX,
155     $                   A, AFAC, AINV, B, X, XACT, WORK, RWORK, IWORK,
156     $                   NOUT )
157*
158*  -- LAPACK test routine --
159*  -- LAPACK is a software package provided by Univ. of Tennessee,    --
160*  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
161*
162*     .. Scalar Arguments ..
163      LOGICAL            TSTERR
164      INTEGER            NMAX, NN, NOUT, NRHS
165      REAL               THRESH
166*     ..
167*     .. Array Arguments ..
168      LOGICAL            DOTYPE( * )
169      INTEGER            IWORK( * ), NVAL( * )
170      REAL               RWORK( * )
171      COMPLEX            A( * ), AFAC( * ), AINV( * ), B( * ),
172     $                   WORK( * ), X( * ), XACT( * )
173*     ..
174*
175*  =====================================================================
176*
177*     .. Parameters ..
178      REAL               ONE, ZERO
179      PARAMETER          ( ONE = 1.0E+0, ZERO = 0.0E+0 )
180      INTEGER            NTYPES, NTESTS
181      PARAMETER          ( NTYPES = 10, NTESTS = 6 )
182      INTEGER            NFACT
183      PARAMETER          ( NFACT = 2 )
184*     ..
185*     .. Local Scalars ..
186      LOGICAL            ZEROT
187      CHARACTER          DIST, EQUED, FACT, TYPE, UPLO, XTYPE
188      CHARACTER*3        PATH
189      INTEGER            I, I1, I2, IFACT, IMAT, IN, INFO, IOFF, IUPLO,
190     $                   IZERO, J, K, K1, KL, KU, LDA, LWORK, MODE, N,
191     $                   NB, NBMIN, NERRS, NFAIL, NIMAT, NRUN, NT,
192     $                   N_ERR_BNDS
193      REAL               AINVNM, ANORM, CNDNUM, RCOND, RCONDC,
194     $                   RPVGRW_SVXX
195*     ..
196*     .. Local Arrays ..
197      CHARACTER          FACTS( NFACT ), UPLOS( 2 )
198      INTEGER            ISEED( 4 ), ISEEDY( 4 )
199      REAL               RESULT( NTESTS ), BERR( NRHS ),
200     $                   ERRBNDS_N( NRHS, 3 ), ERRBNDS_C( NRHS, 3 )
201*     ..
202*     .. External Functions ..
203      REAL               CLANHE, SGET06
204      EXTERNAL           CLANHE, SGET06
205*     ..
206*     .. External Subroutines ..
207      EXTERNAL           ALADHD, ALAERH, ALASVM, CERRVX, CGET04, CHESV,
208     $                   CHESVX, CHET01, CHETRF, CHETRI2, CLACPY,
209     $                   CLAIPD, CLARHS, CLASET, CLATB4, CLATMS, CPOT02,
210     $                   CPOT05, XLAENV, CHESVXX
211*     ..
212*     .. Scalars in Common ..
213      LOGICAL            LERR, OK
214      CHARACTER*32       SRNAMT
215      INTEGER            INFOT, NUNIT
216*     ..
217*     .. Common blocks ..
218      COMMON             / INFOC / INFOT, NUNIT, OK, LERR
219      COMMON             / SRNAMC / SRNAMT
220*     ..
221*     .. Intrinsic Functions ..
222      INTRINSIC          CMPLX, MAX, MIN
223*     ..
224*     .. Data statements ..
225      DATA               ISEEDY / 1988, 1989, 1990, 1991 /
226      DATA               UPLOS / 'U', 'L' / , FACTS / 'F', 'N' /
227*     ..
228*     .. Executable Statements ..
229*
230*     Initialize constants and the random number seed.
231*
232      PATH( 1: 1 ) = 'C'
233      PATH( 2: 3 ) = 'HE'
234      NRUN = 0
235      NFAIL = 0
236      NERRS = 0
237      DO 10 I = 1, 4
238         ISEED( I ) = ISEEDY( I )
239   10 CONTINUE
240      LWORK = MAX( 2*NMAX, NMAX*NRHS )
241*
242*     Test the error exits
243*
244      IF( TSTERR )
245     $   CALL CERRVX( PATH, NOUT )
246      INFOT = 0
247*
248*     Set the block size and minimum block size for testing.
249*
250      NB = 1
251      NBMIN = 2
252      CALL XLAENV( 1, NB )
253      CALL XLAENV( 2, NBMIN )
254*
255*     Do for each value of N in NVAL
256*
257      DO 180 IN = 1, NN
258         N = NVAL( IN )
259         LDA = MAX( N, 1 )
260         XTYPE = 'N'
261         NIMAT = NTYPES
262         IF( N.LE.0 )
263     $      NIMAT = 1
264*
265         DO 170 IMAT = 1, NIMAT
266*
267*           Do the tests only if DOTYPE( IMAT ) is true.
268*
269            IF( .NOT.DOTYPE( IMAT ) )
270     $         GO TO 170
271*
272*           Skip types 3, 4, 5, or 6 if the matrix size is too small.
273*
274            ZEROT = IMAT.GE.3 .AND. IMAT.LE.6
275            IF( ZEROT .AND. N.LT.IMAT-2 )
276     $         GO TO 170
277*
278*           Do first for UPLO = 'U', then for UPLO = 'L'
279*
280            DO 160 IUPLO = 1, 2
281               UPLO = UPLOS( IUPLO )
282*
283*              Set up parameters with CLATB4 and generate a test matrix
284*              with CLATMS.
285*
286               CALL CLATB4( PATH, IMAT, N, N, TYPE, KL, KU, ANORM, MODE,
287     $                      CNDNUM, DIST )
288*
289               SRNAMT = 'CLATMS'
290               CALL CLATMS( N, N, DIST, ISEED, TYPE, RWORK, MODE,
291     $                      CNDNUM, ANORM, KL, KU, UPLO, A, LDA, WORK,
292     $                      INFO )
293*
294*              Check error code from CLATMS.
295*
296               IF( INFO.NE.0 ) THEN
297                  CALL ALAERH( PATH, 'CLATMS', INFO, 0, UPLO, N, N, -1,
298     $                         -1, -1, IMAT, NFAIL, NERRS, NOUT )
299                  GO TO 160
300               END IF
301*
302*              For types 3-6, zero one or more rows and columns of the
303*              matrix to test that INFO is returned correctly.
304*
305               IF( ZEROT ) THEN
306                  IF( IMAT.EQ.3 ) THEN
307                     IZERO = 1
308                  ELSE IF( IMAT.EQ.4 ) THEN
309                     IZERO = N
310                  ELSE
311                     IZERO = N / 2 + 1
312                  END IF
313*
314                  IF( IMAT.LT.6 ) THEN
315*
316*                    Set row and column IZERO to zero.
317*
318                     IF( IUPLO.EQ.1 ) THEN
319                        IOFF = ( IZERO-1 )*LDA
320                        DO 20 I = 1, IZERO - 1
321                           A( IOFF+I ) = ZERO
322   20                   CONTINUE
323                        IOFF = IOFF + IZERO
324                        DO 30 I = IZERO, N
325                           A( IOFF ) = ZERO
326                           IOFF = IOFF + LDA
327   30                   CONTINUE
328                     ELSE
329                        IOFF = IZERO
330                        DO 40 I = 1, IZERO - 1
331                           A( IOFF ) = ZERO
332                           IOFF = IOFF + LDA
333   40                   CONTINUE
334                        IOFF = IOFF - IZERO
335                        DO 50 I = IZERO, N
336                           A( IOFF+I ) = ZERO
337   50                   CONTINUE
338                     END IF
339                  ELSE
340                     IOFF = 0
341                     IF( IUPLO.EQ.1 ) THEN
342*
343*                       Set the first IZERO rows and columns to zero.
344*
345                        DO 70 J = 1, N
346                           I2 = MIN( J, IZERO )
347                           DO 60 I = 1, I2
348                              A( IOFF+I ) = ZERO
349   60                      CONTINUE
350                           IOFF = IOFF + LDA
351   70                   CONTINUE
352                     ELSE
353*
354*                       Set the last IZERO rows and columns to zero.
355*
356                        DO 90 J = 1, N
357                           I1 = MAX( J, IZERO )
358                           DO 80 I = I1, N
359                              A( IOFF+I ) = ZERO
360   80                      CONTINUE
361                           IOFF = IOFF + LDA
362   90                   CONTINUE
363                     END IF
364                  END IF
365               ELSE
366                  IZERO = 0
367               END IF
368*
369*              Set the imaginary part of the diagonals.
370*
371               CALL CLAIPD( N, A, LDA+1, 0 )
372*
373               DO 150 IFACT = 1, NFACT
374*
375*                 Do first for FACT = 'F', then for other values.
376*
377                  FACT = FACTS( IFACT )
378*
379*                 Compute the condition number for comparison with
380*                 the value returned by CHESVX.
381*
382                  IF( ZEROT ) THEN
383                     IF( IFACT.EQ.1 )
384     $                  GO TO 150
385                     RCONDC = ZERO
386*
387                  ELSE IF( IFACT.EQ.1 ) THEN
388*
389*                    Compute the 1-norm of A.
390*
391                     ANORM = CLANHE( '1', UPLO, N, A, LDA, RWORK )
392*
393*                    Factor the matrix A.
394*
395                     CALL CLACPY( UPLO, N, N, A, LDA, AFAC, LDA )
396                     CALL CHETRF( UPLO, N, AFAC, LDA, IWORK, WORK,
397     $                            LWORK, INFO )
398*
399*                    Compute inv(A) and take its norm.
400*
401                     CALL CLACPY( UPLO, N, N, AFAC, LDA, AINV, LDA )
402                     LWORK = (N+NB+1)*(NB+3)
403                     CALL CHETRI2( UPLO, N, AINV, LDA, IWORK, WORK,
404     $                            LWORK, INFO )
405                     AINVNM = CLANHE( '1', UPLO, N, AINV, LDA, RWORK )
406*
407*                    Compute the 1-norm condition number of A.
408*
409                     IF( ANORM.LE.ZERO .OR. AINVNM.LE.ZERO ) THEN
410                        RCONDC = ONE
411                     ELSE
412                        RCONDC = ( ONE / ANORM ) / AINVNM
413                     END IF
414                  END IF
415*
416*                 Form an exact solution and set the right hand side.
417*
418                  SRNAMT = 'CLARHS'
419                  CALL CLARHS( PATH, XTYPE, UPLO, ' ', N, N, KL, KU,
420     $                         NRHS, A, LDA, XACT, LDA, B, LDA, ISEED,
421     $                         INFO )
422                  XTYPE = 'C'
423*
424*                 --- Test CHESV  ---
425*
426                  IF( IFACT.EQ.2 ) THEN
427                     CALL CLACPY( UPLO, N, N, A, LDA, AFAC, LDA )
428                     CALL CLACPY( 'Full', N, NRHS, B, LDA, X, LDA )
429*
430*                    Factor the matrix and solve the system using CHESV.
431*
432                     SRNAMT = 'CHESV '
433                     CALL CHESV( UPLO, N, NRHS, AFAC, LDA, IWORK, X,
434     $                           LDA, WORK, LWORK, INFO )
435*
436*                    Adjust the expected value of INFO to account for
437*                    pivoting.
438*
439                     K = IZERO
440                     IF( K.GT.0 ) THEN
441  100                   CONTINUE
442                        IF( IWORK( K ).LT.0 ) THEN
443                           IF( IWORK( K ).NE.-K ) THEN
444                              K = -IWORK( K )
445                              GO TO 100
446                           END IF
447                        ELSE IF( IWORK( K ).NE.K ) THEN
448                           K = IWORK( K )
449                           GO TO 100
450                        END IF
451                     END IF
452*
453*                    Check error code from CHESV .
454*
455                     IF( INFO.NE.K ) THEN
456                        CALL ALAERH( PATH, 'CHESV ', INFO, K, UPLO, N,
457     $                               N, -1, -1, NRHS, IMAT, NFAIL,
458     $                               NERRS, NOUT )
459                        GO TO 120
460                     ELSE IF( INFO.NE.0 ) THEN
461                        GO TO 120
462                     END IF
463*
464*                    Reconstruct matrix from factors and compute
465*                    residual.
466*
467                     CALL CHET01( UPLO, N, A, LDA, AFAC, LDA, IWORK,
468     $                            AINV, LDA, RWORK, RESULT( 1 ) )
469*
470*                    Compute residual of the computed solution.
471*
472                     CALL CLACPY( 'Full', N, NRHS, B, LDA, WORK, LDA )
473                     CALL CPOT02( UPLO, N, NRHS, A, LDA, X, LDA, WORK,
474     $                            LDA, RWORK, RESULT( 2 ) )
475*
476*                    Check solution from generated exact solution.
477*
478                     CALL CGET04( N, NRHS, X, LDA, XACT, LDA, RCONDC,
479     $                            RESULT( 3 ) )
480                     NT = 3
481*
482*                    Print information about the tests that did not pass
483*                    the threshold.
484*
485                     DO 110 K = 1, NT
486                        IF( RESULT( K ).GE.THRESH ) THEN
487                           IF( NFAIL.EQ.0 .AND. NERRS.EQ.0 )
488     $                        CALL ALADHD( NOUT, PATH )
489                           WRITE( NOUT, FMT = 9999 )'CHESV ', UPLO, N,
490     $                        IMAT, K, RESULT( K )
491                           NFAIL = NFAIL + 1
492                        END IF
493  110                CONTINUE
494                     NRUN = NRUN + NT
495  120                CONTINUE
496                  END IF
497*
498*                 --- Test CHESVX ---
499*
500                  IF( IFACT.EQ.2 )
501     $               CALL CLASET( UPLO, N, N, CMPLX( ZERO ),
502     $                            CMPLX( ZERO ), AFAC, LDA )
503                  CALL CLASET( 'Full', N, NRHS, CMPLX( ZERO ),
504     $                         CMPLX( ZERO ), X, LDA )
505*
506*                 Solve the system and compute the condition number and
507*                 error bounds using CHESVX.
508*
509                  SRNAMT = 'CHESVX'
510                  CALL CHESVX( FACT, UPLO, N, NRHS, A, LDA, AFAC, LDA,
511     $                         IWORK, B, LDA, X, LDA, RCOND, RWORK,
512     $                         RWORK( NRHS+1 ), WORK, LWORK,
513     $                         RWORK( 2*NRHS+1 ), INFO )
514*
515*                 Adjust the expected value of INFO to account for
516*                 pivoting.
517*
518                  K = IZERO
519                  IF( K.GT.0 ) THEN
520  130                CONTINUE
521                     IF( IWORK( K ).LT.0 ) THEN
522                        IF( IWORK( K ).NE.-K ) THEN
523                           K = -IWORK( K )
524                           GO TO 130
525                        END IF
526                     ELSE IF( IWORK( K ).NE.K ) THEN
527                        K = IWORK( K )
528                        GO TO 130
529                     END IF
530                  END IF
531*
532*                 Check the error code from CHESVX.
533*
534                  IF( INFO.NE.K ) THEN
535                     CALL ALAERH( PATH, 'CHESVX', INFO, K, FACT // UPLO,
536     $                            N, N, -1, -1, NRHS, IMAT, NFAIL,
537     $                            NERRS, NOUT )
538                     GO TO 150
539                  END IF
540*
541                  IF( INFO.EQ.0 ) THEN
542                     IF( IFACT.GE.2 ) THEN
543*
544*                       Reconstruct matrix from factors and compute
545*                       residual.
546*
547                        CALL CHET01( UPLO, N, A, LDA, AFAC, LDA, IWORK,
548     $                               AINV, LDA, RWORK( 2*NRHS+1 ),
549     $                               RESULT( 1 ) )
550                        K1 = 1
551                     ELSE
552                        K1 = 2
553                     END IF
554*
555*                    Compute residual of the computed solution.
556*
557                     CALL CLACPY( 'Full', N, NRHS, B, LDA, WORK, LDA )
558                     CALL CPOT02( UPLO, N, NRHS, A, LDA, X, LDA, WORK,
559     $                            LDA, RWORK( 2*NRHS+1 ), RESULT( 2 ) )
560*
561*                    Check solution from generated exact solution.
562*
563                     CALL CGET04( N, NRHS, X, LDA, XACT, LDA, RCONDC,
564     $                            RESULT( 3 ) )
565*
566*                    Check the error bounds from iterative refinement.
567*
568                     CALL CPOT05( UPLO, N, NRHS, A, LDA, B, LDA, X, LDA,
569     $                            XACT, LDA, RWORK, RWORK( NRHS+1 ),
570     $                            RESULT( 4 ) )
571                  ELSE
572                     K1 = 6
573                  END IF
574*
575*                 Compare RCOND from CHESVX with the computed value
576*                 in RCONDC.
577*
578                  RESULT( 6 ) = SGET06( RCOND, RCONDC )
579*
580*                 Print information about the tests that did not pass
581*                 the threshold.
582*
583                  DO 140 K = K1, 6
584                     IF( RESULT( K ).GE.THRESH ) THEN
585                        IF( NFAIL.EQ.0 .AND. NERRS.EQ.0 )
586     $                     CALL ALADHD( NOUT, PATH )
587                        WRITE( NOUT, FMT = 9998 )'CHESVX', FACT, UPLO,
588     $                     N, IMAT, K, RESULT( K )
589                        NFAIL = NFAIL + 1
590                     END IF
591  140             CONTINUE
592                  NRUN = NRUN + 7 - K1
593*
594*                 --- Test CHESVXX ---
595*
596*                 Restore the matrices A and B.
597*
598                  IF( IFACT.EQ.2 )
599     $               CALL CLASET( UPLO, N, N, CMPLX( ZERO ),
600     $                 CMPLX( ZERO ), AFAC, LDA )
601                  CALL CLASET( 'Full', N, NRHS, CMPLX( ZERO ),
602     $                 CMPLX( ZERO ), X, LDA )
603*
604*                 Solve the system and compute the condition number
605*                 and error bounds using CHESVXX.
606*
607                  SRNAMT = 'CHESVXX'
608                  N_ERR_BNDS = 3
609                  EQUED = 'N'
610                  CALL CHESVXX( FACT, UPLO, N, NRHS, A, LDA, AFAC,
611     $                 LDA, IWORK, EQUED, WORK( N+1 ), B, LDA, X,
612     $                 LDA, RCOND, RPVGRW_SVXX, BERR, N_ERR_BNDS,
613     $                 ERRBNDS_N, ERRBNDS_C, 0, ZERO, WORK,
614     $                 RWORK(2*NRHS+1), INFO )
615*
616*                 Adjust the expected value of INFO to account for
617*                 pivoting.
618*
619                  K = IZERO
620                  IF( K.GT.0 ) THEN
621 135                 CONTINUE
622                     IF( IWORK( K ).LT.0 ) THEN
623                        IF( IWORK( K ).NE.-K ) THEN
624                           K = -IWORK( K )
625                           GO TO 135
626                        END IF
627                     ELSE IF( IWORK( K ).NE.K ) THEN
628                        K = IWORK( K )
629                        GO TO 135
630                     END IF
631                  END IF
632*
633*                 Check the error code from CHESVXX.
634*
635                  IF( INFO.NE.K .AND. INFO.LE.N ) THEN
636                     CALL ALAERH( PATH, 'CHESVXX', INFO, K,
637     $                    FACT // UPLO, N, N, -1, -1, NRHS, IMAT, NFAIL,
638     $                    NERRS, NOUT )
639                     GO TO 150
640                  END IF
641*
642                  IF( INFO.EQ.0 ) THEN
643                     IF( IFACT.GE.2 ) THEN
644*
645*                 Reconstruct matrix from factors and compute
646*                 residual.
647*
648                        CALL CHET01( UPLO, N, A, LDA, AFAC, LDA, IWORK,
649     $                       AINV, LDA, RWORK(2*NRHS+1),
650     $                       RESULT( 1 ) )
651                        K1 = 1
652                     ELSE
653                        K1 = 2
654                     END IF
655*
656*                 Compute residual of the computed solution.
657*
658                     CALL CLACPY( 'Full', N, NRHS, B, LDA, WORK, LDA )
659                     CALL CPOT02( UPLO, N, NRHS, A, LDA, X, LDA, WORK,
660     $                    LDA, RWORK( 2*NRHS+1 ), RESULT( 2 ) )
661                     RESULT( 2 ) = 0.0
662*
663*                 Check solution from generated exact solution.
664*
665                     CALL CGET04( N, NRHS, X, LDA, XACT, LDA, RCONDC,
666     $                    RESULT( 3 ) )
667*
668*                 Check the error bounds from iterative refinement.
669*
670                     CALL CPOT05( UPLO, N, NRHS, A, LDA, B, LDA, X, LDA,
671     $                    XACT, LDA, RWORK, RWORK( NRHS+1 ),
672     $                    RESULT( 4 ) )
673                  ELSE
674                     K1 = 6
675                  END IF
676*
677*                 Compare RCOND from CHESVXX with the computed value
678*                 in RCONDC.
679*
680                  RESULT( 6 ) = SGET06( RCOND, RCONDC )
681*
682*                 Print information about the tests that did not pass
683*                 the threshold.
684*
685                  DO 85 K = K1, 6
686                     IF( RESULT( K ).GE.THRESH ) THEN
687                        IF( NFAIL.EQ.0 .AND. NERRS.EQ.0 )
688     $                       CALL ALADHD( NOUT, PATH )
689                        WRITE( NOUT, FMT = 9998 )'CHESVXX',
690     $                       FACT, UPLO, N, IMAT, K,
691     $                       RESULT( K )
692                        NFAIL = NFAIL + 1
693                     END IF
694 85               CONTINUE
695                  NRUN = NRUN + 7 - K1
696*
697  150          CONTINUE
698*
699  160       CONTINUE
700  170    CONTINUE
701  180 CONTINUE
702*
703*     Print a summary of the results.
704*
705      CALL ALASVM( PATH, NOUT, NFAIL, NRUN, NERRS )
706*
707
708*     Test Error Bounds from CHESVXX
709
710      CALL CEBCHVXX(THRESH, PATH)
711
712 9999 FORMAT( 1X, A, ', UPLO=''', A1, ''', N =', I5, ', type ', I2,
713     $      ', test ', I2, ', ratio =', G12.5 )
714 9998 FORMAT( 1X, A, ', FACT=''', A1, ''', UPLO=''', A1, ''', N =', I5,
715     $      ', type ', I2, ', test ', I2, ', ratio =', G12.5 )
716      RETURN
717*
718*     End of CDRVHEX
719*
720      END
721