1*> \brief \b DCHKSY
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 DCHKSY( DOTYPE, NN, NVAL, NNB, NBVAL, NNS, NSVAL,
12*                          THRESH, TSTERR, NMAX, A, AFAC, AINV, B, X,
13*                          XACT, WORK, RWORK, IWORK, NOUT )
14*
15*       .. Scalar Arguments ..
16*       LOGICAL            TSTERR
17*       INTEGER            NMAX, NN, NNB, NNS, NOUT
18*       DOUBLE PRECISION   THRESH
19*       ..
20*       .. Array Arguments ..
21*       LOGICAL            DOTYPE( * )
22*       INTEGER            IWORK( * ), NBVAL( * ), NSVAL( * ), NVAL( * )
23*       DOUBLE PRECISION   A( * ), AFAC( * ), AINV( * ), B( * ),
24*      $                   RWORK( * ), WORK( * ), X( * ), XACT( * )
25*       ..
26*
27*
28*> \par Purpose:
29*  =============
30*>
31*> \verbatim
32*>
33*> DCHKSY tests DSYTRF, -TRI2, -TRS, -TRS2, -RFS, and -CON.
34*> \endverbatim
35*
36*  Arguments:
37*  ==========
38*
39*> \param[in] DOTYPE
40*> \verbatim
41*>          DOTYPE is LOGICAL array, dimension (NTYPES)
42*>          The matrix types to be used for testing.  Matrices of type j
43*>          (for 1 <= j <= NTYPES) are used for testing if DOTYPE(j) =
44*>          .TRUE.; if DOTYPE(j) = .FALSE., then type j is not used.
45*> \endverbatim
46*>
47*> \param[in] NN
48*> \verbatim
49*>          NN is INTEGER
50*>          The number of values of N contained in the vector NVAL.
51*> \endverbatim
52*>
53*> \param[in] NVAL
54*> \verbatim
55*>          NVAL is INTEGER array, dimension (NN)
56*>          The values of the matrix dimension N.
57*> \endverbatim
58*>
59*> \param[in] NNB
60*> \verbatim
61*>          NNB is INTEGER
62*>          The number of values of NB contained in the vector NBVAL.
63*> \endverbatim
64*>
65*> \param[in] NBVAL
66*> \verbatim
67*>          NBVAL is INTEGER array, dimension (NBVAL)
68*>          The values of the blocksize NB.
69*> \endverbatim
70*>
71*> \param[in] NNS
72*> \verbatim
73*>          NNS is INTEGER
74*>          The number of values of NRHS contained in the vector NSVAL.
75*> \endverbatim
76*>
77*> \param[in] NSVAL
78*> \verbatim
79*>          NSVAL is INTEGER array, dimension (NNS)
80*>          The values of the number of right hand sides NRHS.
81*> \endverbatim
82*>
83*> \param[in] THRESH
84*> \verbatim
85*>          THRESH is DOUBLE PRECISION
86*>          The threshold value for the test ratios.  A result is
87*>          included in the output file if RESULT >= THRESH.  To have
88*>          every test ratio printed, use THRESH = 0.
89*> \endverbatim
90*>
91*> \param[in] TSTERR
92*> \verbatim
93*>          TSTERR is LOGICAL
94*>          Flag that indicates whether error exits are to be tested.
95*> \endverbatim
96*>
97*> \param[in] NMAX
98*> \verbatim
99*>          NMAX is INTEGER
100*>          The maximum value permitted for N, used in dimensioning the
101*>          work arrays.
102*> \endverbatim
103*>
104*> \param[out] A
105*> \verbatim
106*>          A is DOUBLE PRECISION array, dimension (NMAX*NMAX)
107*> \endverbatim
108*>
109*> \param[out] AFAC
110*> \verbatim
111*>          AFAC is DOUBLE PRECISION array, dimension (NMAX*NMAX)
112*> \endverbatim
113*>
114*> \param[out] AINV
115*> \verbatim
116*>          AINV is DOUBLE PRECISION array, dimension (NMAX*NMAX)
117*> \endverbatim
118*>
119*> \param[out] B
120*> \verbatim
121*>          B is DOUBLE PRECISION array, dimension (NMAX*NSMAX)
122*>          where NSMAX is the largest entry in NSVAL.
123*> \endverbatim
124*>
125*> \param[out] X
126*> \verbatim
127*>          X is DOUBLE PRECISION array, dimension (NMAX*NSMAX)
128*> \endverbatim
129*>
130*> \param[out] XACT
131*> \verbatim
132*>          XACT is DOUBLE PRECISION array, dimension (NMAX*NSMAX)
133*> \endverbatim
134*>
135*> \param[out] WORK
136*> \verbatim
137*>          WORK is DOUBLE PRECISION array, dimension (NMAX*max(3,NSMAX))
138*> \endverbatim
139*>
140*> \param[out] RWORK
141*> \verbatim
142*>          RWORK is DOUBLE PRECISION array, dimension (max(NMAX,2*NSMAX))
143*> \endverbatim
144*>
145*> \param[out] IWORK
146*> \verbatim
147*>          IWORK is INTEGER array, dimension (2*NMAX)
148*> \endverbatim
149*>
150*> \param[in] NOUT
151*> \verbatim
152*>          NOUT is INTEGER
153*>          The unit number for output.
154*> \endverbatim
155*
156*  Authors:
157*  ========
158*
159*> \author Univ. of Tennessee
160*> \author Univ. of California Berkeley
161*> \author Univ. of Colorado Denver
162*> \author NAG Ltd.
163*
164*> \date November 2013
165*
166*> \ingroup double_lin
167*
168*  =====================================================================
169      SUBROUTINE DCHKSY( DOTYPE, NN, NVAL, NNB, NBVAL, NNS, NSVAL,
170     $                   THRESH, TSTERR, NMAX, A, AFAC, AINV, B, X,
171     $                   XACT, WORK, RWORK, IWORK, NOUT )
172*
173*  -- LAPACK test routine (version 3.5.0) --
174*  -- LAPACK is a software package provided by Univ. of Tennessee,    --
175*  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
176*     November 2013
177*
178*     .. Scalar Arguments ..
179      LOGICAL            TSTERR
180      INTEGER            NMAX, NN, NNB, NNS, NOUT
181      DOUBLE PRECISION   THRESH
182*     ..
183*     .. Array Arguments ..
184      LOGICAL            DOTYPE( * )
185      INTEGER            IWORK( * ), NBVAL( * ), NSVAL( * ), NVAL( * )
186      DOUBLE PRECISION   A( * ), AFAC( * ), AINV( * ), B( * ),
187     $                   RWORK( * ), WORK( * ), X( * ), XACT( * )
188*     ..
189*
190*  =====================================================================
191*
192*     .. Parameters ..
193      DOUBLE PRECISION   ZERO
194      PARAMETER          ( ZERO = 0.0D+0 )
195      INTEGER            NTYPES
196      PARAMETER          ( NTYPES = 10 )
197      INTEGER            NTESTS
198      PARAMETER          ( NTESTS = 9 )
199*     ..
200*     .. Local Scalars ..
201      LOGICAL            TRFCON, ZEROT
202      CHARACTER          DIST, TYPE, UPLO, XTYPE
203      CHARACTER*3        PATH
204      INTEGER            I, I1, I2, IMAT, IN, INB, INFO, IOFF, IRHS,
205     $                   IUPLO, IZERO, J, K, KL, KU, LDA, LWORK, MODE,
206     $                   N, NB, NERRS, NFAIL, NIMAT, NRHS, NRUN, NT
207      DOUBLE PRECISION   ANORM, CNDNUM, RCOND, RCONDC
208*     ..
209*     .. Local Arrays ..
210      CHARACTER          UPLOS( 2 )
211      INTEGER            ISEED( 4 ), ISEEDY( 4 )
212      DOUBLE PRECISION   RESULT( NTESTS )
213*     ..
214*     .. External Functions ..
215      DOUBLE PRECISION   DGET06, DLANSY
216      EXTERNAL           DGET06, DLANSY
217*     ..
218*     .. External Subroutines ..
219      EXTERNAL           ALAERH, ALAHD, ALASUM, DERRSY, DGET04, DLACPY,
220     $                   DLARHS, DLATB4, DLATMS, DPOT02, DPOT03, DPOT05,
221     $                   DSYCON, DSYRFS, DSYT01, DSYTRF,
222     $                   DSYTRI2, DSYTRS, DSYTRS2, XLAENV
223*     ..
224*     .. Intrinsic Functions ..
225      INTRINSIC          MAX, MIN
226*     ..
227*     .. Scalars in Common ..
228      LOGICAL            LERR, OK
229      CHARACTER*32       SRNAMT
230      INTEGER            INFOT, NUNIT
231*     ..
232*     .. Common blocks ..
233      COMMON             / INFOC / INFOT, NUNIT, OK, LERR
234      COMMON             / SRNAMC / SRNAMT
235*     ..
236*     .. Data statements ..
237      DATA               ISEEDY / 1988, 1989, 1990, 1991 /
238      DATA               UPLOS / 'U', 'L' /
239*     ..
240*     .. Executable Statements ..
241*
242*     Initialize constants and the random number seed.
243*
244      PATH( 1: 1 ) = 'Double precision'
245      PATH( 2: 3 ) = 'SY'
246      NRUN = 0
247      NFAIL = 0
248      NERRS = 0
249      DO 10 I = 1, 4
250         ISEED( I ) = ISEEDY( I )
251   10 CONTINUE
252*
253*     Test the error exits
254*
255      IF( TSTERR )
256     $   CALL DERRSY( PATH, NOUT )
257      INFOT = 0
258*
259*     Set the minimum block size for which the block routine should
260*     be used, which will be later returned by ILAENV
261*
262      CALL XLAENV( 2, 2 )
263*
264*     Do for each value of N in NVAL
265*
266      DO 180 IN = 1, NN
267         N = NVAL( IN )
268         LDA = MAX( N, 1 )
269         XTYPE = 'N'
270         NIMAT = NTYPES
271         IF( N.LE.0 )
272     $      NIMAT = 1
273*
274         IZERO = 0
275*
276*        Do for each value of matrix type IMAT
277*
278         DO 170 IMAT = 1, NIMAT
279*
280*           Do the tests only if DOTYPE( IMAT ) is true.
281*
282            IF( .NOT.DOTYPE( IMAT ) )
283     $         GO TO 170
284*
285*           Skip types 3, 4, 5, or 6 if the matrix size is too small.
286*
287            ZEROT = IMAT.GE.3 .AND. IMAT.LE.6
288            IF( ZEROT .AND. N.LT.IMAT-2 )
289     $         GO TO 170
290*
291*           Do first for UPLO = 'U', then for UPLO = 'L'
292*
293            DO 160 IUPLO = 1, 2
294               UPLO = UPLOS( IUPLO )
295*
296*              Begin generate the test matrix A.
297*
298*
299*              Set up parameters with DLATB4 for the matrix generator
300*              based on the type of matrix to be generated.
301*
302               CALL DLATB4( PATH, IMAT, N, N, TYPE, KL, KU, ANORM, MODE,
303     $                      CNDNUM, DIST )
304*
305*              Generate a matrix with DLATMS.
306*
307               SRNAMT = 'DLATMS'
308               CALL DLATMS( N, N, DIST, ISEED, TYPE, RWORK, MODE,
309     $                      CNDNUM, ANORM, KL, KU, UPLO, A, LDA, WORK,
310     $                      INFO )
311*
312*              Check error code from DLATMS and handle error.
313*
314               IF( INFO.NE.0 ) THEN
315                  CALL ALAERH( PATH, 'DLATMS', INFO, 0, UPLO, N, N, -1,
316     $                         -1, -1, IMAT, NFAIL, NERRS, NOUT )
317*
318*                    Skip all tests for this generated matrix
319*
320                  GO TO 160
321               END IF
322*
323*              For matrix types 3-6, zero one or more rows and
324*              columns of the matrix to test that INFO is returned
325*              correctly.
326*
327               IF( ZEROT ) THEN
328                  IF( IMAT.EQ.3 ) THEN
329                     IZERO = 1
330                  ELSE IF( IMAT.EQ.4 ) THEN
331                     IZERO = N
332                  ELSE
333                     IZERO = N / 2 + 1
334                  END IF
335*
336                  IF( IMAT.LT.6 ) THEN
337*
338*                    Set row and column IZERO to zero.
339*
340                     IF( IUPLO.EQ.1 ) THEN
341                        IOFF = ( IZERO-1 )*LDA
342                        DO 20 I = 1, IZERO - 1
343                           A( IOFF+I ) = ZERO
344   20                   CONTINUE
345                        IOFF = IOFF + IZERO
346                        DO 30 I = IZERO, N
347                           A( IOFF ) = ZERO
348                           IOFF = IOFF + LDA
349   30                   CONTINUE
350                     ELSE
351                        IOFF = IZERO
352                        DO 40 I = 1, IZERO - 1
353                           A( IOFF ) = ZERO
354                           IOFF = IOFF + LDA
355   40                   CONTINUE
356                        IOFF = IOFF - IZERO
357                        DO 50 I = IZERO, N
358                           A( IOFF+I ) = ZERO
359   50                   CONTINUE
360                     END IF
361                  ELSE
362                     IF( IUPLO.EQ.1 ) THEN
363*
364*                       Set the first IZERO rows and columns to zero.
365*
366                        IOFF = 0
367                        DO 70 J = 1, N
368                           I2 = MIN( J, IZERO )
369                           DO 60 I = 1, I2
370                              A( IOFF+I ) = ZERO
371   60                      CONTINUE
372                           IOFF = IOFF + LDA
373   70                   CONTINUE
374                     ELSE
375*
376*                       Set the last IZERO rows and columns to zero.
377*
378                        IOFF = 0
379                        DO 90 J = 1, N
380                           I1 = MAX( J, IZERO )
381                           DO 80 I = I1, N
382                              A( IOFF+I ) = ZERO
383   80                      CONTINUE
384                           IOFF = IOFF + LDA
385   90                   CONTINUE
386                     END IF
387                  END IF
388               ELSE
389                  IZERO = 0
390               END IF
391*
392*              End generate the test matrix A.
393*
394*              Do for each value of NB in NBVAL
395*
396               DO 150 INB = 1, NNB
397*
398*                 Set the optimal blocksize, which will be later
399*                 returned by ILAENV.
400*
401                  NB = NBVAL( INB )
402                  CALL XLAENV( 1, NB )
403*
404*                 Copy the test matrix A into matrix AFAC which
405*                 will be factorized in place. This is needed to
406*                 preserve the test matrix A for subsequent tests.
407*
408                  CALL DLACPY( UPLO, N, N, A, LDA, AFAC, LDA )
409*
410*                 Compute the L*D*L**T or U*D*U**T factorization of the
411*                 matrix. IWORK stores details of the interchanges and
412*                 the block structure of D. AINV is a work array for
413*                 block factorization, LWORK is the length of AINV.
414*
415                  LWORK = MAX( 2, NB )*LDA
416                  SRNAMT = 'DSYTRF'
417                  CALL DSYTRF( UPLO, N, AFAC, LDA, IWORK, AINV, LWORK,
418     $                         INFO )
419*
420*                 Adjust the expected value of INFO to account for
421*                 pivoting.
422*
423                  K = IZERO
424                  IF( K.GT.0 ) THEN
425  100                CONTINUE
426                     IF( IWORK( K ).LT.0 ) THEN
427                        IF( IWORK( K ).NE.-K ) THEN
428                           K = -IWORK( K )
429                           GO TO 100
430                        END IF
431                     ELSE IF( IWORK( K ).NE.K ) THEN
432                        K = IWORK( K )
433                        GO TO 100
434                     END IF
435                  END IF
436*
437*                 Check error code from DSYTRF and handle error.
438*
439                  IF( INFO.NE.K )
440     $               CALL ALAERH( PATH, 'DSYTRF', INFO, K, UPLO, N, N,
441     $                            -1, -1, NB, IMAT, NFAIL, NERRS, NOUT )
442*
443*                 Set the condition estimate flag if the INFO is not 0.
444*
445                  IF( INFO.NE.0 ) THEN
446                     TRFCON = .TRUE.
447                  ELSE
448                     TRFCON = .FALSE.
449                  END IF
450*
451*+    TEST 1
452*                 Reconstruct matrix from factors and compute residual.
453*
454                  CALL DSYT01( UPLO, N, A, LDA, AFAC, LDA, IWORK, AINV,
455     $                         LDA, RWORK, RESULT( 1 ) )
456                  NT = 1
457*
458*+    TEST 2
459*                 Form the inverse and compute the residual,
460*                 if the factorization was competed without INFO > 0
461*                 (i.e. there is no zero rows and columns).
462*                 Do it only for the first block size.
463*
464                  IF( INB.EQ.1 .AND. .NOT.TRFCON ) THEN
465                     CALL DLACPY( UPLO, N, N, AFAC, LDA, AINV, LDA )
466                     SRNAMT = 'DSYTRI2'
467                     LWORK = (N+NB+1)*(NB+3)
468                     CALL DSYTRI2( UPLO, N, AINV, LDA, IWORK, WORK,
469     $                            LWORK, INFO )
470*
471*                    Check error code from DSYTRI2 and handle error.
472*
473                     IF( INFO.NE.0 )
474     $                  CALL ALAERH( PATH, 'DSYTRI2', INFO, -1, UPLO, N,
475     $                               N, -1, -1, -1, IMAT, NFAIL, NERRS,
476     $                               NOUT )
477*
478*                    Compute the residual for a symmetric matrix times
479*                    its inverse.
480*
481                     CALL DPOT03( UPLO, N, A, LDA, AINV, LDA, WORK, LDA,
482     $                            RWORK, RCONDC, RESULT( 2 ) )
483                     NT = 2
484                  END IF
485*
486*                 Print information about the tests that did not pass
487*                 the threshold.
488*
489                  DO 110 K = 1, NT
490                     IF( RESULT( K ).GE.THRESH ) THEN
491                        IF( NFAIL.EQ.0 .AND. NERRS.EQ.0 )
492     $                     CALL ALAHD( NOUT, PATH )
493                        WRITE( NOUT, FMT = 9999 )UPLO, N, NB, IMAT, K,
494     $                     RESULT( K )
495                        NFAIL = NFAIL + 1
496                     END IF
497  110             CONTINUE
498                  NRUN = NRUN + NT
499*
500*                 Skip the other tests if this is not the first block
501*                 size.
502*
503                  IF( INB.GT.1 )
504     $               GO TO 150
505*
506*                 Do only the condition estimate if INFO is not 0.
507*
508                  IF( TRFCON ) THEN
509                     RCONDC = ZERO
510                     GO TO 140
511                  END IF
512*
513*                 Do for each value of NRHS in NSVAL.
514*
515                  DO 130 IRHS = 1, NNS
516                     NRHS = NSVAL( IRHS )
517*
518*+    TEST 3 ( Using TRS)
519*                 Solve and compute residual for  A * X = B.
520*
521*                    Choose a set of NRHS random solution vectors
522*                    stored in XACT and set up the right hand side B
523*
524                     SRNAMT = 'DLARHS'
525                     CALL DLARHS( PATH, XTYPE, UPLO, ' ', N, N, KL, KU,
526     $                            NRHS, A, LDA, XACT, LDA, B, LDA,
527     $                            ISEED, INFO )
528                     CALL DLACPY( 'Full', N, NRHS, B, LDA, X, LDA )
529*
530                     SRNAMT = 'DSYTRS'
531                     CALL DSYTRS( UPLO, N, NRHS, AFAC, LDA, IWORK, X,
532     $                            LDA, INFO )
533*
534*                    Check error code from DSYTRS and handle error.
535*
536                     IF( INFO.NE.0 )
537     $                  CALL ALAERH( PATH, 'DSYTRS', INFO, 0, UPLO, N,
538     $                               N, -1, -1, NRHS, IMAT, NFAIL,
539     $                               NERRS, NOUT )
540*
541                     CALL DLACPY( 'Full', N, NRHS, B, LDA, WORK, LDA )
542*
543*                    Compute the residual for the solution
544*
545                     CALL DPOT02( UPLO, N, NRHS, A, LDA, X, LDA, WORK,
546     $                            LDA, RWORK, RESULT( 3 ) )
547*
548*+    TEST 4 (Using TRS2)
549*
550*                 Solve and compute residual for  A * X = B.
551*
552*                    Choose a set of NRHS random solution vectors
553*                    stored in XACT and set up the right hand side B
554*
555                     SRNAMT = 'DLARHS'
556                     CALL DLARHS( PATH, XTYPE, UPLO, ' ', N, N, KL, KU,
557     $                            NRHS, A, LDA, XACT, LDA, B, LDA,
558     $                            ISEED, INFO )
559                     CALL DLACPY( 'Full', N, NRHS, B, LDA, X, LDA )
560*
561                     SRNAMT = 'DSYTRS2'
562                     CALL DSYTRS2( UPLO, N, NRHS, AFAC, LDA, IWORK, X,
563     $                            LDA, WORK, INFO )
564*
565*                    Check error code from DSYTRS2 and handle error.
566*
567                     IF( INFO.NE.0 )
568     $                  CALL ALAERH( PATH, 'DSYTRS2', INFO, 0, UPLO, N,
569     $                               N, -1, -1, NRHS, IMAT, NFAIL,
570     $                               NERRS, NOUT )
571*
572                     CALL DLACPY( 'Full', N, NRHS, B, LDA, WORK, LDA )
573*
574*                    Compute the residual for the solution
575*
576                     CALL DPOT02( UPLO, N, NRHS, A, LDA, X, LDA, WORK,
577     $                            LDA, RWORK, RESULT( 4 ) )
578*
579*+    TEST 5
580*                 Check solution from generated exact solution.
581*
582                     CALL DGET04( N, NRHS, X, LDA, XACT, LDA, RCONDC,
583     $                            RESULT( 5 ) )
584*
585*+    TESTS 6, 7, and 8
586*                 Use iterative refinement to improve the solution.
587*
588                     SRNAMT = 'DSYRFS'
589                     CALL DSYRFS( UPLO, N, NRHS, A, LDA, AFAC, LDA,
590     $                            IWORK, B, LDA, X, LDA, RWORK,
591     $                            RWORK( NRHS+1 ), WORK, IWORK( N+1 ),
592     $                            INFO )
593*
594*                    Check error code from DSYRFS and handle error.
595*
596                     IF( INFO.NE.0 )
597     $                  CALL ALAERH( PATH, 'DSYRFS', INFO, 0, UPLO, N,
598     $                               N, -1, -1, NRHS, IMAT, NFAIL,
599     $                               NERRS, NOUT )
600*
601                     CALL DGET04( N, NRHS, X, LDA, XACT, LDA, RCONDC,
602     $                            RESULT( 6 ) )
603                     CALL DPOT05( UPLO, N, NRHS, A, LDA, B, LDA, X, LDA,
604     $                            XACT, LDA, RWORK, RWORK( NRHS+1 ),
605     $                            RESULT( 7 ) )
606*
607*                    Print information about the tests that did not pass
608*                    the threshold.
609*
610                     DO 120 K = 3, 8
611                        IF( RESULT( K ).GE.THRESH ) THEN
612                           IF( NFAIL.EQ.0 .AND. NERRS.EQ.0 )
613     $                        CALL ALAHD( NOUT, PATH )
614                           WRITE( NOUT, FMT = 9998 )UPLO, N, NRHS,
615     $                        IMAT, K, RESULT( K )
616                           NFAIL = NFAIL + 1
617                        END IF
618  120                CONTINUE
619                     NRUN = NRUN + 6
620*
621*                 End do for each value of NRHS in NSVAL.
622*
623  130             CONTINUE
624*
625*+    TEST 9
626*                 Get an estimate of RCOND = 1/CNDNUM.
627*
628  140             CONTINUE
629                  ANORM = DLANSY( '1', UPLO, N, A, LDA, RWORK )
630                  SRNAMT = 'DSYCON'
631                  CALL DSYCON( UPLO, N, AFAC, LDA, IWORK, ANORM, RCOND,
632     $                         WORK, IWORK( N+1 ), INFO )
633*
634*                 Check error code from DSYCON and handle error.
635*
636                  IF( INFO.NE.0 )
637     $               CALL ALAERH( PATH, 'DSYCON', INFO, 0, UPLO, N, N,
638     $                            -1, -1, -1, IMAT, NFAIL, NERRS, NOUT )
639*
640*                 Compute the test ratio to compare values of RCOND
641*
642                  RESULT( 9 ) = DGET06( RCOND, RCONDC )
643*
644*                 Print information about the tests that did not pass
645*                 the threshold.
646*
647                  IF( RESULT( 9 ).GE.THRESH ) THEN
648                     IF( NFAIL.EQ.0 .AND. NERRS.EQ.0 )
649     $                  CALL ALAHD( NOUT, PATH )
650                     WRITE( NOUT, FMT = 9997 )UPLO, N, IMAT, 9,
651     $                  RESULT( 9 )
652                     NFAIL = NFAIL + 1
653                  END IF
654                  NRUN = NRUN + 1
655  150          CONTINUE
656*
657  160       CONTINUE
658  170    CONTINUE
659  180 CONTINUE
660*
661*     Print a summary of the results.
662*
663      CALL ALASUM( PATH, NOUT, NFAIL, NRUN, NERRS )
664*
665 9999 FORMAT( ' UPLO = ''', A1, ''', N =', I5, ', NB =', I4, ', type ',
666     $      I2, ', test ', I2, ', ratio =', G12.5 )
667 9998 FORMAT( ' UPLO = ''', A1, ''', N =', I5, ', NRHS=', I3, ', type ',
668     $      I2, ', test(', I2, ') =', G12.5 )
669 9997 FORMAT( ' UPLO = ''', A1, ''', N =', I5, ',', 10X, ' type ', I2,
670     $      ', test(', I2, ') =', G12.5 )
671      RETURN
672*
673*     End of DCHKSY
674*
675      END
676