kusano 2b45e8
      PROGRAM ZBLAT2
kusano 2b45e8
*
kusano 2b45e8
*  Test program for the COMPLEX*16       Level 2 Blas.
kusano 2b45e8
*
kusano 2b45e8
*  The program must be driven by a short data file. The first 18 records
kusano 2b45e8
*  of the file are read using list-directed input, the last 17 records
kusano 2b45e8
*  are read using the format ( A6, L2 ). An annotated example of a data
kusano 2b45e8
*  file can be obtained by deleting the first 3 characters from the
kusano 2b45e8
*  following 35 lines:
kusano 2b45e8
*  'ZBLAT2.SUMM'     NAME OF SUMMARY OUTPUT FILE
kusano 2b45e8
*  6                 UNIT NUMBER OF SUMMARY FILE
kusano 2b45e8
*  'CBLA2T.SNAP'     NAME OF SNAPSHOT OUTPUT FILE
kusano 2b45e8
*  -1                UNIT NUMBER OF SNAPSHOT FILE (NOT USED IF .LT. 0)
kusano 2b45e8
*  F        LOGICAL FLAG, T TO REWIND SNAPSHOT FILE AFTER EACH RECORD.
kusano 2b45e8
*  F        LOGICAL FLAG, T TO STOP ON FAILURES.
kusano 2b45e8
*  T        LOGICAL FLAG, T TO TEST ERROR EXITS.
kusano 2b45e8
*  16.0     THRESHOLD VALUE OF TEST RATIO
kusano 2b45e8
*  6                 NUMBER OF VALUES OF N
kusano 2b45e8
*  0 1 2 3 5 9       VALUES OF N
kusano 2b45e8
*  4                 NUMBER OF VALUES OF K
kusano 2b45e8
*  0 1 2 4           VALUES OF K
kusano 2b45e8
*  4                 NUMBER OF VALUES OF INCX AND INCY
kusano 2b45e8
*  1 2 -1 -2         VALUES OF INCX AND INCY
kusano 2b45e8
*  3                 NUMBER OF VALUES OF ALPHA
kusano 2b45e8
*  (0.0,0.0) (1.0,0.0) (0.7,-0.9)       VALUES OF ALPHA
kusano 2b45e8
*  3                 NUMBER OF VALUES OF BETA
kusano 2b45e8
*  (0.0,0.0) (1.0,0.0) (1.3,-1.1)       VALUES OF BETA
kusano 2b45e8
*  ZGEMV  T PUT F FOR NO TEST. SAME COLUMNS.
kusano 2b45e8
*  ZGBMV  T PUT F FOR NO TEST. SAME COLUMNS.
kusano 2b45e8
*  ZHEMV  T PUT F FOR NO TEST. SAME COLUMNS.
kusano 2b45e8
*  ZHBMV  T PUT F FOR NO TEST. SAME COLUMNS.
kusano 2b45e8
*  ZHPMV  T PUT F FOR NO TEST. SAME COLUMNS.
kusano 2b45e8
*  ZTRMV  T PUT F FOR NO TEST. SAME COLUMNS.
kusano 2b45e8
*  ZTBMV  T PUT F FOR NO TEST. SAME COLUMNS.
kusano 2b45e8
*  ZTPMV  T PUT F FOR NO TEST. SAME COLUMNS.
kusano 2b45e8
*  ZTRSV  T PUT F FOR NO TEST. SAME COLUMNS.
kusano 2b45e8
*  ZTBSV  T PUT F FOR NO TEST. SAME COLUMNS.
kusano 2b45e8
*  ZTPSV  T PUT F FOR NO TEST. SAME COLUMNS.
kusano 2b45e8
*  ZGERC  T PUT F FOR NO TEST. SAME COLUMNS.
kusano 2b45e8
*  ZGERU  T PUT F FOR NO TEST. SAME COLUMNS.
kusano 2b45e8
*  ZHER   T PUT F FOR NO TEST. SAME COLUMNS.
kusano 2b45e8
*  ZHPR   T PUT F FOR NO TEST. SAME COLUMNS.
kusano 2b45e8
*  ZHER2  T PUT F FOR NO TEST. SAME COLUMNS.
kusano 2b45e8
*  ZHPR2  T PUT F FOR NO TEST. SAME COLUMNS.
kusano 2b45e8
*
kusano 2b45e8
*     See:
kusano 2b45e8
*
kusano 2b45e8
*        Dongarra J. J., Du Croz J. J., Hammarling S.  and Hanson R. J..
kusano 2b45e8
*        An  extended  set of Fortran  Basic Linear Algebra Subprograms.
kusano 2b45e8
*
kusano 2b45e8
*        Technical  Memoranda  Nos. 41 (revision 3) and 81,  Mathematics
kusano 2b45e8
*        and  Computer Science  Division,  Argonne  National Laboratory,
kusano 2b45e8
*        9700 South Cass Avenue, Argonne, Illinois 60439, US.
kusano 2b45e8
*
kusano 2b45e8
*        Or
kusano 2b45e8
*
kusano 2b45e8
*        NAG  Technical Reports TR3/87 and TR4/87,  Numerical Algorithms
kusano 2b45e8
*        Group  Ltd.,  NAG  Central  Office,  256  Banbury  Road, Oxford
kusano 2b45e8
*        OX2 7DE, UK,  and  Numerical Algorithms Group Inc.,  1101  31st
kusano 2b45e8
*        Street,  Suite 100,  Downers Grove,  Illinois 60515-1263,  USA.
kusano 2b45e8
*
kusano 2b45e8
*
kusano 2b45e8
*  -- Written on 10-August-1987.
kusano 2b45e8
*     Richard Hanson, Sandia National Labs.
kusano 2b45e8
*     Jeremy Du Croz, NAG Central Office.
kusano 2b45e8
*
kusano 2b45e8
*     .. Parameters ..
kusano 2b45e8
      INTEGER            NIN
kusano 2b45e8
      PARAMETER          ( NIN = 5 )
kusano 2b45e8
      INTEGER            NSUBS
kusano 2b45e8
      PARAMETER          ( NSUBS = 17 )
kusano 2b45e8
      COMPLEX*16         ZERO, ONE
kusano 2b45e8
      PARAMETER          ( ZERO = ( 0.0D0, 0.0D0 ),
kusano 2b45e8
     $                   ONE = ( 1.0D0, 0.0D0 ) )
kusano 2b45e8
      DOUBLE PRECISION   RZERO, RHALF, RONE
kusano 2b45e8
      PARAMETER          ( RZERO = 0.0D0, RHALF = 0.5D0, RONE = 1.0D0 )
kusano 2b45e8
      INTEGER            NMAX, INCMAX
kusano 2b45e8
      PARAMETER          ( NMAX = 65, INCMAX = 2 )
kusano 2b45e8
      INTEGER            NINMAX, NIDMAX, NKBMAX, NALMAX, NBEMAX
kusano 2b45e8
      PARAMETER          ( NINMAX = 7, NIDMAX = 9, NKBMAX = 7,
kusano 2b45e8
     $                   NALMAX = 7, NBEMAX = 7 )
kusano 2b45e8
*     .. Local Scalars ..
kusano 2b45e8
      DOUBLE PRECISION   EPS, ERR, THRESH
kusano 2b45e8
      INTEGER            I, ISNUM, J, N, NALF, NBET, NIDIM, NINC, NKB,
kusano 2b45e8
     $                   NOUT, NTRA
kusano 2b45e8
      LOGICAL            FATAL, LTESTT, REWI, SAME, SFATAL, TRACE,
kusano 2b45e8
     $                   TSTERR
kusano 2b45e8
      CHARACTER*1        TRANS
kusano 2b45e8
      CHARACTER*6        SNAMET
kusano 2b45e8
      CHARACTER*32       SNAPS, SUMMRY
kusano 2b45e8
*     .. Local Arrays ..
kusano 2b45e8
      COMPLEX*16         A( NMAX, NMAX ), AA( NMAX*NMAX ),
kusano 2b45e8
     $                   ALF( NALMAX ), AS( NMAX*NMAX ), BET( NBEMAX ),
kusano 2b45e8
     $                   X( NMAX ), XS( NMAX*INCMAX ),
kusano 2b45e8
     $                   XX( NMAX*INCMAX ), Y( NMAX ),
kusano 2b45e8
     $                   YS( NMAX*INCMAX ), YT( NMAX ),
kusano 2b45e8
     $                   YY( NMAX*INCMAX ), Z( 2*NMAX )
kusano 2b45e8
      DOUBLE PRECISION   G( NMAX )
kusano 2b45e8
      INTEGER            IDIM( NIDMAX ), INC( NINMAX ), KB( NKBMAX )
kusano 2b45e8
      LOGICAL            LTEST( NSUBS )
kusano 2b45e8
      CHARACTER*6        SNAMES( NSUBS )
kusano 2b45e8
*     .. External Functions ..
kusano 2b45e8
      DOUBLE PRECISION   DDIFF
kusano 2b45e8
      LOGICAL            LZE
kusano 2b45e8
      EXTERNAL           DDIFF, LZE
kusano 2b45e8
*     .. External Subroutines ..
kusano 2b45e8
      EXTERNAL           ZCHK1, ZCHK2, ZCHK3, ZCHK4, ZCHK5, ZCHK6,
kusano 2b45e8
     $                   ZCHKE, ZMVCH
kusano 2b45e8
*     .. Intrinsic Functions ..
kusano 2b45e8
      INTRINSIC          ABS, MAX, MIN
kusano 2b45e8
*     .. Scalars in Common ..
kusano 2b45e8
      INTEGER            INFOT, NOUTC
kusano 2b45e8
      LOGICAL            LERR, OK
kusano 2b45e8
      CHARACTER*6        SRNAMT
kusano 2b45e8
*     .. Common blocks ..
kusano 2b45e8
      COMMON             /INFOC/INFOT, NOUTC, OK, LERR
kusano 2b45e8
      COMMON             /SRNAMC/SRNAMT
kusano 2b45e8
*     .. Data statements ..
kusano 2b45e8
      DATA               SNAMES/'ZGEMV ', 'ZGBMV ', 'ZHEMV ', 'ZHBMV ',
kusano 2b45e8
     $                   'ZHPMV ', 'ZTRMV ', 'ZTBMV ', 'ZTPMV ',
kusano 2b45e8
     $                   'ZTRSV ', 'ZTBSV ', 'ZTPSV ', 'ZGERC ',
kusano 2b45e8
     $                   'ZGERU ', 'ZHER  ', 'ZHPR  ', 'ZHER2 ',
kusano 2b45e8
     $                   'ZHPR2 '/
kusano 2b45e8
*     .. Executable Statements ..
kusano 2b45e8
*
kusano 2b45e8
*     Read name and unit number for summary output file and open file.
kusano 2b45e8
*
kusano 2b45e8
      READ( NIN, FMT = * )SUMMRY
kusano 2b45e8
      READ( NIN, FMT = * )NOUT
kusano 2b45e8
      OPEN( NOUT, FILE = SUMMRY, STATUS = 'NEW' )
kusano 2b45e8
      NOUTC = NOUT
kusano 2b45e8
*
kusano 2b45e8
*     Read name and unit number for snapshot output file and open file.
kusano 2b45e8
*
kusano 2b45e8
      READ( NIN, FMT = * )SNAPS
kusano 2b45e8
      READ( NIN, FMT = * )NTRA
kusano 2b45e8
      TRACE = NTRA.GE.0
kusano 2b45e8
      IF( TRACE )THEN
kusano 2b45e8
         OPEN( NTRA, FILE = SNAPS, STATUS = 'NEW' )
kusano 2b45e8
      END IF
kusano 2b45e8
*     Read the flag that directs rewinding of the snapshot file.
kusano 2b45e8
      READ( NIN, FMT = * )REWI
kusano 2b45e8
      REWI = REWI.AND.TRACE
kusano 2b45e8
*     Read the flag that directs stopping on any failure.
kusano 2b45e8
      READ( NIN, FMT = * )SFATAL
kusano 2b45e8
*     Read the flag that indicates whether error exits are to be tested.
kusano 2b45e8
      READ( NIN, FMT = * )TSTERR
kusano 2b45e8
*     Read the threshold value of the test ratio
kusano 2b45e8
      READ( NIN, FMT = * )THRESH
kusano 2b45e8
*
kusano 2b45e8
*     Read and check the parameter values for the tests.
kusano 2b45e8
*
kusano 2b45e8
*     Values of N
kusano 2b45e8
      READ( NIN, FMT = * )NIDIM
kusano 2b45e8
      IF( NIDIM.LT.1.OR.NIDIM.GT.NIDMAX )THEN
kusano 2b45e8
         WRITE( NOUT, FMT = 9997 )'N', NIDMAX
kusano 2b45e8
         GO TO 230
kusano 2b45e8
      END IF
kusano 2b45e8
      READ( NIN, FMT = * )( IDIM( I ), I = 1, NIDIM )
kusano 2b45e8
      DO 10 I = 1, NIDIM
kusano 2b45e8
         IF( IDIM( I ).LT.0.OR.IDIM( I ).GT.NMAX )THEN
kusano 2b45e8
            WRITE( NOUT, FMT = 9996 )NMAX
kusano 2b45e8
            GO TO 230
kusano 2b45e8
         END IF
kusano 2b45e8
   10 CONTINUE
kusano 2b45e8
*     Values of K
kusano 2b45e8
      READ( NIN, FMT = * )NKB
kusano 2b45e8
      IF( NKB.LT.1.OR.NKB.GT.NKBMAX )THEN
kusano 2b45e8
         WRITE( NOUT, FMT = 9997 )'K', NKBMAX
kusano 2b45e8
         GO TO 230
kusano 2b45e8
      END IF
kusano 2b45e8
      READ( NIN, FMT = * )( KB( I ), I = 1, NKB )
kusano 2b45e8
      DO 20 I = 1, NKB
kusano 2b45e8
         IF( KB( I ).LT.0 )THEN
kusano 2b45e8
            WRITE( NOUT, FMT = 9995 )
kusano 2b45e8
            GO TO 230
kusano 2b45e8
         END IF
kusano 2b45e8
   20 CONTINUE
kusano 2b45e8
*     Values of INCX and INCY
kusano 2b45e8
      READ( NIN, FMT = * )NINC
kusano 2b45e8
      IF( NINC.LT.1.OR.NINC.GT.NINMAX )THEN
kusano 2b45e8
         WRITE( NOUT, FMT = 9997 )'INCX AND INCY', NINMAX
kusano 2b45e8
         GO TO 230
kusano 2b45e8
      END IF
kusano 2b45e8
      READ( NIN, FMT = * )( INC( I ), I = 1, NINC )
kusano 2b45e8
      DO 30 I = 1, NINC
kusano 2b45e8
         IF( INC( I ).EQ.0.OR.ABS( INC( I ) ).GT.INCMAX )THEN
kusano 2b45e8
            WRITE( NOUT, FMT = 9994 )INCMAX
kusano 2b45e8
            GO TO 230
kusano 2b45e8
         END IF
kusano 2b45e8
   30 CONTINUE
kusano 2b45e8
*     Values of ALPHA
kusano 2b45e8
      READ( NIN, FMT = * )NALF
kusano 2b45e8
      IF( NALF.LT.1.OR.NALF.GT.NALMAX )THEN
kusano 2b45e8
         WRITE( NOUT, FMT = 9997 )'ALPHA', NALMAX
kusano 2b45e8
         GO TO 230
kusano 2b45e8
      END IF
kusano 2b45e8
      READ( NIN, FMT = * )( ALF( I ), I = 1, NALF )
kusano 2b45e8
*     Values of BETA
kusano 2b45e8
      READ( NIN, FMT = * )NBET
kusano 2b45e8
      IF( NBET.LT.1.OR.NBET.GT.NBEMAX )THEN
kusano 2b45e8
         WRITE( NOUT, FMT = 9997 )'BETA', NBEMAX
kusano 2b45e8
         GO TO 230
kusano 2b45e8
      END IF
kusano 2b45e8
      READ( NIN, FMT = * )( BET( I ), I = 1, NBET )
kusano 2b45e8
*
kusano 2b45e8
*     Report values of parameters.
kusano 2b45e8
*
kusano 2b45e8
      WRITE( NOUT, FMT = 9993 )
kusano 2b45e8
      WRITE( NOUT, FMT = 9992 )( IDIM( I ), I = 1, NIDIM )
kusano 2b45e8
      WRITE( NOUT, FMT = 9991 )( KB( I ), I = 1, NKB )
kusano 2b45e8
      WRITE( NOUT, FMT = 9990 )( INC( I ), I = 1, NINC )
kusano 2b45e8
      WRITE( NOUT, FMT = 9989 )( ALF( I ), I = 1, NALF )
kusano 2b45e8
      WRITE( NOUT, FMT = 9988 )( BET( I ), I = 1, NBET )
kusano 2b45e8
      IF( .NOT.TSTERR )THEN
kusano 2b45e8
         WRITE( NOUT, FMT = * )
kusano 2b45e8
         WRITE( NOUT, FMT = 9980 )
kusano 2b45e8
      END IF
kusano 2b45e8
      WRITE( NOUT, FMT = * )
kusano 2b45e8
      WRITE( NOUT, FMT = 9999 )THRESH
kusano 2b45e8
      WRITE( NOUT, FMT = * )
kusano 2b45e8
*
kusano 2b45e8
*     Read names of subroutines and flags which indicate
kusano 2b45e8
*     whether they are to be tested.
kusano 2b45e8
*
kusano 2b45e8
      DO 40 I = 1, NSUBS
kusano 2b45e8
         LTEST( I ) = .FALSE.
kusano 2b45e8
   40 CONTINUE
kusano 2b45e8
   50 READ( NIN, FMT = 9984, END = 80 )SNAMET, LTESTT
kusano 2b45e8
      DO 60 I = 1, NSUBS
kusano 2b45e8
         IF( SNAMET.EQ.SNAMES( I ) )
kusano 2b45e8
     $      GO TO 70
kusano 2b45e8
   60 CONTINUE
kusano 2b45e8
      WRITE( NOUT, FMT = 9986 )SNAMET
kusano 2b45e8
      STOP
kusano 2b45e8
   70 LTEST( I ) = LTESTT
kusano 2b45e8
      GO TO 50
kusano 2b45e8
*
kusano 2b45e8
   80 CONTINUE
kusano 2b45e8
      CLOSE ( NIN )
kusano 2b45e8
*
kusano 2b45e8
*     Compute EPS (the machine precision).
kusano 2b45e8
*
kusano 2b45e8
      EPS = RONE
kusano 2b45e8
   90 CONTINUE
kusano 2b45e8
      IF( DDIFF( RONE + EPS, RONE ).EQ.RZERO )
kusano 2b45e8
     $   GO TO 100
kusano 2b45e8
      EPS = RHALF*EPS
kusano 2b45e8
      GO TO 90
kusano 2b45e8
  100 CONTINUE
kusano 2b45e8
      EPS = EPS + EPS
kusano 2b45e8
      WRITE( NOUT, FMT = 9998 )EPS
kusano 2b45e8
*
kusano 2b45e8
*     Check the reliability of ZMVCH using exact data.
kusano 2b45e8
*
kusano 2b45e8
      N = MIN( 32, NMAX )
kusano 2b45e8
      DO 120 J = 1, N
kusano 2b45e8
         DO 110 I = 1, N
kusano 2b45e8
            A( I, J ) = MAX( I - J + 1, 0 )
kusano 2b45e8
  110    CONTINUE
kusano 2b45e8
         X( J ) = J
kusano 2b45e8
         Y( J ) = ZERO
kusano 2b45e8
  120 CONTINUE
kusano 2b45e8
      DO 130 J = 1, N
kusano 2b45e8
         YY( J ) = J*( ( J + 1 )*J )/2 - ( ( J + 1 )*J*( J - 1 ) )/3
kusano 2b45e8
  130 CONTINUE
kusano 2b45e8
*     YY holds the exact result. On exit from ZMVCH YT holds
kusano 2b45e8
*     the result computed by ZMVCH.
kusano 2b45e8
      TRANS = 'N'
kusano 2b45e8
      CALL ZMVCH( TRANS, N, N, ONE, A, NMAX, X, 1, ZERO, Y, 1, YT, G,
kusano 2b45e8
     $            YY, EPS, ERR, FATAL, NOUT, .TRUE. )
kusano 2b45e8
      SAME = LZE( YY, YT, N )
kusano 2b45e8
      IF( .NOT.SAME.OR.ERR.NE.RZERO )THEN
kusano 2b45e8
         WRITE( NOUT, FMT = 9985 )TRANS, SAME, ERR
kusano 2b45e8
         STOP
kusano 2b45e8
      END IF
kusano 2b45e8
      TRANS = 'T'
kusano 2b45e8
      CALL ZMVCH( TRANS, N, N, ONE, A, NMAX, X, -1, ZERO, Y, -1, YT, G,
kusano 2b45e8
     $            YY, EPS, ERR, FATAL, NOUT, .TRUE. )
kusano 2b45e8
      SAME = LZE( YY, YT, N )
kusano 2b45e8
      IF( .NOT.SAME.OR.ERR.NE.RZERO )THEN
kusano 2b45e8
         WRITE( NOUT, FMT = 9985 )TRANS, SAME, ERR
kusano 2b45e8
         STOP
kusano 2b45e8
      END IF
kusano 2b45e8
*
kusano 2b45e8
*     Test each subroutine in turn.
kusano 2b45e8
*
kusano 2b45e8
      DO 210 ISNUM = 1, NSUBS
kusano 2b45e8
         WRITE( NOUT, FMT = * )
kusano 2b45e8
         IF( .NOT.LTEST( ISNUM ) )THEN
kusano 2b45e8
*           Subprogram is not to be tested.
kusano 2b45e8
            WRITE( NOUT, FMT = 9983 )SNAMES( ISNUM )
kusano 2b45e8
         ELSE
kusano 2b45e8
            SRNAMT = SNAMES( ISNUM )
kusano 2b45e8
*           Test error exits.
kusano 2b45e8
            IF( TSTERR )THEN
kusano 2b45e8
               CALL ZCHKE( ISNUM, SNAMES( ISNUM ), NOUT )
kusano 2b45e8
               WRITE( NOUT, FMT = * )
kusano 2b45e8
            END IF
kusano 2b45e8
*           Test computations.
kusano 2b45e8
            INFOT = 0
kusano 2b45e8
            OK = .TRUE.
kusano 2b45e8
            FATAL = .FALSE.
kusano 2b45e8
            GO TO ( 140, 140, 150, 150, 150, 160, 160,
kusano 2b45e8
     $              160, 160, 160, 160, 170, 170, 180,
kusano 2b45e8
     $              180, 190, 190 )ISNUM
kusano 2b45e8
*           Test ZGEMV, 01, and ZGBMV, 02.
kusano 2b45e8
  140       CALL ZCHK1( SNAMES( ISNUM ), EPS, THRESH, NOUT, NTRA, TRACE,
kusano 2b45e8
     $                  REWI, FATAL, NIDIM, IDIM, NKB, KB, NALF, ALF,
kusano 2b45e8
     $                  NBET, BET, NINC, INC, NMAX, INCMAX, A, AA, AS,
kusano 2b45e8
     $                  X, XX, XS, Y, YY, YS, YT, G )
kusano 2b45e8
            GO TO 200
kusano 2b45e8
*           Test ZHEMV, 03, ZHBMV, 04, and ZHPMV, 05.
kusano 2b45e8
  150       CALL ZCHK2( SNAMES( ISNUM ), EPS, THRESH, NOUT, NTRA, TRACE,
kusano 2b45e8
     $                  REWI, FATAL, NIDIM, IDIM, NKB, KB, NALF, ALF,
kusano 2b45e8
     $                  NBET, BET, NINC, INC, NMAX, INCMAX, A, AA, AS,
kusano 2b45e8
     $                  X, XX, XS, Y, YY, YS, YT, G )
kusano 2b45e8
            GO TO 200
kusano 2b45e8
*           Test ZTRMV, 06, ZTBMV, 07, ZTPMV, 08,
kusano 2b45e8
*           ZTRSV, 09, ZTBSV, 10, and ZTPSV, 11.
kusano 2b45e8
  160       CALL ZCHK3( SNAMES( ISNUM ), EPS, THRESH, NOUT, NTRA, TRACE,
kusano 2b45e8
     $                  REWI, FATAL, NIDIM, IDIM, NKB, KB, NINC, INC,
kusano 2b45e8
     $                  NMAX, INCMAX, A, AA, AS, Y, YY, YS, YT, G, Z )
kusano 2b45e8
            GO TO 200
kusano 2b45e8
*           Test ZGERC, 12, ZGERU, 13.
kusano 2b45e8
  170       CALL ZCHK4( SNAMES( ISNUM ), EPS, THRESH, NOUT, NTRA, TRACE,
kusano 2b45e8
     $                  REWI, FATAL, NIDIM, IDIM, NALF, ALF, NINC, INC,
kusano 2b45e8
     $                  NMAX, INCMAX, A, AA, AS, X, XX, XS, Y, YY, YS,
kusano 2b45e8
     $                  YT, G, Z )
kusano 2b45e8
            GO TO 200
kusano 2b45e8
*           Test ZHER, 14, and ZHPR, 15.
kusano 2b45e8
  180       CALL ZCHK5( SNAMES( ISNUM ), EPS, THRESH, NOUT, NTRA, TRACE,
kusano 2b45e8
     $                  REWI, FATAL, NIDIM, IDIM, NALF, ALF, NINC, INC,
kusano 2b45e8
     $                  NMAX, INCMAX, A, AA, AS, X, XX, XS, Y, YY, YS,
kusano 2b45e8
     $                  YT, G, Z )
kusano 2b45e8
            GO TO 200
kusano 2b45e8
*           Test ZHER2, 16, and ZHPR2, 17.
kusano 2b45e8
  190       CALL ZCHK6( SNAMES( ISNUM ), EPS, THRESH, NOUT, NTRA, TRACE,
kusano 2b45e8
     $                  REWI, FATAL, NIDIM, IDIM, NALF, ALF, NINC, INC,
kusano 2b45e8
     $                  NMAX, INCMAX, A, AA, AS, X, XX, XS, Y, YY, YS,
kusano 2b45e8
     $                  YT, G, Z )
kusano 2b45e8
*
kusano 2b45e8
  200       IF( FATAL.AND.SFATAL )
kusano 2b45e8
     $         GO TO 220
kusano 2b45e8
         END IF
kusano 2b45e8
  210 CONTINUE
kusano 2b45e8
      WRITE( NOUT, FMT = 9982 )
kusano 2b45e8
      GO TO 240
kusano 2b45e8
*
kusano 2b45e8
  220 CONTINUE
kusano 2b45e8
      WRITE( NOUT, FMT = 9981 )
kusano 2b45e8
      GO TO 240
kusano 2b45e8
*
kusano 2b45e8
  230 CONTINUE
kusano 2b45e8
      WRITE( NOUT, FMT = 9987 )
kusano 2b45e8
*
kusano 2b45e8
  240 CONTINUE
kusano 2b45e8
      IF( TRACE )
kusano 2b45e8
     $   CLOSE ( NTRA )
kusano 2b45e8
      CLOSE ( NOUT )
kusano 2b45e8
      STOP
kusano 2b45e8
*
kusano 2b45e8
 9999 FORMAT( ' ROUTINES PASS COMPUTATIONAL TESTS IF TEST RATIO IS LES',
kusano 2b45e8
     $      'S THAN', F8.2 )
kusano 2b45e8
 9998 FORMAT( ' RELATIVE MACHINE PRECISION IS TAKEN TO BE', 1P, D9.1 )
kusano 2b45e8
 9997 FORMAT( ' NUMBER OF VALUES OF ', A, ' IS LESS THAN 1 OR GREATER ',
kusano 2b45e8
     $      'THAN ', I2 )
kusano 2b45e8
 9996 FORMAT( ' VALUE OF N IS LESS THAN 0 OR GREATER THAN ', I2 )
kusano 2b45e8
 9995 FORMAT( ' VALUE OF K IS LESS THAN 0' )
kusano 2b45e8
 9994 FORMAT( ' ABSOLUTE VALUE OF INCX OR INCY IS 0 OR GREATER THAN ',
kusano 2b45e8
     $      I2 )
kusano 2b45e8
 9993 FORMAT( ' TESTS OF THE COMPLEX*16       LEVEL 2 BLAS', //' THE F',
kusano 2b45e8
     $      'OLLOWING PARAMETER VALUES WILL BE USED:' )
kusano 2b45e8
 9992 FORMAT( '   FOR N              ', 9I6 )
kusano 2b45e8
 9991 FORMAT( '   FOR K              ', 7I6 )
kusano 2b45e8
 9990 FORMAT( '   FOR INCX AND INCY  ', 7I6 )
kusano 2b45e8
 9989 FORMAT( '   FOR ALPHA          ',
kusano 2b45e8
     $      7( '(', F4.1, ',', F4.1, ')  ', : ) )
kusano 2b45e8
 9988 FORMAT( '   FOR BETA           ',
kusano 2b45e8
     $      7( '(', F4.1, ',', F4.1, ')  ', : ) )
kusano 2b45e8
 9987 FORMAT( ' AMEND DATA FILE OR INCREASE ARRAY SIZES IN PROGRAM',
kusano 2b45e8
     $      /' ******* TESTS ABANDONED *******' )
kusano 2b45e8
 9986 FORMAT( ' SUBPROGRAM NAME ', A6, ' NOT RECOGNIZED', /' ******* T',
kusano 2b45e8
     $      'ESTS ABANDONED *******' )
kusano 2b45e8
 9985 FORMAT( ' ERROR IN ZMVCH -  IN-LINE DOT PRODUCTS ARE BEING EVALU',
kusano 2b45e8
     $      'ATED WRONGLY.', /' ZMVCH WAS CALLED WITH TRANS = ', A1,
kusano 2b45e8
     $      ' AND RETURNED SAME = ', L1, ' AND ERR = ', F12.3, '.', /
kusano 2b45e8
     $   ' THIS MAY BE DUE TO FAULTS IN THE ARITHMETIC OR THE COMPILER.'
kusano 2b45e8
     $      , /' ******* TESTS ABANDONED *******' )
kusano 2b45e8
 9984 FORMAT( A6, L2 )
kusano 2b45e8
 9983 FORMAT( 1X, A6, ' WAS NOT TESTED' )
kusano 2b45e8
 9982 FORMAT( /' END OF TESTS' )
kusano 2b45e8
 9981 FORMAT( /' ******* FATAL ERROR - TESTS ABANDONED *******' )
kusano 2b45e8
 9980 FORMAT( ' ERROR-EXITS WILL NOT BE TESTED' )
kusano 2b45e8
*
kusano 2b45e8
*     End of ZBLAT2.
kusano 2b45e8
*
kusano 2b45e8
      END
kusano 2b45e8
      SUBROUTINE ZCHK1( SNAME, EPS, THRESH, NOUT, NTRA, TRACE, REWI,
kusano 2b45e8
     $                  FATAL, NIDIM, IDIM, NKB, KB, NALF, ALF, NBET,
kusano 2b45e8
     $                  BET, NINC, INC, NMAX, INCMAX, A, AA, AS, X, XX,
kusano 2b45e8
     $                  XS, Y, YY, YS, YT, G )
kusano 2b45e8
*
kusano 2b45e8
*  Tests ZGEMV and ZGBMV.
kusano 2b45e8
*
kusano 2b45e8
*  Auxiliary routine for test program for Level 2 Blas.
kusano 2b45e8
*
kusano 2b45e8
*  -- Written on 10-August-1987.
kusano 2b45e8
*     Richard Hanson, Sandia National Labs.
kusano 2b45e8
*     Jeremy Du Croz, NAG Central Office.
kusano 2b45e8
*
kusano 2b45e8
*     .. Parameters ..
kusano 2b45e8
      COMPLEX*16         ZERO, HALF
kusano 2b45e8
      PARAMETER          ( ZERO = ( 0.0D0, 0.0D0 ),
kusano 2b45e8
     $                   HALF = ( 0.5D0, 0.0D0 ) )
kusano 2b45e8
      DOUBLE PRECISION   RZERO
kusano 2b45e8
      PARAMETER          ( RZERO = 0.0D0 )
kusano 2b45e8
*     .. Scalar Arguments ..
kusano 2b45e8
      DOUBLE PRECISION   EPS, THRESH
kusano 2b45e8
      INTEGER            INCMAX, NALF, NBET, NIDIM, NINC, NKB, NMAX,
kusano 2b45e8
     $                   NOUT, NTRA
kusano 2b45e8
      LOGICAL            FATAL, REWI, TRACE
kusano 2b45e8
      CHARACTER*6        SNAME
kusano 2b45e8
*     .. Array Arguments ..
kusano 2b45e8
      COMPLEX*16         A( NMAX, NMAX ), AA( NMAX*NMAX ), ALF( NALF ),
kusano 2b45e8
     $                   AS( NMAX*NMAX ), BET( NBET ), X( NMAX ),
kusano 2b45e8
     $                   XS( NMAX*INCMAX ), XX( NMAX*INCMAX ),
kusano 2b45e8
     $                   Y( NMAX ), YS( NMAX*INCMAX ), YT( NMAX ),
kusano 2b45e8
     $                   YY( NMAX*INCMAX )
kusano 2b45e8
      DOUBLE PRECISION   G( NMAX )
kusano 2b45e8
      INTEGER            IDIM( NIDIM ), INC( NINC ), KB( NKB )
kusano 2b45e8
*     .. Local Scalars ..
kusano 2b45e8
      COMPLEX*16         ALPHA, ALS, BETA, BLS, TRANSL
kusano 2b45e8
      DOUBLE PRECISION   ERR, ERRMAX
kusano 2b45e8
      INTEGER            I, IA, IB, IC, IKU, IM, IN, INCX, INCXS, INCY,
kusano 2b45e8
     $                   INCYS, IX, IY, KL, KLS, KU, KUS, LAA, LDA,
kusano 2b45e8
     $                   LDAS, LX, LY, M, ML, MS, N, NARGS, NC, ND, NK,
kusano 2b45e8
     $                   NL, NS
kusano 2b45e8
      LOGICAL            BANDED, FULL, NULL, RESET, SAME, TRAN
kusano 2b45e8
      CHARACTER*1        TRANS, TRANSS
kusano 2b45e8
      CHARACTER*3        ICH
kusano 2b45e8
*     .. Local Arrays ..
kusano 2b45e8
      LOGICAL            ISAME( 13 )
kusano 2b45e8
*     .. External Functions ..
kusano 2b45e8
      LOGICAL            LZE, LZERES
kusano 2b45e8
      EXTERNAL           LZE, LZERES
kusano 2b45e8
*     .. External Subroutines ..
kusano 2b45e8
      EXTERNAL           ZGBMV, ZGEMV, ZMAKE, ZMVCH
kusano 2b45e8
*     .. Intrinsic Functions ..
kusano 2b45e8
      INTRINSIC          ABS, MAX, MIN
kusano 2b45e8
*     .. Scalars in Common ..
kusano 2b45e8
      INTEGER            INFOT, NOUTC
kusano 2b45e8
      LOGICAL            LERR, OK
kusano 2b45e8
*     .. Common blocks ..
kusano 2b45e8
      COMMON             /INFOC/INFOT, NOUTC, OK, LERR
kusano 2b45e8
*     .. Data statements ..
kusano 2b45e8
      DATA               ICH/'NTC'/
kusano 2b45e8
*     .. Executable Statements ..
kusano 2b45e8
      FULL = SNAME( 3: 3 ).EQ.'E'
kusano 2b45e8
      BANDED = SNAME( 3: 3 ).EQ.'B'
kusano 2b45e8
*     Define the number of arguments.
kusano 2b45e8
      IF( FULL )THEN
kusano 2b45e8
         NARGS = 11
kusano 2b45e8
      ELSE IF( BANDED )THEN
kusano 2b45e8
         NARGS = 13
kusano 2b45e8
      END IF
kusano 2b45e8
*
kusano 2b45e8
      NC = 0
kusano 2b45e8
      RESET = .TRUE.
kusano 2b45e8
      ERRMAX = RZERO
kusano 2b45e8
*
kusano 2b45e8
      DO 120 IN = 1, NIDIM
kusano 2b45e8
         N = IDIM( IN )
kusano 2b45e8
         ND = N/2 + 1
kusano 2b45e8
*
kusano 2b45e8
         DO 110 IM = 1, 2
kusano 2b45e8
            IF( IM.EQ.1 )
kusano 2b45e8
     $         M = MAX( N - ND, 0 )
kusano 2b45e8
            IF( IM.EQ.2 )
kusano 2b45e8
     $         M = MIN( N + ND, NMAX )
kusano 2b45e8
*
kusano 2b45e8
            IF( BANDED )THEN
kusano 2b45e8
               NK = NKB
kusano 2b45e8
            ELSE
kusano 2b45e8
               NK = 1
kusano 2b45e8
            END IF
kusano 2b45e8
            DO 100 IKU = 1, NK
kusano 2b45e8
               IF( BANDED )THEN
kusano 2b45e8
                  KU = KB( IKU )
kusano 2b45e8
                  KL = MAX( KU - 1, 0 )
kusano 2b45e8
               ELSE
kusano 2b45e8
                  KU = N - 1
kusano 2b45e8
                  KL = M - 1
kusano 2b45e8
               END IF
kusano 2b45e8
*              Set LDA to 1 more than minimum value if room.
kusano 2b45e8
               IF( BANDED )THEN
kusano 2b45e8
                  LDA = KL + KU + 1
kusano 2b45e8
               ELSE
kusano 2b45e8
                  LDA = M
kusano 2b45e8
               END IF
kusano 2b45e8
               IF( LDA.LT.NMAX )
kusano 2b45e8
     $            LDA = LDA + 1
kusano 2b45e8
*              Skip tests if not enough room.
kusano 2b45e8
               IF( LDA.GT.NMAX )
kusano 2b45e8
     $            GO TO 100
kusano 2b45e8
               LAA = LDA*N
kusano 2b45e8
               NULL = N.LE.0.OR.M.LE.0
kusano 2b45e8
*
kusano 2b45e8
*              Generate the matrix A.
kusano 2b45e8
*
kusano 2b45e8
               TRANSL = ZERO
kusano 2b45e8
               CALL ZMAKE( SNAME( 2: 3 ), ' ', ' ', M, N, A, NMAX, AA,
kusano 2b45e8
     $                     LDA, KL, KU, RESET, TRANSL )
kusano 2b45e8
*
kusano 2b45e8
               DO 90 IC = 1, 3
kusano 2b45e8
                  TRANS = ICH( IC: IC )
kusano 2b45e8
                  TRAN = TRANS.EQ.'T'.OR.TRANS.EQ.'C'
kusano 2b45e8
*
kusano 2b45e8
                  IF( TRAN )THEN
kusano 2b45e8
                     ML = N
kusano 2b45e8
                     NL = M
kusano 2b45e8
                  ELSE
kusano 2b45e8
                     ML = M
kusano 2b45e8
                     NL = N
kusano 2b45e8
                  END IF
kusano 2b45e8
*
kusano 2b45e8
                  DO 80 IX = 1, NINC
kusano 2b45e8
                     INCX = INC( IX )
kusano 2b45e8
                     LX = ABS( INCX )*NL
kusano 2b45e8
*
kusano 2b45e8
*                    Generate the vector X.
kusano 2b45e8
*
kusano 2b45e8
                     TRANSL = HALF
kusano 2b45e8
                     CALL ZMAKE( 'GE', ' ', ' ', 1, NL, X, 1, XX,
kusano 2b45e8
     $                           ABS( INCX ), 0, NL - 1, RESET, TRANSL )
kusano 2b45e8
                     IF( NL.GT.1 )THEN
kusano 2b45e8
                        X( NL/2 ) = ZERO
kusano 2b45e8
                        XX( 1 + ABS( INCX )*( NL/2 - 1 ) ) = ZERO
kusano 2b45e8
                     END IF
kusano 2b45e8
*
kusano 2b45e8
                     DO 70 IY = 1, NINC
kusano 2b45e8
                        INCY = INC( IY )
kusano 2b45e8
                        LY = ABS( INCY )*ML
kusano 2b45e8
*
kusano 2b45e8
                        DO 60 IA = 1, NALF
kusano 2b45e8
                           ALPHA = ALF( IA )
kusano 2b45e8
*
kusano 2b45e8
                           DO 50 IB = 1, NBET
kusano 2b45e8
                              BETA = BET( IB )
kusano 2b45e8
*
kusano 2b45e8
*                             Generate the vector Y.
kusano 2b45e8
*
kusano 2b45e8
                              TRANSL = ZERO
kusano 2b45e8
                              CALL ZMAKE( 'GE', ' ', ' ', 1, ML, Y, 1,
kusano 2b45e8
     $                                    YY, ABS( INCY ), 0, ML - 1,
kusano 2b45e8
     $                                    RESET, TRANSL )
kusano 2b45e8
*
kusano 2b45e8
                              NC = NC + 1
kusano 2b45e8
*
kusano 2b45e8
*                             Save every datum before calling the
kusano 2b45e8
*                             subroutine.
kusano 2b45e8
*
kusano 2b45e8
                              TRANSS = TRANS
kusano 2b45e8
                              MS = M
kusano 2b45e8
                              NS = N
kusano 2b45e8
                              KLS = KL
kusano 2b45e8
                              KUS = KU
kusano 2b45e8
                              ALS = ALPHA
kusano 2b45e8
                              DO 10 I = 1, LAA
kusano 2b45e8
                                 AS( I ) = AA( I )
kusano 2b45e8
   10                         CONTINUE
kusano 2b45e8
                              LDAS = LDA
kusano 2b45e8
                              DO 20 I = 1, LX
kusano 2b45e8
                                 XS( I ) = XX( I )
kusano 2b45e8
   20                         CONTINUE
kusano 2b45e8
                              INCXS = INCX
kusano 2b45e8
                              BLS = BETA
kusano 2b45e8
                              DO 30 I = 1, LY
kusano 2b45e8
                                 YS( I ) = YY( I )
kusano 2b45e8
   30                         CONTINUE
kusano 2b45e8
                              INCYS = INCY
kusano 2b45e8
*
kusano 2b45e8
*                             Call the subroutine.
kusano 2b45e8
*
kusano 2b45e8
                              IF( FULL )THEN
kusano 2b45e8
                                 IF( TRACE )
kusano 2b45e8
     $                              WRITE( NTRA, FMT = 9994 )NC, SNAME,
kusano 2b45e8
     $                              TRANS, M, N, ALPHA, LDA, INCX, BETA,
kusano 2b45e8
     $                              INCY
kusano 2b45e8
                                 IF( REWI )
kusano 2b45e8
     $                              REWIND NTRA
kusano 2b45e8
                                 CALL ZGEMV( TRANS, M, N, ALPHA, AA,
kusano 2b45e8
     $                                       LDA, XX, INCX, BETA, YY,
kusano 2b45e8
     $                                       INCY )
kusano 2b45e8
                              ELSE IF( BANDED )THEN
kusano 2b45e8
                                 IF( TRACE )
kusano 2b45e8
     $                              WRITE( NTRA, FMT = 9995 )NC, SNAME,
kusano 2b45e8
     $                              TRANS, M, N, KL, KU, ALPHA, LDA,
kusano 2b45e8
     $                              INCX, BETA, INCY
kusano 2b45e8
                                 IF( REWI )
kusano 2b45e8
     $                              REWIND NTRA
kusano 2b45e8
                                 CALL ZGBMV( TRANS, M, N, KL, KU, ALPHA,
kusano 2b45e8
     $                                       AA, LDA, XX, INCX, BETA,
kusano 2b45e8
     $                                       YY, INCY )
kusano 2b45e8
                              END IF
kusano 2b45e8
*
kusano 2b45e8
*                             Check if error-exit was taken incorrectly.
kusano 2b45e8
*
kusano 2b45e8
                              IF( .NOT.OK )THEN
kusano 2b45e8
                                 WRITE( NOUT, FMT = 9993 )
kusano 2b45e8
                                 FATAL = .TRUE.
kusano 2b45e8
                                 GO TO 130
kusano 2b45e8
                              END IF
kusano 2b45e8
*
kusano 2b45e8
*                             See what data changed inside subroutines.
kusano 2b45e8
*
kusano 2b45e8
                              ISAME( 1 ) = TRANS.EQ.TRANSS
kusano 2b45e8
                              ISAME( 2 ) = MS.EQ.M
kusano 2b45e8
                              ISAME( 3 ) = NS.EQ.N
kusano 2b45e8
                              IF( FULL )THEN
kusano 2b45e8
                                 ISAME( 4 ) = ALS.EQ.ALPHA
kusano 2b45e8
                                 ISAME( 5 ) = LZE( AS, AA, LAA )
kusano 2b45e8
                                 ISAME( 6 ) = LDAS.EQ.LDA
kusano 2b45e8
                                 ISAME( 7 ) = LZE( XS, XX, LX )
kusano 2b45e8
                                 ISAME( 8 ) = INCXS.EQ.INCX
kusano 2b45e8
                                 ISAME( 9 ) = BLS.EQ.BETA
kusano 2b45e8
                                 IF( NULL )THEN
kusano 2b45e8
                                    ISAME( 10 ) = LZE( YS, YY, LY )
kusano 2b45e8
                                 ELSE
kusano 2b45e8
                                    ISAME( 10 ) = LZERES( 'GE', ' ', 1,
kusano 2b45e8
     $                                            ML, YS, YY,
kusano 2b45e8
     $                                            ABS( INCY ) )
kusano 2b45e8
                                 END IF
kusano 2b45e8
                                 ISAME( 11 ) = INCYS.EQ.INCY
kusano 2b45e8
                              ELSE IF( BANDED )THEN
kusano 2b45e8
                                 ISAME( 4 ) = KLS.EQ.KL
kusano 2b45e8
                                 ISAME( 5 ) = KUS.EQ.KU
kusano 2b45e8
                                 ISAME( 6 ) = ALS.EQ.ALPHA
kusano 2b45e8
                                 ISAME( 7 ) = LZE( AS, AA, LAA )
kusano 2b45e8
                                 ISAME( 8 ) = LDAS.EQ.LDA
kusano 2b45e8
                                 ISAME( 9 ) = LZE( XS, XX, LX )
kusano 2b45e8
                                 ISAME( 10 ) = INCXS.EQ.INCX
kusano 2b45e8
                                 ISAME( 11 ) = BLS.EQ.BETA
kusano 2b45e8
                                 IF( NULL )THEN
kusano 2b45e8
                                    ISAME( 12 ) = LZE( YS, YY, LY )
kusano 2b45e8
                                 ELSE
kusano 2b45e8
                                    ISAME( 12 ) = LZERES( 'GE', ' ', 1,
kusano 2b45e8
     $                                            ML, YS, YY,
kusano 2b45e8
     $                                            ABS( INCY ) )
kusano 2b45e8
                                 END IF
kusano 2b45e8
                                 ISAME( 13 ) = INCYS.EQ.INCY
kusano 2b45e8
                              END IF
kusano 2b45e8
*
kusano 2b45e8
*                             If data was incorrectly changed, report
kusano 2b45e8
*                             and return.
kusano 2b45e8
*
kusano 2b45e8
                              SAME = .TRUE.
kusano 2b45e8
                              DO 40 I = 1, NARGS
kusano 2b45e8
                                 SAME = SAME.AND.ISAME( I )
kusano 2b45e8
                                 IF( .NOT.ISAME( I ) )
kusano 2b45e8
     $                              WRITE( NOUT, FMT = 9998 )I
kusano 2b45e8
   40                         CONTINUE
kusano 2b45e8
                              IF( .NOT.SAME )THEN
kusano 2b45e8
                                 FATAL = .TRUE.
kusano 2b45e8
                                 GO TO 130
kusano 2b45e8
                              END IF
kusano 2b45e8
*
kusano 2b45e8
                              IF( .NOT.NULL )THEN
kusano 2b45e8
*
kusano 2b45e8
*                                Check the result.
kusano 2b45e8
*
kusano 2b45e8
                                 CALL ZMVCH( TRANS, M, N, ALPHA, A,
kusano 2b45e8
     $                                       NMAX, X, INCX, BETA, Y,
kusano 2b45e8
     $                                       INCY, YT, G, YY, EPS, ERR,
kusano 2b45e8
     $                                       FATAL, NOUT, .TRUE. )
kusano 2b45e8
                                 ERRMAX = MAX( ERRMAX, ERR )
kusano 2b45e8
*                                If got really bad answer, report and
kusano 2b45e8
*                                return.
kusano 2b45e8
                                 IF( FATAL )
kusano 2b45e8
     $                              GO TO 130
kusano 2b45e8
                              ELSE
kusano 2b45e8
*                                Avoid repeating tests with M.le.0 or
kusano 2b45e8
*                                N.le.0.
kusano 2b45e8
                                 GO TO 110
kusano 2b45e8
                              END IF
kusano 2b45e8
*
kusano 2b45e8
   50                      CONTINUE
kusano 2b45e8
*
kusano 2b45e8
   60                   CONTINUE
kusano 2b45e8
*
kusano 2b45e8
   70                CONTINUE
kusano 2b45e8
*
kusano 2b45e8
   80             CONTINUE
kusano 2b45e8
*
kusano 2b45e8
   90          CONTINUE
kusano 2b45e8
*
kusano 2b45e8
  100       CONTINUE
kusano 2b45e8
*
kusano 2b45e8
  110    CONTINUE
kusano 2b45e8
*
kusano 2b45e8
  120 CONTINUE
kusano 2b45e8
*
kusano 2b45e8
*     Report result.
kusano 2b45e8
*
kusano 2b45e8
      IF( ERRMAX.LT.THRESH )THEN
kusano 2b45e8
         WRITE( NOUT, FMT = 9999 )SNAME, NC
kusano 2b45e8
      ELSE
kusano 2b45e8
         WRITE( NOUT, FMT = 9997 )SNAME, NC, ERRMAX
kusano 2b45e8
      END IF
kusano 2b45e8
      GO TO 140
kusano 2b45e8
*
kusano 2b45e8
  130 CONTINUE
kusano 2b45e8
      WRITE( NOUT, FMT = 9996 )SNAME
kusano 2b45e8
      IF( FULL )THEN
kusano 2b45e8
         WRITE( NOUT, FMT = 9994 )NC, SNAME, TRANS, M, N, ALPHA, LDA,
kusano 2b45e8
     $      INCX, BETA, INCY
kusano 2b45e8
      ELSE IF( BANDED )THEN
kusano 2b45e8
         WRITE( NOUT, FMT = 9995 )NC, SNAME, TRANS, M, N, KL, KU,
kusano 2b45e8
     $      ALPHA, LDA, INCX, BETA, INCY
kusano 2b45e8
      END IF
kusano 2b45e8
*
kusano 2b45e8
  140 CONTINUE
kusano 2b45e8
      RETURN
kusano 2b45e8
*
kusano 2b45e8
 9999 FORMAT( ' ', A6, ' PASSED THE COMPUTATIONAL TESTS (', I6, ' CALL',
kusano 2b45e8
     $      'S)' )
kusano 2b45e8
 9998 FORMAT( ' ******* FATAL ERROR - PARAMETER NUMBER ', I2, ' WAS CH',
kusano 2b45e8
     $      'ANGED INCORRECTLY *******' )
kusano 2b45e8
 9997 FORMAT( ' ', A6, ' COMPLETED THE COMPUTATIONAL TESTS (', I6, ' C',
kusano 2b45e8
     $      'ALLS)', /' ******* BUT WITH MAXIMUM TEST RATIO', F8.2,
kusano 2b45e8
     $      ' - SUSPECT *******' )
kusano 2b45e8
 9996 FORMAT( ' ******* ', A6, ' FAILED ON CALL NUMBER:' )
kusano 2b45e8
 9995 FORMAT( 1X, I6, ': ', A6, '(''', A1, ''',', 4( I3, ',' ), '(',
kusano 2b45e8
     $      F4.1, ',', F4.1, '), A,', I3, ', X,', I2, ',(', F4.1, ',',
kusano 2b45e8
     $      F4.1, '), Y,', I2, ') .' )
kusano 2b45e8
 9994 FORMAT( 1X, I6, ': ', A6, '(''', A1, ''',', 2( I3, ',' ), '(',
kusano 2b45e8
     $      F4.1, ',', F4.1, '), A,', I3, ', X,', I2, ',(', F4.1, ',',
kusano 2b45e8
     $      F4.1, '), Y,', I2, ')         .' )
kusano 2b45e8
 9993 FORMAT( ' ******* FATAL ERROR - ERROR-EXIT TAKEN ON VALID CALL *',
kusano 2b45e8
     $      '******' )
kusano 2b45e8
*
kusano 2b45e8
*     End of ZCHK1.
kusano 2b45e8
*
kusano 2b45e8
      END
kusano 2b45e8
      SUBROUTINE ZCHK2( SNAME, EPS, THRESH, NOUT, NTRA, TRACE, REWI,
kusano 2b45e8
     $                  FATAL, NIDIM, IDIM, NKB, KB, NALF, ALF, NBET,
kusano 2b45e8
     $                  BET, NINC, INC, NMAX, INCMAX, A, AA, AS, X, XX,
kusano 2b45e8
     $                  XS, Y, YY, YS, YT, G )
kusano 2b45e8
*
kusano 2b45e8
*  Tests ZHEMV, ZHBMV and ZHPMV.
kusano 2b45e8
*
kusano 2b45e8
*  Auxiliary routine for test program for Level 2 Blas.
kusano 2b45e8
*
kusano 2b45e8
*  -- Written on 10-August-1987.
kusano 2b45e8
*     Richard Hanson, Sandia National Labs.
kusano 2b45e8
*     Jeremy Du Croz, NAG Central Office.
kusano 2b45e8
*
kusano 2b45e8
*     .. Parameters ..
kusano 2b45e8
      COMPLEX*16         ZERO, HALF
kusano 2b45e8
      PARAMETER          ( ZERO = ( 0.0D0, 0.0D0 ),
kusano 2b45e8
     $                   HALF = ( 0.5D0, 0.0D0 ) )
kusano 2b45e8
      DOUBLE PRECISION   RZERO
kusano 2b45e8
      PARAMETER          ( RZERO = 0.0D0 )
kusano 2b45e8
*     .. Scalar Arguments ..
kusano 2b45e8
      DOUBLE PRECISION   EPS, THRESH
kusano 2b45e8
      INTEGER            INCMAX, NALF, NBET, NIDIM, NINC, NKB, NMAX,
kusano 2b45e8
     $                   NOUT, NTRA
kusano 2b45e8
      LOGICAL            FATAL, REWI, TRACE
kusano 2b45e8
      CHARACTER*6        SNAME
kusano 2b45e8
*     .. Array Arguments ..
kusano 2b45e8
      COMPLEX*16         A( NMAX, NMAX ), AA( NMAX*NMAX ), ALF( NALF ),
kusano 2b45e8
     $                   AS( NMAX*NMAX ), BET( NBET ), X( NMAX ),
kusano 2b45e8
     $                   XS( NMAX*INCMAX ), XX( NMAX*INCMAX ),
kusano 2b45e8
     $                   Y( NMAX ), YS( NMAX*INCMAX ), YT( NMAX ),
kusano 2b45e8
     $                   YY( NMAX*INCMAX )
kusano 2b45e8
      DOUBLE PRECISION   G( NMAX )
kusano 2b45e8
      INTEGER            IDIM( NIDIM ), INC( NINC ), KB( NKB )
kusano 2b45e8
*     .. Local Scalars ..
kusano 2b45e8
      COMPLEX*16         ALPHA, ALS, BETA, BLS, TRANSL
kusano 2b45e8
      DOUBLE PRECISION   ERR, ERRMAX
kusano 2b45e8
      INTEGER            I, IA, IB, IC, IK, IN, INCX, INCXS, INCY,
kusano 2b45e8
     $                   INCYS, IX, IY, K, KS, LAA, LDA, LDAS, LX, LY,
kusano 2b45e8
     $                   N, NARGS, NC, NK, NS
kusano 2b45e8
      LOGICAL            BANDED, FULL, NULL, PACKED, RESET, SAME
kusano 2b45e8
      CHARACTER*1        UPLO, UPLOS
kusano 2b45e8
      CHARACTER*2        ICH
kusano 2b45e8
*     .. Local Arrays ..
kusano 2b45e8
      LOGICAL            ISAME( 13 )
kusano 2b45e8
*     .. External Functions ..
kusano 2b45e8
      LOGICAL            LZE, LZERES
kusano 2b45e8
      EXTERNAL           LZE, LZERES
kusano 2b45e8
*     .. External Subroutines ..
kusano 2b45e8
      EXTERNAL           ZHBMV, ZHEMV, ZHPMV, ZMAKE, ZMVCH
kusano 2b45e8
*     .. Intrinsic Functions ..
kusano 2b45e8
      INTRINSIC          ABS, MAX
kusano 2b45e8
*     .. Scalars in Common ..
kusano 2b45e8
      INTEGER            INFOT, NOUTC
kusano 2b45e8
      LOGICAL            LERR, OK
kusano 2b45e8
*     .. Common blocks ..
kusano 2b45e8
      COMMON             /INFOC/INFOT, NOUTC, OK, LERR
kusano 2b45e8
*     .. Data statements ..
kusano 2b45e8
      DATA               ICH/'UL'/
kusano 2b45e8
*     .. Executable Statements ..
kusano 2b45e8
      FULL = SNAME( 3: 3 ).EQ.'E'
kusano 2b45e8
      BANDED = SNAME( 3: 3 ).EQ.'B'
kusano 2b45e8
      PACKED = SNAME( 3: 3 ).EQ.'P'
kusano 2b45e8
*     Define the number of arguments.
kusano 2b45e8
      IF( FULL )THEN
kusano 2b45e8
         NARGS = 10
kusano 2b45e8
      ELSE IF( BANDED )THEN
kusano 2b45e8
         NARGS = 11
kusano 2b45e8
      ELSE IF( PACKED )THEN
kusano 2b45e8
         NARGS = 9
kusano 2b45e8
      END IF
kusano 2b45e8
*
kusano 2b45e8
      NC = 0
kusano 2b45e8
      RESET = .TRUE.
kusano 2b45e8
      ERRMAX = RZERO
kusano 2b45e8
*
kusano 2b45e8
      DO 110 IN = 1, NIDIM
kusano 2b45e8
         N = IDIM( IN )
kusano 2b45e8
*
kusano 2b45e8
         IF( BANDED )THEN
kusano 2b45e8
            NK = NKB
kusano 2b45e8
         ELSE
kusano 2b45e8
            NK = 1
kusano 2b45e8
         END IF
kusano 2b45e8
         DO 100 IK = 1, NK
kusano 2b45e8
            IF( BANDED )THEN
kusano 2b45e8
               K = KB( IK )
kusano 2b45e8
            ELSE
kusano 2b45e8
               K = N - 1
kusano 2b45e8
            END IF
kusano 2b45e8
*           Set LDA to 1 more than minimum value if room.
kusano 2b45e8
            IF( BANDED )THEN
kusano 2b45e8
               LDA = K + 1
kusano 2b45e8
            ELSE
kusano 2b45e8
               LDA = N
kusano 2b45e8
            END IF
kusano 2b45e8
            IF( LDA.LT.NMAX )
kusano 2b45e8
     $         LDA = LDA + 1
kusano 2b45e8
*           Skip tests if not enough room.
kusano 2b45e8
            IF( LDA.GT.NMAX )
kusano 2b45e8
     $         GO TO 100
kusano 2b45e8
            IF( PACKED )THEN
kusano 2b45e8
               LAA = ( N*( N + 1 ) )/2
kusano 2b45e8
            ELSE
kusano 2b45e8
               LAA = LDA*N
kusano 2b45e8
            END IF
kusano 2b45e8
            NULL = N.LE.0
kusano 2b45e8
*
kusano 2b45e8
            DO 90 IC = 1, 2
kusano 2b45e8
               UPLO = ICH( IC: IC )
kusano 2b45e8
*
kusano 2b45e8
*              Generate the matrix A.
kusano 2b45e8
*
kusano 2b45e8
               TRANSL = ZERO
kusano 2b45e8
               CALL ZMAKE( SNAME( 2: 3 ), UPLO, ' ', N, N, A, NMAX, AA,
kusano 2b45e8
     $                     LDA, K, K, RESET, TRANSL )
kusano 2b45e8
*
kusano 2b45e8
               DO 80 IX = 1, NINC
kusano 2b45e8
                  INCX = INC( IX )
kusano 2b45e8
                  LX = ABS( INCX )*N
kusano 2b45e8
*
kusano 2b45e8
*                 Generate the vector X.
kusano 2b45e8
*
kusano 2b45e8
                  TRANSL = HALF
kusano 2b45e8
                  CALL ZMAKE( 'GE', ' ', ' ', 1, N, X, 1, XX,
kusano 2b45e8
     $                        ABS( INCX ), 0, N - 1, RESET, TRANSL )
kusano 2b45e8
                  IF( N.GT.1 )THEN
kusano 2b45e8
                     X( N/2 ) = ZERO
kusano 2b45e8
                     XX( 1 + ABS( INCX )*( N/2 - 1 ) ) = ZERO
kusano 2b45e8
                  END IF
kusano 2b45e8
*
kusano 2b45e8
                  DO 70 IY = 1, NINC
kusano 2b45e8
                     INCY = INC( IY )
kusano 2b45e8
                     LY = ABS( INCY )*N
kusano 2b45e8
*
kusano 2b45e8
                     DO 60 IA = 1, NALF
kusano 2b45e8
                        ALPHA = ALF( IA )
kusano 2b45e8
*
kusano 2b45e8
                        DO 50 IB = 1, NBET
kusano 2b45e8
                           BETA = BET( IB )
kusano 2b45e8
*
kusano 2b45e8
*                          Generate the vector Y.
kusano 2b45e8
*
kusano 2b45e8
                           TRANSL = ZERO
kusano 2b45e8
                           CALL ZMAKE( 'GE', ' ', ' ', 1, N, Y, 1, YY,
kusano 2b45e8
     $                                 ABS( INCY ), 0, N - 1, RESET,
kusano 2b45e8
     $                                 TRANSL )
kusano 2b45e8
*
kusano 2b45e8
                           NC = NC + 1
kusano 2b45e8
*
kusano 2b45e8
*                          Save every datum before calling the
kusano 2b45e8
*                          subroutine.
kusano 2b45e8
*
kusano 2b45e8
                           UPLOS = UPLO
kusano 2b45e8
                           NS = N
kusano 2b45e8
                           KS = K
kusano 2b45e8
                           ALS = ALPHA
kusano 2b45e8
                           DO 10 I = 1, LAA
kusano 2b45e8
                              AS( I ) = AA( I )
kusano 2b45e8
   10                      CONTINUE
kusano 2b45e8
                           LDAS = LDA
kusano 2b45e8
                           DO 20 I = 1, LX
kusano 2b45e8
                              XS( I ) = XX( I )
kusano 2b45e8
   20                      CONTINUE
kusano 2b45e8
                           INCXS = INCX
kusano 2b45e8
                           BLS = BETA
kusano 2b45e8
                           DO 30 I = 1, LY
kusano 2b45e8
                              YS( I ) = YY( I )
kusano 2b45e8
   30                      CONTINUE
kusano 2b45e8
                           INCYS = INCY
kusano 2b45e8
*
kusano 2b45e8
*                          Call the subroutine.
kusano 2b45e8
*
kusano 2b45e8
                           IF( FULL )THEN
kusano 2b45e8
                              IF( TRACE )
kusano 2b45e8
     $                           WRITE( NTRA, FMT = 9993 )NC, SNAME,
kusano 2b45e8
     $                           UPLO, N, ALPHA, LDA, INCX, BETA, INCY
kusano 2b45e8
                              IF( REWI )
kusano 2b45e8
     $                           REWIND NTRA
kusano 2b45e8
                              CALL ZHEMV( UPLO, N, ALPHA, AA, LDA, XX,
kusano 2b45e8
     $                                    INCX, BETA, YY, INCY )
kusano 2b45e8
                           ELSE IF( BANDED )THEN
kusano 2b45e8
                              IF( TRACE )
kusano 2b45e8
     $                           WRITE( NTRA, FMT = 9994 )NC, SNAME,
kusano 2b45e8
     $                           UPLO, N, K, ALPHA, LDA, INCX, BETA,
kusano 2b45e8
     $                           INCY
kusano 2b45e8
                              IF( REWI )
kusano 2b45e8
     $                           REWIND NTRA
kusano 2b45e8
                              CALL ZHBMV( UPLO, N, K, ALPHA, AA, LDA,
kusano 2b45e8
     $                                    XX, INCX, BETA, YY, INCY )
kusano 2b45e8
                           ELSE IF( PACKED )THEN
kusano 2b45e8
                              IF( TRACE )
kusano 2b45e8
     $                           WRITE( NTRA, FMT = 9995 )NC, SNAME,
kusano 2b45e8
     $                           UPLO, N, ALPHA, INCX, BETA, INCY
kusano 2b45e8
                              IF( REWI )
kusano 2b45e8
     $                           REWIND NTRA
kusano 2b45e8
                              CALL ZHPMV( UPLO, N, ALPHA, AA, XX, INCX,
kusano 2b45e8
     $                                    BETA, YY, INCY )
kusano 2b45e8
                           END IF
kusano 2b45e8
*
kusano 2b45e8
*                          Check if error-exit was taken incorrectly.
kusano 2b45e8
*
kusano 2b45e8
                           IF( .NOT.OK )THEN
kusano 2b45e8
                              WRITE( NOUT, FMT = 9992 )
kusano 2b45e8
                              FATAL = .TRUE.
kusano 2b45e8
                              GO TO 120
kusano 2b45e8
                           END IF
kusano 2b45e8
*
kusano 2b45e8
*                          See what data changed inside subroutines.
kusano 2b45e8
*
kusano 2b45e8
                           ISAME( 1 ) = UPLO.EQ.UPLOS
kusano 2b45e8
                           ISAME( 2 ) = NS.EQ.N
kusano 2b45e8
                           IF( FULL )THEN
kusano 2b45e8
                              ISAME( 3 ) = ALS.EQ.ALPHA
kusano 2b45e8
                              ISAME( 4 ) = LZE( AS, AA, LAA )
kusano 2b45e8
                              ISAME( 5 ) = LDAS.EQ.LDA
kusano 2b45e8
                              ISAME( 6 ) = LZE( XS, XX, LX )
kusano 2b45e8
                              ISAME( 7 ) = INCXS.EQ.INCX
kusano 2b45e8
                              ISAME( 8 ) = BLS.EQ.BETA
kusano 2b45e8
                              IF( NULL )THEN
kusano 2b45e8
                                 ISAME( 9 ) = LZE( YS, YY, LY )
kusano 2b45e8
                              ELSE
kusano 2b45e8
                                 ISAME( 9 ) = LZERES( 'GE', ' ', 1, N,
kusano 2b45e8
     $                                        YS, YY, ABS( INCY ) )
kusano 2b45e8
                              END IF
kusano 2b45e8
                              ISAME( 10 ) = INCYS.EQ.INCY
kusano 2b45e8
                           ELSE IF( BANDED )THEN
kusano 2b45e8
                              ISAME( 3 ) = KS.EQ.K
kusano 2b45e8
                              ISAME( 4 ) = ALS.EQ.ALPHA
kusano 2b45e8
                              ISAME( 5 ) = LZE( AS, AA, LAA )
kusano 2b45e8
                              ISAME( 6 ) = LDAS.EQ.LDA
kusano 2b45e8
                              ISAME( 7 ) = LZE( XS, XX, LX )
kusano 2b45e8
                              ISAME( 8 ) = INCXS.EQ.INCX
kusano 2b45e8
                              ISAME( 9 ) = BLS.EQ.BETA
kusano 2b45e8
                              IF( NULL )THEN
kusano 2b45e8
                                 ISAME( 10 ) = LZE( YS, YY, LY )
kusano 2b45e8
                              ELSE
kusano 2b45e8
                                 ISAME( 10 ) = LZERES( 'GE', ' ', 1, N,
kusano 2b45e8
     $                                         YS, YY, ABS( INCY ) )
kusano 2b45e8
                              END IF
kusano 2b45e8
                              ISAME( 11 ) = INCYS.EQ.INCY
kusano 2b45e8
                           ELSE IF( PACKED )THEN
kusano 2b45e8
                              ISAME( 3 ) = ALS.EQ.ALPHA
kusano 2b45e8
                              ISAME( 4 ) = LZE( AS, AA, LAA )
kusano 2b45e8
                              ISAME( 5 ) = LZE( XS, XX, LX )
kusano 2b45e8
                              ISAME( 6 ) = INCXS.EQ.INCX
kusano 2b45e8
                              ISAME( 7 ) = BLS.EQ.BETA
kusano 2b45e8
                              IF( NULL )THEN
kusano 2b45e8
                                 ISAME( 8 ) = LZE( YS, YY, LY )
kusano 2b45e8
                              ELSE
kusano 2b45e8
                                 ISAME( 8 ) = LZERES( 'GE', ' ', 1, N,
kusano 2b45e8
     $                                        YS, YY, ABS( INCY ) )
kusano 2b45e8
                              END IF
kusano 2b45e8
                              ISAME( 9 ) = INCYS.EQ.INCY
kusano 2b45e8
                           END IF
kusano 2b45e8
*
kusano 2b45e8
*                          If data was incorrectly changed, report and
kusano 2b45e8
*                          return.
kusano 2b45e8
*
kusano 2b45e8
                           SAME = .TRUE.
kusano 2b45e8
                           DO 40 I = 1, NARGS
kusano 2b45e8
                              SAME = SAME.AND.ISAME( I )
kusano 2b45e8
                              IF( .NOT.ISAME( I ) )
kusano 2b45e8
     $                           WRITE( NOUT, FMT = 9998 )I
kusano 2b45e8
   40                      CONTINUE
kusano 2b45e8
                           IF( .NOT.SAME )THEN
kusano 2b45e8
                              FATAL = .TRUE.
kusano 2b45e8
                              GO TO 120
kusano 2b45e8
                           END IF
kusano 2b45e8
*
kusano 2b45e8
                           IF( .NOT.NULL )THEN
kusano 2b45e8
*
kusano 2b45e8
*                             Check the result.
kusano 2b45e8
*
kusano 2b45e8
                              CALL ZMVCH( 'N', N, N, ALPHA, A, NMAX, X,
kusano 2b45e8
     $                                    INCX, BETA, Y, INCY, YT, G,
kusano 2b45e8
     $                                    YY, EPS, ERR, FATAL, NOUT,
kusano 2b45e8
     $                                    .TRUE. )
kusano 2b45e8
                              ERRMAX = MAX( ERRMAX, ERR )
kusano 2b45e8
*                             If got really bad answer, report and
kusano 2b45e8
*                             return.
kusano 2b45e8
                              IF( FATAL )
kusano 2b45e8
     $                           GO TO 120
kusano 2b45e8
                           ELSE
kusano 2b45e8
*                             Avoid repeating tests with N.le.0
kusano 2b45e8
                              GO TO 110
kusano 2b45e8
                           END IF
kusano 2b45e8
*
kusano 2b45e8
   50                   CONTINUE
kusano 2b45e8
*
kusano 2b45e8
   60                CONTINUE
kusano 2b45e8
*
kusano 2b45e8
   70             CONTINUE
kusano 2b45e8
*
kusano 2b45e8
   80          CONTINUE
kusano 2b45e8
*
kusano 2b45e8
   90       CONTINUE
kusano 2b45e8
*
kusano 2b45e8
  100    CONTINUE
kusano 2b45e8
*
kusano 2b45e8
  110 CONTINUE
kusano 2b45e8
*
kusano 2b45e8
*     Report result.
kusano 2b45e8
*
kusano 2b45e8
      IF( ERRMAX.LT.THRESH )THEN
kusano 2b45e8
         WRITE( NOUT, FMT = 9999 )SNAME, NC
kusano 2b45e8
      ELSE
kusano 2b45e8
         WRITE( NOUT, FMT = 9997 )SNAME, NC, ERRMAX
kusano 2b45e8
      END IF
kusano 2b45e8
      GO TO 130
kusano 2b45e8
*
kusano 2b45e8
  120 CONTINUE
kusano 2b45e8
      WRITE( NOUT, FMT = 9996 )SNAME
kusano 2b45e8
      IF( FULL )THEN
kusano 2b45e8
         WRITE( NOUT, FMT = 9993 )NC, SNAME, UPLO, N, ALPHA, LDA, INCX,
kusano 2b45e8
     $      BETA, INCY
kusano 2b45e8
      ELSE IF( BANDED )THEN
kusano 2b45e8
         WRITE( NOUT, FMT = 9994 )NC, SNAME, UPLO, N, K, ALPHA, LDA,
kusano 2b45e8
     $      INCX, BETA, INCY
kusano 2b45e8
      ELSE IF( PACKED )THEN
kusano 2b45e8
         WRITE( NOUT, FMT = 9995 )NC, SNAME, UPLO, N, ALPHA, INCX,
kusano 2b45e8
     $      BETA, INCY
kusano 2b45e8
      END IF
kusano 2b45e8
*
kusano 2b45e8
  130 CONTINUE
kusano 2b45e8
      RETURN
kusano 2b45e8
*
kusano 2b45e8
 9999 FORMAT( ' ', A6, ' PASSED THE COMPUTATIONAL TESTS (', I6, ' CALL',
kusano 2b45e8
     $      'S)' )
kusano 2b45e8
 9998 FORMAT( ' ******* FATAL ERROR - PARAMETER NUMBER ', I2, ' WAS CH',
kusano 2b45e8
     $      'ANGED INCORRECTLY *******' )
kusano 2b45e8
 9997 FORMAT( ' ', A6, ' COMPLETED THE COMPUTATIONAL TESTS (', I6, ' C',
kusano 2b45e8
     $      'ALLS)', /' ******* BUT WITH MAXIMUM TEST RATIO', F8.2,
kusano 2b45e8
     $      ' - SUSPECT *******' )
kusano 2b45e8
 9996 FORMAT( ' ******* ', A6, ' FAILED ON CALL NUMBER:' )
kusano 2b45e8
 9995 FORMAT( 1X, I6, ': ', A6, '(''', A1, ''',', I3, ',(', F4.1, ',',
kusano 2b45e8
     $      F4.1, '), AP, X,', I2, ',(', F4.1, ',', F4.1, '), Y,', I2,
kusano 2b45e8
     $      ')                .' )
kusano 2b45e8
 9994 FORMAT( 1X, I6, ': ', A6, '(''', A1, ''',', 2( I3, ',' ), '(',
kusano 2b45e8
     $      F4.1, ',', F4.1, '), A,', I3, ', X,', I2, ',(', F4.1, ',',
kusano 2b45e8
     $      F4.1, '), Y,', I2, ')         .' )
kusano 2b45e8
 9993 FORMAT( 1X, I6, ': ', A6, '(''', A1, ''',', I3, ',(', F4.1, ',',
kusano 2b45e8
     $      F4.1, '), A,', I3, ', X,', I2, ',(', F4.1, ',', F4.1, '), ',
kusano 2b45e8
     $      'Y,', I2, ')             .' )
kusano 2b45e8
 9992 FORMAT( ' ******* FATAL ERROR - ERROR-EXIT TAKEN ON VALID CALL *',
kusano 2b45e8
     $      '******' )
kusano 2b45e8
*
kusano 2b45e8
*     End of ZCHK2.
kusano 2b45e8
*
kusano 2b45e8
      END
kusano 2b45e8
      SUBROUTINE ZCHK3( SNAME, EPS, THRESH, NOUT, NTRA, TRACE, REWI,
kusano 2b45e8
     $                  FATAL, NIDIM, IDIM, NKB, KB, NINC, INC, NMAX,
kusano 2b45e8
     $                  INCMAX, A, AA, AS, X, XX, XS, XT, G, Z )
kusano 2b45e8
*
kusano 2b45e8
*  Tests ZTRMV, ZTBMV, ZTPMV, ZTRSV, ZTBSV and ZTPSV.
kusano 2b45e8
*
kusano 2b45e8
*  Auxiliary routine for test program for Level 2 Blas.
kusano 2b45e8
*
kusano 2b45e8
*  -- Written on 10-August-1987.
kusano 2b45e8
*     Richard Hanson, Sandia National Labs.
kusano 2b45e8
*     Jeremy Du Croz, NAG Central Office.
kusano 2b45e8
*
kusano 2b45e8
*     .. Parameters ..
kusano 2b45e8
      COMPLEX*16         ZERO, HALF, ONE
kusano 2b45e8
      PARAMETER          ( ZERO = ( 0.0D0, 0.0D0 ),
kusano 2b45e8
     $                   HALF = ( 0.5D0, 0.0D0 ),
kusano 2b45e8
     $                   ONE = ( 1.0D0, 0.0D0 ) )
kusano 2b45e8
      DOUBLE PRECISION   RZERO
kusano 2b45e8
      PARAMETER          ( RZERO = 0.0D0 )
kusano 2b45e8
*     .. Scalar Arguments ..
kusano 2b45e8
      DOUBLE PRECISION   EPS, THRESH
kusano 2b45e8
      INTEGER            INCMAX, NIDIM, NINC, NKB, NMAX, NOUT, NTRA
kusano 2b45e8
      LOGICAL            FATAL, REWI, TRACE
kusano 2b45e8
      CHARACTER*6        SNAME
kusano 2b45e8
*     .. Array Arguments ..
kusano 2b45e8
      COMPLEX*16         A( NMAX, NMAX ), AA( NMAX*NMAX ),
kusano 2b45e8
     $                   AS( NMAX*NMAX ), X( NMAX ), XS( NMAX*INCMAX ),
kusano 2b45e8
     $                   XT( NMAX ), XX( NMAX*INCMAX ), Z( NMAX )
kusano 2b45e8
      DOUBLE PRECISION   G( NMAX )
kusano 2b45e8
      INTEGER            IDIM( NIDIM ), INC( NINC ), KB( NKB )
kusano 2b45e8
*     .. Local Scalars ..
kusano 2b45e8
      COMPLEX*16         TRANSL
kusano 2b45e8
      DOUBLE PRECISION   ERR, ERRMAX
kusano 2b45e8
      INTEGER            I, ICD, ICT, ICU, IK, IN, INCX, INCXS, IX, K,
kusano 2b45e8
     $                   KS, LAA, LDA, LDAS, LX, N, NARGS, NC, NK, NS
kusano 2b45e8
      LOGICAL            BANDED, FULL, NULL, PACKED, RESET, SAME
kusano 2b45e8
      CHARACTER*1        DIAG, DIAGS, TRANS, TRANSS, UPLO, UPLOS
kusano 2b45e8
      CHARACTER*2        ICHD, ICHU
kusano 2b45e8
      CHARACTER*3        ICHT
kusano 2b45e8
*     .. Local Arrays ..
kusano 2b45e8
      LOGICAL            ISAME( 13 )
kusano 2b45e8
*     .. External Functions ..
kusano 2b45e8
      LOGICAL            LZE, LZERES
kusano 2b45e8
      EXTERNAL           LZE, LZERES
kusano 2b45e8
*     .. External Subroutines ..
kusano 2b45e8
      EXTERNAL           ZMAKE, ZMVCH, ZTBMV, ZTBSV, ZTPMV, ZTPSV,
kusano 2b45e8
     $                   ZTRMV, ZTRSV
kusano 2b45e8
*     .. Intrinsic Functions ..
kusano 2b45e8
      INTRINSIC          ABS, MAX
kusano 2b45e8
*     .. Scalars in Common ..
kusano 2b45e8
      INTEGER            INFOT, NOUTC
kusano 2b45e8
      LOGICAL            LERR, OK
kusano 2b45e8
*     .. Common blocks ..
kusano 2b45e8
      COMMON             /INFOC/INFOT, NOUTC, OK, LERR
kusano 2b45e8
*     .. Data statements ..
kusano 2b45e8
      DATA               ICHU/'UL'/, ICHT/'NTC'/, ICHD/'UN'/
kusano 2b45e8
*     .. Executable Statements ..
kusano 2b45e8
      FULL = SNAME( 3: 3 ).EQ.'R'
kusano 2b45e8
      BANDED = SNAME( 3: 3 ).EQ.'B'
kusano 2b45e8
      PACKED = SNAME( 3: 3 ).EQ.'P'
kusano 2b45e8
*     Define the number of arguments.
kusano 2b45e8
      IF( FULL )THEN
kusano 2b45e8
         NARGS = 8
kusano 2b45e8
      ELSE IF( BANDED )THEN
kusano 2b45e8
         NARGS = 9
kusano 2b45e8
      ELSE IF( PACKED )THEN
kusano 2b45e8
         NARGS = 7
kusano 2b45e8
      END IF
kusano 2b45e8
*
kusano 2b45e8
      NC = 0
kusano 2b45e8
      RESET = .TRUE.
kusano 2b45e8
      ERRMAX = RZERO
kusano 2b45e8
*     Set up zero vector for ZMVCH.
kusano 2b45e8
      DO 10 I = 1, NMAX
kusano 2b45e8
         Z( I ) = ZERO
kusano 2b45e8
   10 CONTINUE
kusano 2b45e8
*
kusano 2b45e8
      DO 110 IN = 1, NIDIM
kusano 2b45e8
         N = IDIM( IN )
kusano 2b45e8
*
kusano 2b45e8
         IF( BANDED )THEN
kusano 2b45e8
            NK = NKB
kusano 2b45e8
         ELSE
kusano 2b45e8
            NK = 1
kusano 2b45e8
         END IF
kusano 2b45e8
         DO 100 IK = 1, NK
kusano 2b45e8
            IF( BANDED )THEN
kusano 2b45e8
               K = KB( IK )
kusano 2b45e8
            ELSE
kusano 2b45e8
               K = N - 1
kusano 2b45e8
            END IF
kusano 2b45e8
*           Set LDA to 1 more than minimum value if room.
kusano 2b45e8
            IF( BANDED )THEN
kusano 2b45e8
               LDA = K + 1
kusano 2b45e8
            ELSE
kusano 2b45e8
               LDA = N
kusano 2b45e8
            END IF
kusano 2b45e8
            IF( LDA.LT.NMAX )
kusano 2b45e8
     $         LDA = LDA + 1
kusano 2b45e8
*           Skip tests if not enough room.
kusano 2b45e8
            IF( LDA.GT.NMAX )
kusano 2b45e8
     $         GO TO 100
kusano 2b45e8
            IF( PACKED )THEN
kusano 2b45e8
               LAA = ( N*( N + 1 ) )/2
kusano 2b45e8
            ELSE
kusano 2b45e8
               LAA = LDA*N
kusano 2b45e8
            END IF
kusano 2b45e8
            NULL = N.LE.0
kusano 2b45e8
*
kusano 2b45e8
            DO 90 ICU = 1, 2
kusano 2b45e8
               UPLO = ICHU( ICU: ICU )
kusano 2b45e8
*
kusano 2b45e8
               DO 80 ICT = 1, 3
kusano 2b45e8
                  TRANS = ICHT( ICT: ICT )
kusano 2b45e8
*
kusano 2b45e8
                  DO 70 ICD = 1, 2
kusano 2b45e8
                     DIAG = ICHD( ICD: ICD )
kusano 2b45e8
*
kusano 2b45e8
*                    Generate the matrix A.
kusano 2b45e8
*
kusano 2b45e8
                     TRANSL = ZERO
kusano 2b45e8
                     CALL ZMAKE( SNAME( 2: 3 ), UPLO, DIAG, N, N, A,
kusano 2b45e8
     $                           NMAX, AA, LDA, K, K, RESET, TRANSL )
kusano 2b45e8
*
kusano 2b45e8
                     DO 60 IX = 1, NINC
kusano 2b45e8
                        INCX = INC( IX )
kusano 2b45e8
                        LX = ABS( INCX )*N
kusano 2b45e8
*
kusano 2b45e8
*                       Generate the vector X.
kusano 2b45e8
*
kusano 2b45e8
                        TRANSL = HALF
kusano 2b45e8
                        CALL ZMAKE( 'GE', ' ', ' ', 1, N, X, 1, XX,
kusano 2b45e8
     $                              ABS( INCX ), 0, N - 1, RESET,
kusano 2b45e8
     $                              TRANSL )
kusano 2b45e8
                        IF( N.GT.1 )THEN
kusano 2b45e8
                           X( N/2 ) = ZERO
kusano 2b45e8
                           XX( 1 + ABS( INCX )*( N/2 - 1 ) ) = ZERO
kusano 2b45e8
                        END IF
kusano 2b45e8
*
kusano 2b45e8
                        NC = NC + 1
kusano 2b45e8
*
kusano 2b45e8
*                       Save every datum before calling the subroutine.
kusano 2b45e8
*
kusano 2b45e8
                        UPLOS = UPLO
kusano 2b45e8
                        TRANSS = TRANS
kusano 2b45e8
                        DIAGS = DIAG
kusano 2b45e8
                        NS = N
kusano 2b45e8
                        KS = K
kusano 2b45e8
                        DO 20 I = 1, LAA
kusano 2b45e8
                           AS( I ) = AA( I )
kusano 2b45e8
   20                   CONTINUE
kusano 2b45e8
                        LDAS = LDA
kusano 2b45e8
                        DO 30 I = 1, LX
kusano 2b45e8
                           XS( I ) = XX( I )
kusano 2b45e8
   30                   CONTINUE
kusano 2b45e8
                        INCXS = INCX
kusano 2b45e8
*
kusano 2b45e8
*                       Call the subroutine.
kusano 2b45e8
*
kusano 2b45e8
                        IF( SNAME( 4: 5 ).EQ.'MV' )THEN
kusano 2b45e8
                           IF( FULL )THEN
kusano 2b45e8
                              IF( TRACE )
kusano 2b45e8
     $                           WRITE( NTRA, FMT = 9993 )NC, SNAME,
kusano 2b45e8
     $                           UPLO, TRANS, DIAG, N, LDA, INCX
kusano 2b45e8
                              IF( REWI )
kusano 2b45e8
     $                           REWIND NTRA
kusano 2b45e8
                              CALL ZTRMV( UPLO, TRANS, DIAG, N, AA, LDA,
kusano 2b45e8
     $                                    XX, INCX )
kusano 2b45e8
                           ELSE IF( BANDED )THEN
kusano 2b45e8
                              IF( TRACE )
kusano 2b45e8
     $                           WRITE( NTRA, FMT = 9994 )NC, SNAME,
kusano 2b45e8
     $                           UPLO, TRANS, DIAG, N, K, LDA, INCX
kusano 2b45e8
                              IF( REWI )
kusano 2b45e8
     $                           REWIND NTRA
kusano 2b45e8
                              CALL ZTBMV( UPLO, TRANS, DIAG, N, K, AA,
kusano 2b45e8
     $                                    LDA, XX, INCX )
kusano 2b45e8
                           ELSE IF( PACKED )THEN
kusano 2b45e8
                              IF( TRACE )
kusano 2b45e8
     $                           WRITE( NTRA, FMT = 9995 )NC, SNAME,
kusano 2b45e8
     $                           UPLO, TRANS, DIAG, N, INCX
kusano 2b45e8
                              IF( REWI )
kusano 2b45e8
     $                           REWIND NTRA
kusano 2b45e8
                              CALL ZTPMV( UPLO, TRANS, DIAG, N, AA, XX,
kusano 2b45e8
     $                                    INCX )
kusano 2b45e8
                           END IF
kusano 2b45e8
                        ELSE IF( SNAME( 4: 5 ).EQ.'SV' )THEN
kusano 2b45e8
                           IF( FULL )THEN
kusano 2b45e8
                              IF( TRACE )
kusano 2b45e8
     $                           WRITE( NTRA, FMT = 9993 )NC, SNAME,
kusano 2b45e8
     $                           UPLO, TRANS, DIAG, N, LDA, INCX
kusano 2b45e8
                              IF( REWI )
kusano 2b45e8
     $                           REWIND NTRA
kusano 2b45e8
                              CALL ZTRSV( UPLO, TRANS, DIAG, N, AA, LDA,
kusano 2b45e8
     $                                    XX, INCX )
kusano 2b45e8
                           ELSE IF( BANDED )THEN
kusano 2b45e8
                              IF( TRACE )
kusano 2b45e8
     $                           WRITE( NTRA, FMT = 9994 )NC, SNAME,
kusano 2b45e8
     $                           UPLO, TRANS, DIAG, N, K, LDA, INCX
kusano 2b45e8
                              IF( REWI )
kusano 2b45e8
     $                           REWIND NTRA
kusano 2b45e8
                              CALL ZTBSV( UPLO, TRANS, DIAG, N, K, AA,
kusano 2b45e8
     $                                    LDA, XX, INCX )
kusano 2b45e8
                           ELSE IF( PACKED )THEN
kusano 2b45e8
                              IF( TRACE )
kusano 2b45e8
     $                           WRITE( NTRA, FMT = 9995 )NC, SNAME,
kusano 2b45e8
     $                           UPLO, TRANS, DIAG, N, INCX
kusano 2b45e8
                              IF( REWI )
kusano 2b45e8
     $                           REWIND NTRA
kusano 2b45e8
                              CALL ZTPSV( UPLO, TRANS, DIAG, N, AA, XX,
kusano 2b45e8
     $                                    INCX )
kusano 2b45e8
                           END IF
kusano 2b45e8
                        END IF
kusano 2b45e8
*
kusano 2b45e8
*                       Check if error-exit was taken incorrectly.
kusano 2b45e8
*
kusano 2b45e8
                        IF( .NOT.OK )THEN
kusano 2b45e8
                           WRITE( NOUT, FMT = 9992 )
kusano 2b45e8
                           FATAL = .TRUE.
kusano 2b45e8
                           GO TO 120
kusano 2b45e8
                        END IF
kusano 2b45e8
*
kusano 2b45e8
*                       See what data changed inside subroutines.
kusano 2b45e8
*
kusano 2b45e8
                        ISAME( 1 ) = UPLO.EQ.UPLOS
kusano 2b45e8
                        ISAME( 2 ) = TRANS.EQ.TRANSS
kusano 2b45e8
                        ISAME( 3 ) = DIAG.EQ.DIAGS
kusano 2b45e8
                        ISAME( 4 ) = NS.EQ.N
kusano 2b45e8
                        IF( FULL )THEN
kusano 2b45e8
                           ISAME( 5 ) = LZE( AS, AA, LAA )
kusano 2b45e8
                           ISAME( 6 ) = LDAS.EQ.LDA
kusano 2b45e8
                           IF( NULL )THEN
kusano 2b45e8
                              ISAME( 7 ) = LZE( XS, XX, LX )
kusano 2b45e8
                           ELSE
kusano 2b45e8
                              ISAME( 7 ) = LZERES( 'GE', ' ', 1, N, XS,
kusano 2b45e8
     $                                     XX, ABS( INCX ) )
kusano 2b45e8
                           END IF
kusano 2b45e8
                           ISAME( 8 ) = INCXS.EQ.INCX
kusano 2b45e8
                        ELSE IF( BANDED )THEN
kusano 2b45e8
                           ISAME( 5 ) = KS.EQ.K
kusano 2b45e8
                           ISAME( 6 ) = LZE( AS, AA, LAA )
kusano 2b45e8
                           ISAME( 7 ) = LDAS.EQ.LDA
kusano 2b45e8
                           IF( NULL )THEN
kusano 2b45e8
                              ISAME( 8 ) = LZE( XS, XX, LX )
kusano 2b45e8
                           ELSE
kusano 2b45e8
                              ISAME( 8 ) = LZERES( 'GE', ' ', 1, N, XS,
kusano 2b45e8
     $                                     XX, ABS( INCX ) )
kusano 2b45e8
                           END IF
kusano 2b45e8
                           ISAME( 9 ) = INCXS.EQ.INCX
kusano 2b45e8
                        ELSE IF( PACKED )THEN
kusano 2b45e8
                           ISAME( 5 ) = LZE( AS, AA, LAA )
kusano 2b45e8
                           IF( NULL )THEN
kusano 2b45e8
                              ISAME( 6 ) = LZE( XS, XX, LX )
kusano 2b45e8
                           ELSE
kusano 2b45e8
                              ISAME( 6 ) = LZERES( 'GE', ' ', 1, N, XS,
kusano 2b45e8
     $                                     XX, ABS( INCX ) )
kusano 2b45e8
                           END IF
kusano 2b45e8
                           ISAME( 7 ) = INCXS.EQ.INCX
kusano 2b45e8
                        END IF
kusano 2b45e8
*
kusano 2b45e8
*                       If data was incorrectly changed, report and
kusano 2b45e8
*                       return.
kusano 2b45e8
*
kusano 2b45e8
                        SAME = .TRUE.
kusano 2b45e8
                        DO 40 I = 1, NARGS
kusano 2b45e8
                           SAME = SAME.AND.ISAME( I )
kusano 2b45e8
                           IF( .NOT.ISAME( I ) )
kusano 2b45e8
     $                        WRITE( NOUT, FMT = 9998 )I
kusano 2b45e8
   40                   CONTINUE
kusano 2b45e8
                        IF( .NOT.SAME )THEN
kusano 2b45e8
                           FATAL = .TRUE.
kusano 2b45e8
                           GO TO 120
kusano 2b45e8
                        END IF
kusano 2b45e8
*
kusano 2b45e8
                        IF( .NOT.NULL )THEN
kusano 2b45e8
                           IF( SNAME( 4: 5 ).EQ.'MV' )THEN
kusano 2b45e8
*
kusano 2b45e8
*                             Check the result.
kusano 2b45e8
*
kusano 2b45e8
                              CALL ZMVCH( TRANS, N, N, ONE, A, NMAX, X,
kusano 2b45e8
     $                                    INCX, ZERO, Z, INCX, XT, G,
kusano 2b45e8
     $                                    XX, EPS, ERR, FATAL, NOUT,
kusano 2b45e8
     $                                    .TRUE. )
kusano 2b45e8
                           ELSE IF( SNAME( 4: 5 ).EQ.'SV' )THEN
kusano 2b45e8
*
kusano 2b45e8
*                             Compute approximation to original vector.
kusano 2b45e8
*
kusano 2b45e8
                              DO 50 I = 1, N
kusano 2b45e8
                                 Z( I ) = XX( 1 + ( I - 1 )*
kusano 2b45e8
     $                                    ABS( INCX ) )
kusano 2b45e8
                                 XX( 1 + ( I - 1 )*ABS( INCX ) )
kusano 2b45e8
     $                              = X( I )
kusano 2b45e8
   50                         CONTINUE
kusano 2b45e8
                              CALL ZMVCH( TRANS, N, N, ONE, A, NMAX, Z,
kusano 2b45e8
     $                                    INCX, ZERO, X, INCX, XT, G,
kusano 2b45e8
     $                                    XX, EPS, ERR, FATAL, NOUT,
kusano 2b45e8
     $                                    .FALSE. )
kusano 2b45e8
                           END IF
kusano 2b45e8
                           ERRMAX = MAX( ERRMAX, ERR )
kusano 2b45e8
*                          If got really bad answer, report and return.
kusano 2b45e8
                           IF( FATAL )
kusano 2b45e8
     $                        GO TO 120
kusano 2b45e8
                        ELSE
kusano 2b45e8
*                          Avoid repeating tests with N.le.0.
kusano 2b45e8
                           GO TO 110
kusano 2b45e8
                        END IF
kusano 2b45e8
*
kusano 2b45e8
   60                CONTINUE
kusano 2b45e8
*
kusano 2b45e8
   70             CONTINUE
kusano 2b45e8
*
kusano 2b45e8
   80          CONTINUE
kusano 2b45e8
*
kusano 2b45e8
   90       CONTINUE
kusano 2b45e8
*
kusano 2b45e8
  100    CONTINUE
kusano 2b45e8
*
kusano 2b45e8
  110 CONTINUE
kusano 2b45e8
*
kusano 2b45e8
*     Report result.
kusano 2b45e8
*
kusano 2b45e8
      IF( ERRMAX.LT.THRESH )THEN
kusano 2b45e8
         WRITE( NOUT, FMT = 9999 )SNAME, NC
kusano 2b45e8
      ELSE
kusano 2b45e8
         WRITE( NOUT, FMT = 9997 )SNAME, NC, ERRMAX
kusano 2b45e8
      END IF
kusano 2b45e8
      GO TO 130
kusano 2b45e8
*
kusano 2b45e8
  120 CONTINUE
kusano 2b45e8
      WRITE( NOUT, FMT = 9996 )SNAME
kusano 2b45e8
      IF( FULL )THEN
kusano 2b45e8
         WRITE( NOUT, FMT = 9993 )NC, SNAME, UPLO, TRANS, DIAG, N, LDA,
kusano 2b45e8
     $      INCX
kusano 2b45e8
      ELSE IF( BANDED )THEN
kusano 2b45e8
         WRITE( NOUT, FMT = 9994 )NC, SNAME, UPLO, TRANS, DIAG, N, K,
kusano 2b45e8
     $      LDA, INCX
kusano 2b45e8
      ELSE IF( PACKED )THEN
kusano 2b45e8
         WRITE( NOUT, FMT = 9995 )NC, SNAME, UPLO, TRANS, DIAG, N, INCX
kusano 2b45e8
      END IF
kusano 2b45e8
*
kusano 2b45e8
  130 CONTINUE
kusano 2b45e8
      RETURN
kusano 2b45e8
*
kusano 2b45e8
 9999 FORMAT( ' ', A6, ' PASSED THE COMPUTATIONAL TESTS (', I6, ' CALL',
kusano 2b45e8
     $      'S)' )
kusano 2b45e8
 9998 FORMAT( ' ******* FATAL ERROR - PARAMETER NUMBER ', I2, ' WAS CH',
kusano 2b45e8
     $      'ANGED INCORRECTLY *******' )
kusano 2b45e8
 9997 FORMAT( ' ', A6, ' COMPLETED THE COMPUTATIONAL TESTS (', I6, ' C',
kusano 2b45e8
     $      'ALLS)', /' ******* BUT WITH MAXIMUM TEST RATIO', F8.2,
kusano 2b45e8
     $      ' - SUSPECT *******' )
kusano 2b45e8
 9996 FORMAT( ' ******* ', A6, ' FAILED ON CALL NUMBER:' )
kusano 2b45e8
 9995 FORMAT( 1X, I6, ': ', A6, '(', 3( '''', A1, ''',' ), I3, ', AP, ',
kusano 2b45e8
     $      'X,', I2, ')                                      .' )
kusano 2b45e8
 9994 FORMAT( 1X, I6, ': ', A6, '(', 3( '''', A1, ''',' ), 2( I3, ',' ),
kusano 2b45e8
     $      ' A,', I3, ', X,', I2, ')                               .' )
kusano 2b45e8
 9993 FORMAT( 1X, I6, ': ', A6, '(', 3( '''', A1, ''',' ), I3, ', A,',
kusano 2b45e8
     $      I3, ', X,', I2, ')                                   .' )
kusano 2b45e8
 9992 FORMAT( ' ******* FATAL ERROR - ERROR-EXIT TAKEN ON VALID CALL *',
kusano 2b45e8
     $      '******' )
kusano 2b45e8
*
kusano 2b45e8
*     End of ZCHK3.
kusano 2b45e8
*
kusano 2b45e8
      END
kusano 2b45e8
      SUBROUTINE ZCHK4( SNAME, EPS, THRESH, NOUT, NTRA, TRACE, REWI,
kusano 2b45e8
     $                  FATAL, NIDIM, IDIM, NALF, ALF, NINC, INC, NMAX,
kusano 2b45e8
     $                  INCMAX, A, AA, AS, X, XX, XS, Y, YY, YS, YT, G,
kusano 2b45e8
     $                  Z )
kusano 2b45e8
*
kusano 2b45e8
*  Tests ZGERC and ZGERU.
kusano 2b45e8
*
kusano 2b45e8
*  Auxiliary routine for test program for Level 2 Blas.
kusano 2b45e8
*
kusano 2b45e8
*  -- Written on 10-August-1987.
kusano 2b45e8
*     Richard Hanson, Sandia National Labs.
kusano 2b45e8
*     Jeremy Du Croz, NAG Central Office.
kusano 2b45e8
*
kusano 2b45e8
*     .. Parameters ..
kusano 2b45e8
      COMPLEX*16         ZERO, HALF, ONE
kusano 2b45e8
      PARAMETER          ( ZERO = ( 0.0D0, 0.0D0 ),
kusano 2b45e8
     $                   HALF = ( 0.5D0, 0.0D0 ),
kusano 2b45e8
     $                   ONE = ( 1.0D0, 0.0D0 ) )
kusano 2b45e8
      DOUBLE PRECISION   RZERO
kusano 2b45e8
      PARAMETER          ( RZERO = 0.0D0 )
kusano 2b45e8
*     .. Scalar Arguments ..
kusano 2b45e8
      DOUBLE PRECISION   EPS, THRESH
kusano 2b45e8
      INTEGER            INCMAX, NALF, NIDIM, NINC, NMAX, NOUT, NTRA
kusano 2b45e8
      LOGICAL            FATAL, REWI, TRACE
kusano 2b45e8
      CHARACTER*6        SNAME
kusano 2b45e8
*     .. Array Arguments ..
kusano 2b45e8
      COMPLEX*16         A( NMAX, NMAX ), AA( NMAX*NMAX ), ALF( NALF ),
kusano 2b45e8
     $                   AS( NMAX*NMAX ), X( NMAX ), XS( NMAX*INCMAX ),
kusano 2b45e8
     $                   XX( NMAX*INCMAX ), Y( NMAX ),
kusano 2b45e8
     $                   YS( NMAX*INCMAX ), YT( NMAX ),
kusano 2b45e8
     $                   YY( NMAX*INCMAX ), Z( NMAX )
kusano 2b45e8
      DOUBLE PRECISION   G( NMAX )
kusano 2b45e8
      INTEGER            IDIM( NIDIM ), INC( NINC )
kusano 2b45e8
*     .. Local Scalars ..
kusano 2b45e8
      COMPLEX*16         ALPHA, ALS, TRANSL
kusano 2b45e8
      DOUBLE PRECISION   ERR, ERRMAX
kusano 2b45e8
      INTEGER            I, IA, IM, IN, INCX, INCXS, INCY, INCYS, IX,
kusano 2b45e8
     $                   IY, J, LAA, LDA, LDAS, LX, LY, M, MS, N, NARGS,
kusano 2b45e8
     $                   NC, ND, NS
kusano 2b45e8
      LOGICAL            CONJ, NULL, RESET, SAME
kusano 2b45e8
*     .. Local Arrays ..
kusano 2b45e8
      COMPLEX*16         W( 1 )
kusano 2b45e8
      LOGICAL            ISAME( 13 )
kusano 2b45e8
*     .. External Functions ..
kusano 2b45e8
      LOGICAL            LZE, LZERES
kusano 2b45e8
      EXTERNAL           LZE, LZERES
kusano 2b45e8
*     .. External Subroutines ..
kusano 2b45e8
      EXTERNAL           ZGERC, ZGERU, ZMAKE, ZMVCH
kusano 2b45e8
*     .. Intrinsic Functions ..
kusano 2b45e8
      INTRINSIC          ABS, DCONJG, MAX, MIN
kusano 2b45e8
*     .. Scalars in Common ..
kusano 2b45e8
      INTEGER            INFOT, NOUTC
kusano 2b45e8
      LOGICAL            LERR, OK
kusano 2b45e8
*     .. Common blocks ..
kusano 2b45e8
      COMMON             /INFOC/INFOT, NOUTC, OK, LERR
kusano 2b45e8
*     .. Executable Statements ..
kusano 2b45e8
      CONJ = SNAME( 5: 5 ).EQ.'C'
kusano 2b45e8
*     Define the number of arguments.
kusano 2b45e8
      NARGS = 9
kusano 2b45e8
*
kusano 2b45e8
      NC = 0
kusano 2b45e8
      RESET = .TRUE.
kusano 2b45e8
      ERRMAX = RZERO
kusano 2b45e8
*
kusano 2b45e8
      DO 120 IN = 1, NIDIM
kusano 2b45e8
         N = IDIM( IN )
kusano 2b45e8
         ND = N/2 + 1
kusano 2b45e8
*
kusano 2b45e8
         DO 110 IM = 1, 2
kusano 2b45e8
            IF( IM.EQ.1 )
kusano 2b45e8
     $         M = MAX( N - ND, 0 )
kusano 2b45e8
            IF( IM.EQ.2 )
kusano 2b45e8
     $         M = MIN( N + ND, NMAX )
kusano 2b45e8
*
kusano 2b45e8
*           Set LDA to 1 more than minimum value if room.
kusano 2b45e8
            LDA = M
kusano 2b45e8
            IF( LDA.LT.NMAX )
kusano 2b45e8
     $         LDA = LDA + 1
kusano 2b45e8
*           Skip tests if not enough room.
kusano 2b45e8
            IF( LDA.GT.NMAX )
kusano 2b45e8
     $         GO TO 110
kusano 2b45e8
            LAA = LDA*N
kusano 2b45e8
            NULL = N.LE.0.OR.M.LE.0
kusano 2b45e8
*
kusano 2b45e8
            DO 100 IX = 1, NINC
kusano 2b45e8
               INCX = INC( IX )
kusano 2b45e8
               LX = ABS( INCX )*M
kusano 2b45e8
*
kusano 2b45e8
*              Generate the vector X.
kusano 2b45e8
*
kusano 2b45e8
               TRANSL = HALF
kusano 2b45e8
               CALL ZMAKE( 'GE', ' ', ' ', 1, M, X, 1, XX, ABS( INCX ),
kusano 2b45e8
     $                     0, M - 1, RESET, TRANSL )
kusano 2b45e8
               IF( M.GT.1 )THEN
kusano 2b45e8
                  X( M/2 ) = ZERO
kusano 2b45e8
                  XX( 1 + ABS( INCX )*( M/2 - 1 ) ) = ZERO
kusano 2b45e8
               END IF
kusano 2b45e8
*
kusano 2b45e8
               DO 90 IY = 1, NINC
kusano 2b45e8
                  INCY = INC( IY )
kusano 2b45e8
                  LY = ABS( INCY )*N
kusano 2b45e8
*
kusano 2b45e8
*                 Generate the vector Y.
kusano 2b45e8
*
kusano 2b45e8
                  TRANSL = ZERO
kusano 2b45e8
                  CALL ZMAKE( 'GE', ' ', ' ', 1, N, Y, 1, YY,
kusano 2b45e8
     $                        ABS( INCY ), 0, N - 1, RESET, TRANSL )
kusano 2b45e8
                  IF( N.GT.1 )THEN
kusano 2b45e8
                     Y( N/2 ) = ZERO
kusano 2b45e8
                     YY( 1 + ABS( INCY )*( N/2 - 1 ) ) = ZERO
kusano 2b45e8
                  END IF
kusano 2b45e8
*
kusano 2b45e8
                  DO 80 IA = 1, NALF
kusano 2b45e8
                     ALPHA = ALF( IA )
kusano 2b45e8
*
kusano 2b45e8
*                    Generate the matrix A.
kusano 2b45e8
*
kusano 2b45e8
                     TRANSL = ZERO
kusano 2b45e8
                     CALL ZMAKE( SNAME( 2: 3 ), ' ', ' ', M, N, A, NMAX,
kusano 2b45e8
     $                           AA, LDA, M - 1, N - 1, RESET, TRANSL )
kusano 2b45e8
*
kusano 2b45e8
                     NC = NC + 1
kusano 2b45e8
*
kusano 2b45e8
*                    Save every datum before calling the subroutine.
kusano 2b45e8
*
kusano 2b45e8
                     MS = M
kusano 2b45e8
                     NS = N
kusano 2b45e8
                     ALS = ALPHA
kusano 2b45e8
                     DO 10 I = 1, LAA
kusano 2b45e8
                        AS( I ) = AA( I )
kusano 2b45e8
   10                CONTINUE
kusano 2b45e8
                     LDAS = LDA
kusano 2b45e8
                     DO 20 I = 1, LX
kusano 2b45e8
                        XS( I ) = XX( I )
kusano 2b45e8
   20                CONTINUE
kusano 2b45e8
                     INCXS = INCX
kusano 2b45e8
                     DO 30 I = 1, LY
kusano 2b45e8
                        YS( I ) = YY( I )
kusano 2b45e8
   30                CONTINUE
kusano 2b45e8
                     INCYS = INCY
kusano 2b45e8
*
kusano 2b45e8
*                    Call the subroutine.
kusano 2b45e8
*
kusano 2b45e8
                     IF( TRACE )
kusano 2b45e8
     $                  WRITE( NTRA, FMT = 9994 )NC, SNAME, M, N,
kusano 2b45e8
     $                  ALPHA, INCX, INCY, LDA
kusano 2b45e8
                     IF( CONJ )THEN
kusano 2b45e8
                        IF( REWI )
kusano 2b45e8
     $                     REWIND NTRA
kusano 2b45e8
                        CALL ZGERC( M, N, ALPHA, XX, INCX, YY, INCY, AA,
kusano 2b45e8
     $                              LDA )
kusano 2b45e8
                     ELSE
kusano 2b45e8
                        IF( REWI )
kusano 2b45e8
     $                     REWIND NTRA
kusano 2b45e8
                        CALL ZGERU( M, N, ALPHA, XX, INCX, YY, INCY, AA,
kusano 2b45e8
     $                              LDA )
kusano 2b45e8
                     END IF
kusano 2b45e8
*
kusano 2b45e8
*                    Check if error-exit was taken incorrectly.
kusano 2b45e8
*
kusano 2b45e8
                     IF( .NOT.OK )THEN
kusano 2b45e8
                        WRITE( NOUT, FMT = 9993 )
kusano 2b45e8
                        FATAL = .TRUE.
kusano 2b45e8
                        GO TO 140
kusano 2b45e8
                     END IF
kusano 2b45e8
*
kusano 2b45e8
*                    See what data changed inside subroutine.
kusano 2b45e8
*
kusano 2b45e8
                     ISAME( 1 ) = MS.EQ.M
kusano 2b45e8
                     ISAME( 2 ) = NS.EQ.N
kusano 2b45e8
                     ISAME( 3 ) = ALS.EQ.ALPHA
kusano 2b45e8
                     ISAME( 4 ) = LZE( XS, XX, LX )
kusano 2b45e8
                     ISAME( 5 ) = INCXS.EQ.INCX
kusano 2b45e8
                     ISAME( 6 ) = LZE( YS, YY, LY )
kusano 2b45e8
                     ISAME( 7 ) = INCYS.EQ.INCY
kusano 2b45e8
                     IF( NULL )THEN
kusano 2b45e8
                        ISAME( 8 ) = LZE( AS, AA, LAA )
kusano 2b45e8
                     ELSE
kusano 2b45e8
                        ISAME( 8 ) = LZERES( 'GE', ' ', M, N, AS, AA,
kusano 2b45e8
     $                               LDA )
kusano 2b45e8
                     END IF
kusano 2b45e8
                     ISAME( 9 ) = LDAS.EQ.LDA
kusano 2b45e8
*
kusano 2b45e8
*                    If data was incorrectly changed, report and return.
kusano 2b45e8
*
kusano 2b45e8
                     SAME = .TRUE.
kusano 2b45e8
                     DO 40 I = 1, NARGS
kusano 2b45e8
                        SAME = SAME.AND.ISAME( I )
kusano 2b45e8
                        IF( .NOT.ISAME( I ) )
kusano 2b45e8
     $                     WRITE( NOUT, FMT = 9998 )I
kusano 2b45e8
   40                CONTINUE
kusano 2b45e8
                     IF( .NOT.SAME )THEN
kusano 2b45e8
                        FATAL = .TRUE.
kusano 2b45e8
                        GO TO 140
kusano 2b45e8
                     END IF
kusano 2b45e8
*
kusano 2b45e8
                     IF( .NOT.NULL )THEN
kusano 2b45e8
*
kusano 2b45e8
*                       Check the result column by column.
kusano 2b45e8
*
kusano 2b45e8
                        IF( INCX.GT.0 )THEN
kusano 2b45e8
                           DO 50 I = 1, M
kusano 2b45e8
                              Z( I ) = X( I )
kusano 2b45e8
   50                      CONTINUE
kusano 2b45e8
                        ELSE
kusano 2b45e8
                           DO 60 I = 1, M
kusano 2b45e8
                              Z( I ) = X( M - I + 1 )
kusano 2b45e8
   60                      CONTINUE
kusano 2b45e8
                        END IF
kusano 2b45e8
                        DO 70 J = 1, N
kusano 2b45e8
                           IF( INCY.GT.0 )THEN
kusano 2b45e8
                              W( 1 ) = Y( J )
kusano 2b45e8
                           ELSE
kusano 2b45e8
                              W( 1 ) = Y( N - J + 1 )
kusano 2b45e8
                           END IF
kusano 2b45e8
                           IF( CONJ )
kusano 2b45e8
     $                        W( 1 ) = DCONJG( W( 1 ) )
kusano 2b45e8
                           CALL ZMVCH( 'N', M, 1, ALPHA, Z, NMAX, W, 1,
kusano 2b45e8
     $                                 ONE, A( 1, J ), 1, YT, G,
kusano 2b45e8
     $                                 AA( 1 + ( J - 1 )*LDA ), EPS,
kusano 2b45e8
     $                                 ERR, FATAL, NOUT, .TRUE. )
kusano 2b45e8
                           ERRMAX = MAX( ERRMAX, ERR )
kusano 2b45e8
*                          If got really bad answer, report and return.
kusano 2b45e8
                           IF( FATAL )
kusano 2b45e8
     $                        GO TO 130
kusano 2b45e8
   70                   CONTINUE
kusano 2b45e8
                     ELSE
kusano 2b45e8
*                       Avoid repeating tests with M.le.0 or N.le.0.
kusano 2b45e8
                        GO TO 110
kusano 2b45e8
                     END IF
kusano 2b45e8
*
kusano 2b45e8
   80             CONTINUE
kusano 2b45e8
*
kusano 2b45e8
   90          CONTINUE
kusano 2b45e8
*
kusano 2b45e8
  100       CONTINUE
kusano 2b45e8
*
kusano 2b45e8
  110    CONTINUE
kusano 2b45e8
*
kusano 2b45e8
  120 CONTINUE
kusano 2b45e8
*
kusano 2b45e8
*     Report result.
kusano 2b45e8
*
kusano 2b45e8
      IF( ERRMAX.LT.THRESH )THEN
kusano 2b45e8
         WRITE( NOUT, FMT = 9999 )SNAME, NC
kusano 2b45e8
      ELSE
kusano 2b45e8
         WRITE( NOUT, FMT = 9997 )SNAME, NC, ERRMAX
kusano 2b45e8
      END IF
kusano 2b45e8
      GO TO 150
kusano 2b45e8
*
kusano 2b45e8
  130 CONTINUE
kusano 2b45e8
      WRITE( NOUT, FMT = 9995 )J
kusano 2b45e8
*
kusano 2b45e8
  140 CONTINUE
kusano 2b45e8
      WRITE( NOUT, FMT = 9996 )SNAME
kusano 2b45e8
      WRITE( NOUT, FMT = 9994 )NC, SNAME, M, N, ALPHA, INCX, INCY, LDA
kusano 2b45e8
*
kusano 2b45e8
  150 CONTINUE
kusano 2b45e8
      RETURN
kusano 2b45e8
*
kusano 2b45e8
 9999 FORMAT( ' ', A6, ' PASSED THE COMPUTATIONAL TESTS (', I6, ' CALL',
kusano 2b45e8
     $      'S)' )
kusano 2b45e8
 9998 FORMAT( ' ******* FATAL ERROR - PARAMETER NUMBER ', I2, ' WAS CH',
kusano 2b45e8
     $      'ANGED INCORRECTLY *******' )
kusano 2b45e8
 9997 FORMAT( ' ', A6, ' COMPLETED THE COMPUTATIONAL TESTS (', I6, ' C',
kusano 2b45e8
     $      'ALLS)', /' ******* BUT WITH MAXIMUM TEST RATIO', F8.2,
kusano 2b45e8
     $      ' - SUSPECT *******' )
kusano 2b45e8
 9996 FORMAT( ' ******* ', A6, ' FAILED ON CALL NUMBER:' )
kusano 2b45e8
 9995 FORMAT( '      THESE ARE THE RESULTS FOR COLUMN ', I3 )
kusano 2b45e8
 9994 FORMAT( 1X, I6, ': ', A6, '(', 2( I3, ',' ), '(', F4.1, ',', F4.1,
kusano 2b45e8
     $      '), X,', I2, ', Y,', I2, ', A,', I3, ')                   ',
kusano 2b45e8
     $      '      .' )
kusano 2b45e8
 9993 FORMAT( ' ******* FATAL ERROR - ERROR-EXIT TAKEN ON VALID CALL *',
kusano 2b45e8
     $      '******' )
kusano 2b45e8
*
kusano 2b45e8
*     End of ZCHK4.
kusano 2b45e8
*
kusano 2b45e8
      END
kusano 2b45e8
      SUBROUTINE ZCHK5( SNAME, EPS, THRESH, NOUT, NTRA, TRACE, REWI,
kusano 2b45e8
     $                  FATAL, NIDIM, IDIM, NALF, ALF, NINC, INC, NMAX,
kusano 2b45e8
     $                  INCMAX, A, AA, AS, X, XX, XS, Y, YY, YS, YT, G,
kusano 2b45e8
     $                  Z )
kusano 2b45e8
*
kusano 2b45e8
*  Tests ZHER and ZHPR.
kusano 2b45e8
*
kusano 2b45e8
*  Auxiliary routine for test program for Level 2 Blas.
kusano 2b45e8
*
kusano 2b45e8
*  -- Written on 10-August-1987.
kusano 2b45e8
*     Richard Hanson, Sandia National Labs.
kusano 2b45e8
*     Jeremy Du Croz, NAG Central Office.
kusano 2b45e8
*
kusano 2b45e8
*     .. Parameters ..
kusano 2b45e8
      COMPLEX*16         ZERO, HALF, ONE
kusano 2b45e8
      PARAMETER          ( ZERO = ( 0.0D0, 0.0D0 ),
kusano 2b45e8
     $                   HALF = ( 0.5D0, 0.0D0 ),
kusano 2b45e8
     $                   ONE = ( 1.0D0, 0.0D0 ) )
kusano 2b45e8
      DOUBLE PRECISION   RZERO
kusano 2b45e8
      PARAMETER          ( RZERO = 0.0D0 )
kusano 2b45e8
*     .. Scalar Arguments ..
kusano 2b45e8
      DOUBLE PRECISION   EPS, THRESH
kusano 2b45e8
      INTEGER            INCMAX, NALF, NIDIM, NINC, NMAX, NOUT, NTRA
kusano 2b45e8
      LOGICAL            FATAL, REWI, TRACE
kusano 2b45e8
      CHARACTER*6        SNAME
kusano 2b45e8
*     .. Array Arguments ..
kusano 2b45e8
      COMPLEX*16         A( NMAX, NMAX ), AA( NMAX*NMAX ), ALF( NALF ),
kusano 2b45e8
     $                   AS( NMAX*NMAX ), X( NMAX ), XS( NMAX*INCMAX ),
kusano 2b45e8
     $                   XX( NMAX*INCMAX ), Y( NMAX ),
kusano 2b45e8
     $                   YS( NMAX*INCMAX ), YT( NMAX ),
kusano 2b45e8
     $                   YY( NMAX*INCMAX ), Z( NMAX )
kusano 2b45e8
      DOUBLE PRECISION   G( NMAX )
kusano 2b45e8
      INTEGER            IDIM( NIDIM ), INC( NINC )
kusano 2b45e8
*     .. Local Scalars ..
kusano 2b45e8
      COMPLEX*16         ALPHA, TRANSL
kusano 2b45e8
      DOUBLE PRECISION   ERR, ERRMAX, RALPHA, RALS
kusano 2b45e8
      INTEGER            I, IA, IC, IN, INCX, INCXS, IX, J, JA, JJ, LAA,
kusano 2b45e8
     $                   LDA, LDAS, LJ, LX, N, NARGS, NC, NS
kusano 2b45e8
      LOGICAL            FULL, NULL, PACKED, RESET, SAME, UPPER
kusano 2b45e8
      CHARACTER*1        UPLO, UPLOS
kusano 2b45e8
      CHARACTER*2        ICH
kusano 2b45e8
*     .. Local Arrays ..
kusano 2b45e8
      COMPLEX*16         W( 1 )
kusano 2b45e8
      LOGICAL            ISAME( 13 )
kusano 2b45e8
*     .. External Functions ..
kusano 2b45e8
      LOGICAL            LZE, LZERES
kusano 2b45e8
      EXTERNAL           LZE, LZERES
kusano 2b45e8
*     .. External Subroutines ..
kusano 2b45e8
      EXTERNAL           ZHER, ZHPR, ZMAKE, ZMVCH
kusano 2b45e8
*     .. Intrinsic Functions ..
kusano 2b45e8
      INTRINSIC          ABS, DBLE, DCMPLX, DCONJG, MAX
kusano 2b45e8
*     .. Scalars in Common ..
kusano 2b45e8
      INTEGER            INFOT, NOUTC
kusano 2b45e8
      LOGICAL            LERR, OK
kusano 2b45e8
*     .. Common blocks ..
kusano 2b45e8
      COMMON             /INFOC/INFOT, NOUTC, OK, LERR
kusano 2b45e8
*     .. Data statements ..
kusano 2b45e8
      DATA               ICH/'UL'/
kusano 2b45e8
*     .. Executable Statements ..
kusano 2b45e8
      FULL = SNAME( 3: 3 ).EQ.'E'
kusano 2b45e8
      PACKED = SNAME( 3: 3 ).EQ.'P'
kusano 2b45e8
*     Define the number of arguments.
kusano 2b45e8
      IF( FULL )THEN
kusano 2b45e8
         NARGS = 7
kusano 2b45e8
      ELSE IF( PACKED )THEN
kusano 2b45e8
         NARGS = 6
kusano 2b45e8
      END IF
kusano 2b45e8
*
kusano 2b45e8
      NC = 0
kusano 2b45e8
      RESET = .TRUE.
kusano 2b45e8
      ERRMAX = RZERO
kusano 2b45e8
*
kusano 2b45e8
      DO 100 IN = 1, NIDIM
kusano 2b45e8
         N = IDIM( IN )
kusano 2b45e8
*        Set LDA to 1 more than minimum value if room.
kusano 2b45e8
         LDA = N
kusano 2b45e8
         IF( LDA.LT.NMAX )
kusano 2b45e8
     $      LDA = LDA + 1
kusano 2b45e8
*        Skip tests if not enough room.
kusano 2b45e8
         IF( LDA.GT.NMAX )
kusano 2b45e8
     $      GO TO 100
kusano 2b45e8
         IF( PACKED )THEN
kusano 2b45e8
            LAA = ( N*( N + 1 ) )/2
kusano 2b45e8
         ELSE
kusano 2b45e8
            LAA = LDA*N
kusano 2b45e8
         END IF
kusano 2b45e8
*
kusano 2b45e8
         DO 90 IC = 1, 2
kusano 2b45e8
            UPLO = ICH( IC: IC )
kusano 2b45e8
            UPPER = UPLO.EQ.'U'
kusano 2b45e8
*
kusano 2b45e8
            DO 80 IX = 1, NINC
kusano 2b45e8
               INCX = INC( IX )
kusano 2b45e8
               LX = ABS( INCX )*N
kusano 2b45e8
*
kusano 2b45e8
*              Generate the vector X.
kusano 2b45e8
*
kusano 2b45e8
               TRANSL = HALF
kusano 2b45e8
               CALL ZMAKE( 'GE', ' ', ' ', 1, N, X, 1, XX, ABS( INCX ),
kusano 2b45e8
     $                     0, N - 1, RESET, TRANSL )
kusano 2b45e8
               IF( N.GT.1 )THEN
kusano 2b45e8
                  X( N/2 ) = ZERO
kusano 2b45e8
                  XX( 1 + ABS( INCX )*( N/2 - 1 ) ) = ZERO
kusano 2b45e8
               END IF
kusano 2b45e8
*
kusano 2b45e8
               DO 70 IA = 1, NALF
kusano 2b45e8
                  RALPHA = DBLE( ALF( IA ) )
kusano 2b45e8
                  ALPHA = DCMPLX( RALPHA, RZERO )
kusano 2b45e8
                  NULL = N.LE.0.OR.RALPHA.EQ.RZERO
kusano 2b45e8
*
kusano 2b45e8
*                 Generate the matrix A.
kusano 2b45e8
*
kusano 2b45e8
                  TRANSL = ZERO
kusano 2b45e8
                  CALL ZMAKE( SNAME( 2: 3 ), UPLO, ' ', N, N, A, NMAX,
kusano 2b45e8
     $                        AA, LDA, N - 1, N - 1, RESET, TRANSL )
kusano 2b45e8
*
kusano 2b45e8
                  NC = NC + 1
kusano 2b45e8
*
kusano 2b45e8
*                 Save every datum before calling the subroutine.
kusano 2b45e8
*
kusano 2b45e8
                  UPLOS = UPLO
kusano 2b45e8
                  NS = N
kusano 2b45e8
                  RALS = RALPHA
kusano 2b45e8
                  DO 10 I = 1, LAA
kusano 2b45e8
                     AS( I ) = AA( I )
kusano 2b45e8
   10             CONTINUE
kusano 2b45e8
                  LDAS = LDA
kusano 2b45e8
                  DO 20 I = 1, LX
kusano 2b45e8
                     XS( I ) = XX( I )
kusano 2b45e8
   20             CONTINUE
kusano 2b45e8
                  INCXS = INCX
kusano 2b45e8
*
kusano 2b45e8
*                 Call the subroutine.
kusano 2b45e8
*
kusano 2b45e8
                  IF( FULL )THEN
kusano 2b45e8
                     IF( TRACE )
kusano 2b45e8
     $                  WRITE( NTRA, FMT = 9993 )NC, SNAME, UPLO, N,
kusano 2b45e8
     $                  RALPHA, INCX, LDA
kusano 2b45e8
                     IF( REWI )
kusano 2b45e8
     $                  REWIND NTRA
kusano 2b45e8
                     CALL ZHER( UPLO, N, RALPHA, XX, INCX, AA, LDA )
kusano 2b45e8
                  ELSE IF( PACKED )THEN
kusano 2b45e8
                     IF( TRACE )
kusano 2b45e8
     $                  WRITE( NTRA, FMT = 9994 )NC, SNAME, UPLO, N,
kusano 2b45e8
     $                  RALPHA, INCX
kusano 2b45e8
                     IF( REWI )
kusano 2b45e8
     $                  REWIND NTRA
kusano 2b45e8
                     CALL ZHPR( UPLO, N, RALPHA, XX, INCX, AA )
kusano 2b45e8
                  END IF
kusano 2b45e8
*
kusano 2b45e8
*                 Check if error-exit was taken incorrectly.
kusano 2b45e8
*
kusano 2b45e8
                  IF( .NOT.OK )THEN
kusano 2b45e8
                     WRITE( NOUT, FMT = 9992 )
kusano 2b45e8
                     FATAL = .TRUE.
kusano 2b45e8
                     GO TO 120
kusano 2b45e8
                  END IF
kusano 2b45e8
*
kusano 2b45e8
*                 See what data changed inside subroutines.
kusano 2b45e8
*
kusano 2b45e8
                  ISAME( 1 ) = UPLO.EQ.UPLOS
kusano 2b45e8
                  ISAME( 2 ) = NS.EQ.N
kusano 2b45e8
                  ISAME( 3 ) = RALS.EQ.RALPHA
kusano 2b45e8
                  ISAME( 4 ) = LZE( XS, XX, LX )
kusano 2b45e8
                  ISAME( 5 ) = INCXS.EQ.INCX
kusano 2b45e8
                  IF( NULL )THEN
kusano 2b45e8
                     ISAME( 6 ) = LZE( AS, AA, LAA )
kusano 2b45e8
                  ELSE
kusano 2b45e8
                     ISAME( 6 ) = LZERES( SNAME( 2: 3 ), UPLO, N, N, AS,
kusano 2b45e8
     $                            AA, LDA )
kusano 2b45e8
                  END IF
kusano 2b45e8
                  IF( .NOT.PACKED )THEN
kusano 2b45e8
                     ISAME( 7 ) = LDAS.EQ.LDA
kusano 2b45e8
                  END IF
kusano 2b45e8
*
kusano 2b45e8
*                 If data was incorrectly changed, report and return.
kusano 2b45e8
*
kusano 2b45e8
                  SAME = .TRUE.
kusano 2b45e8
                  DO 30 I = 1, NARGS
kusano 2b45e8
                     SAME = SAME.AND.ISAME( I )
kusano 2b45e8
                     IF( .NOT.ISAME( I ) )
kusano 2b45e8
     $                  WRITE( NOUT, FMT = 9998 )I
kusano 2b45e8
   30             CONTINUE
kusano 2b45e8
                  IF( .NOT.SAME )THEN
kusano 2b45e8
                     FATAL = .TRUE.
kusano 2b45e8
                     GO TO 120
kusano 2b45e8
                  END IF
kusano 2b45e8
*
kusano 2b45e8
                  IF( .NOT.NULL )THEN
kusano 2b45e8
*
kusano 2b45e8
*                    Check the result column by column.
kusano 2b45e8
*
kusano 2b45e8
                     IF( INCX.GT.0 )THEN
kusano 2b45e8
                        DO 40 I = 1, N
kusano 2b45e8
                           Z( I ) = X( I )
kusano 2b45e8
   40                   CONTINUE
kusano 2b45e8
                     ELSE
kusano 2b45e8
                        DO 50 I = 1, N
kusano 2b45e8
                           Z( I ) = X( N - I + 1 )
kusano 2b45e8
   50                   CONTINUE
kusano 2b45e8
                     END IF
kusano 2b45e8
                     JA = 1
kusano 2b45e8
                     DO 60 J = 1, N
kusano 2b45e8
                        W( 1 ) = DCONJG( Z( J ) )
kusano 2b45e8
                        IF( UPPER )THEN
kusano 2b45e8
                           JJ = 1
kusano 2b45e8
                           LJ = J
kusano 2b45e8
                        ELSE
kusano 2b45e8
                           JJ = J
kusano 2b45e8
                           LJ = N - J + 1
kusano 2b45e8
                        END IF
kusano 2b45e8
                        CALL ZMVCH( 'N', LJ, 1, ALPHA, Z( JJ ), LJ, W,
kusano 2b45e8
     $                              1, ONE, A( JJ, J ), 1, YT, G,
kusano 2b45e8
     $                              AA( JA ), EPS, ERR, FATAL, NOUT,
kusano 2b45e8
     $                              .TRUE. )
kusano 2b45e8
                        IF( FULL )THEN
kusano 2b45e8
                           IF( UPPER )THEN
kusano 2b45e8
                              JA = JA + LDA
kusano 2b45e8
                           ELSE
kusano 2b45e8
                              JA = JA + LDA + 1
kusano 2b45e8
                           END IF
kusano 2b45e8
                        ELSE
kusano 2b45e8
                           JA = JA + LJ
kusano 2b45e8
                        END IF
kusano 2b45e8
                        ERRMAX = MAX( ERRMAX, ERR )
kusano 2b45e8
*                       If got really bad answer, report and return.
kusano 2b45e8
                        IF( FATAL )
kusano 2b45e8
     $                     GO TO 110
kusano 2b45e8
   60                CONTINUE
kusano 2b45e8
                  ELSE
kusano 2b45e8
*                    Avoid repeating tests if N.le.0.
kusano 2b45e8
                     IF( N.LE.0 )
kusano 2b45e8
     $                  GO TO 100
kusano 2b45e8
                  END IF
kusano 2b45e8
*
kusano 2b45e8
   70          CONTINUE
kusano 2b45e8
*
kusano 2b45e8
   80       CONTINUE
kusano 2b45e8
*
kusano 2b45e8
   90    CONTINUE
kusano 2b45e8
*
kusano 2b45e8
  100 CONTINUE
kusano 2b45e8
*
kusano 2b45e8
*     Report result.
kusano 2b45e8
*
kusano 2b45e8
      IF( ERRMAX.LT.THRESH )THEN
kusano 2b45e8
         WRITE( NOUT, FMT = 9999 )SNAME, NC
kusano 2b45e8
      ELSE
kusano 2b45e8
         WRITE( NOUT, FMT = 9997 )SNAME, NC, ERRMAX
kusano 2b45e8
      END IF
kusano 2b45e8
      GO TO 130
kusano 2b45e8
*
kusano 2b45e8
  110 CONTINUE
kusano 2b45e8
      WRITE( NOUT, FMT = 9995 )J
kusano 2b45e8
*
kusano 2b45e8
  120 CONTINUE
kusano 2b45e8
      WRITE( NOUT, FMT = 9996 )SNAME
kusano 2b45e8
      IF( FULL )THEN
kusano 2b45e8
         WRITE( NOUT, FMT = 9993 )NC, SNAME, UPLO, N, RALPHA, INCX, LDA
kusano 2b45e8
      ELSE IF( PACKED )THEN
kusano 2b45e8
         WRITE( NOUT, FMT = 9994 )NC, SNAME, UPLO, N, RALPHA, INCX
kusano 2b45e8
      END IF
kusano 2b45e8
*
kusano 2b45e8
  130 CONTINUE
kusano 2b45e8
      RETURN
kusano 2b45e8
*
kusano 2b45e8
 9999 FORMAT( ' ', A6, ' PASSED THE COMPUTATIONAL TESTS (', I6, ' CALL',
kusano 2b45e8
     $      'S)' )
kusano 2b45e8
 9998 FORMAT( ' ******* FATAL ERROR - PARAMETER NUMBER ', I2, ' WAS CH',
kusano 2b45e8
     $      'ANGED INCORRECTLY *******' )
kusano 2b45e8
 9997 FORMAT( ' ', A6, ' COMPLETED THE COMPUTATIONAL TESTS (', I6, ' C',
kusano 2b45e8
     $      'ALLS)', /' ******* BUT WITH MAXIMUM TEST RATIO', F8.2,
kusano 2b45e8
     $      ' - SUSPECT *******' )
kusano 2b45e8
 9996 FORMAT( ' ******* ', A6, ' FAILED ON CALL NUMBER:' )
kusano 2b45e8
 9995 FORMAT( '      THESE ARE THE RESULTS FOR COLUMN ', I3 )
kusano 2b45e8
 9994 FORMAT( 1X, I6, ': ', A6, '(''', A1, ''',', I3, ',', F4.1, ', X,',
kusano 2b45e8
     $      I2, ', AP)                                         .' )
kusano 2b45e8
 9993 FORMAT( 1X, I6, ': ', A6, '(''', A1, ''',', I3, ',', F4.1, ', X,',
kusano 2b45e8
     $      I2, ', A,', I3, ')                                      .' )
kusano 2b45e8
 9992 FORMAT( ' ******* FATAL ERROR - ERROR-EXIT TAKEN ON VALID CALL *',
kusano 2b45e8
     $      '******' )
kusano 2b45e8
*
kusano 2b45e8
*     End of ZCHK5.
kusano 2b45e8
*
kusano 2b45e8
      END
kusano 2b45e8
      SUBROUTINE ZCHK6( SNAME, EPS, THRESH, NOUT, NTRA, TRACE, REWI,
kusano 2b45e8
     $                  FATAL, NIDIM, IDIM, NALF, ALF, NINC, INC, NMAX,
kusano 2b45e8
     $                  INCMAX, A, AA, AS, X, XX, XS, Y, YY, YS, YT, G,
kusano 2b45e8
     $                  Z )
kusano 2b45e8
*
kusano 2b45e8
*  Tests ZHER2 and ZHPR2.
kusano 2b45e8
*
kusano 2b45e8
*  Auxiliary routine for test program for Level 2 Blas.
kusano 2b45e8
*
kusano 2b45e8
*  -- Written on 10-August-1987.
kusano 2b45e8
*     Richard Hanson, Sandia National Labs.
kusano 2b45e8
*     Jeremy Du Croz, NAG Central Office.
kusano 2b45e8
*
kusano 2b45e8
*     .. Parameters ..
kusano 2b45e8
      COMPLEX*16         ZERO, HALF, ONE
kusano 2b45e8
      PARAMETER          ( ZERO = ( 0.0D0, 0.0D0 ),
kusano 2b45e8
     $                   HALF = ( 0.5D0, 0.0D0 ),
kusano 2b45e8
     $                   ONE = ( 1.0D0, 0.0D0 ) )
kusano 2b45e8
      DOUBLE PRECISION   RZERO
kusano 2b45e8
      PARAMETER          ( RZERO = 0.0D0 )
kusano 2b45e8
*     .. Scalar Arguments ..
kusano 2b45e8
      DOUBLE PRECISION   EPS, THRESH
kusano 2b45e8
      INTEGER            INCMAX, NALF, NIDIM, NINC, NMAX, NOUT, NTRA
kusano 2b45e8
      LOGICAL            FATAL, REWI, TRACE
kusano 2b45e8
      CHARACTER*6        SNAME
kusano 2b45e8
*     .. Array Arguments ..
kusano 2b45e8
      COMPLEX*16         A( NMAX, NMAX ), AA( NMAX*NMAX ), ALF( NALF ),
kusano 2b45e8
     $                   AS( NMAX*NMAX ), X( NMAX ), XS( NMAX*INCMAX ),
kusano 2b45e8
     $                   XX( NMAX*INCMAX ), Y( NMAX ),
kusano 2b45e8
     $                   YS( NMAX*INCMAX ), YT( NMAX ),
kusano 2b45e8
     $                   YY( NMAX*INCMAX ), Z( NMAX, 2 )
kusano 2b45e8
      DOUBLE PRECISION   G( NMAX )
kusano 2b45e8
      INTEGER            IDIM( NIDIM ), INC( NINC )
kusano 2b45e8
*     .. Local Scalars ..
kusano 2b45e8
      COMPLEX*16         ALPHA, ALS, TRANSL
kusano 2b45e8
      DOUBLE PRECISION   ERR, ERRMAX
kusano 2b45e8
      INTEGER            I, IA, IC, IN, INCX, INCXS, INCY, INCYS, IX,
kusano 2b45e8
     $                   IY, J, JA, JJ, LAA, LDA, LDAS, LJ, LX, LY, N,
kusano 2b45e8
     $                   NARGS, NC, NS
kusano 2b45e8
      LOGICAL            FULL, NULL, PACKED, RESET, SAME, UPPER
kusano 2b45e8
      CHARACTER*1        UPLO, UPLOS
kusano 2b45e8
      CHARACTER*2        ICH
kusano 2b45e8
*     .. Local Arrays ..
kusano 2b45e8
      COMPLEX*16         W( 2 )
kusano 2b45e8
      LOGICAL            ISAME( 13 )
kusano 2b45e8
*     .. External Functions ..
kusano 2b45e8
      LOGICAL            LZE, LZERES
kusano 2b45e8
      EXTERNAL           LZE, LZERES
kusano 2b45e8
*     .. External Subroutines ..
kusano 2b45e8
      EXTERNAL           ZHER2, ZHPR2, ZMAKE, ZMVCH
kusano 2b45e8
*     .. Intrinsic Functions ..
kusano 2b45e8
      INTRINSIC          ABS, DCONJG, MAX
kusano 2b45e8
*     .. Scalars in Common ..
kusano 2b45e8
      INTEGER            INFOT, NOUTC
kusano 2b45e8
      LOGICAL            LERR, OK
kusano 2b45e8
*     .. Common blocks ..
kusano 2b45e8
      COMMON             /INFOC/INFOT, NOUTC, OK, LERR
kusano 2b45e8
*     .. Data statements ..
kusano 2b45e8
      DATA               ICH/'UL'/
kusano 2b45e8
*     .. Executable Statements ..
kusano 2b45e8
      FULL = SNAME( 3: 3 ).EQ.'E'
kusano 2b45e8
      PACKED = SNAME( 3: 3 ).EQ.'P'
kusano 2b45e8
*     Define the number of arguments.
kusano 2b45e8
      IF( FULL )THEN
kusano 2b45e8
         NARGS = 9
kusano 2b45e8
      ELSE IF( PACKED )THEN
kusano 2b45e8
         NARGS = 8
kusano 2b45e8
      END IF
kusano 2b45e8
*
kusano 2b45e8
      NC = 0
kusano 2b45e8
      RESET = .TRUE.
kusano 2b45e8
      ERRMAX = RZERO
kusano 2b45e8
*
kusano 2b45e8
      DO 140 IN = 1, NIDIM
kusano 2b45e8
         N = IDIM( IN )
kusano 2b45e8
*        Set LDA to 1 more than minimum value if room.
kusano 2b45e8
         LDA = N
kusano 2b45e8
         IF( LDA.LT.NMAX )
kusano 2b45e8
     $      LDA = LDA + 1
kusano 2b45e8
*        Skip tests if not enough room.
kusano 2b45e8
         IF( LDA.GT.NMAX )
kusano 2b45e8
     $      GO TO 140
kusano 2b45e8
         IF( PACKED )THEN
kusano 2b45e8
            LAA = ( N*( N + 1 ) )/2
kusano 2b45e8
         ELSE
kusano 2b45e8
            LAA = LDA*N
kusano 2b45e8
         END IF
kusano 2b45e8
*
kusano 2b45e8
         DO 130 IC = 1, 2
kusano 2b45e8
            UPLO = ICH( IC: IC )
kusano 2b45e8
            UPPER = UPLO.EQ.'U'
kusano 2b45e8
*
kusano 2b45e8
            DO 120 IX = 1, NINC
kusano 2b45e8
               INCX = INC( IX )
kusano 2b45e8
               LX = ABS( INCX )*N
kusano 2b45e8
*
kusano 2b45e8
*              Generate the vector X.
kusano 2b45e8
*
kusano 2b45e8
               TRANSL = HALF
kusano 2b45e8
               CALL ZMAKE( 'GE', ' ', ' ', 1, N, X, 1, XX, ABS( INCX ),
kusano 2b45e8
     $                     0, N - 1, RESET, TRANSL )
kusano 2b45e8
               IF( N.GT.1 )THEN
kusano 2b45e8
                  X( N/2 ) = ZERO
kusano 2b45e8
                  XX( 1 + ABS( INCX )*( N/2 - 1 ) ) = ZERO
kusano 2b45e8
               END IF
kusano 2b45e8
*
kusano 2b45e8
               DO 110 IY = 1, NINC
kusano 2b45e8
                  INCY = INC( IY )
kusano 2b45e8
                  LY = ABS( INCY )*N
kusano 2b45e8
*
kusano 2b45e8
*                 Generate the vector Y.
kusano 2b45e8
*
kusano 2b45e8
                  TRANSL = ZERO
kusano 2b45e8
                  CALL ZMAKE( 'GE', ' ', ' ', 1, N, Y, 1, YY,
kusano 2b45e8
     $                        ABS( INCY ), 0, N - 1, RESET, TRANSL )
kusano 2b45e8
                  IF( N.GT.1 )THEN
kusano 2b45e8
                     Y( N/2 ) = ZERO
kusano 2b45e8
                     YY( 1 + ABS( INCY )*( N/2 - 1 ) ) = ZERO
kusano 2b45e8
                  END IF
kusano 2b45e8
*
kusano 2b45e8
                  DO 100 IA = 1, NALF
kusano 2b45e8
                     ALPHA = ALF( IA )
kusano 2b45e8
                     NULL = N.LE.0.OR.ALPHA.EQ.ZERO
kusano 2b45e8
*
kusano 2b45e8
*                    Generate the matrix A.
kusano 2b45e8
*
kusano 2b45e8
                     TRANSL = ZERO
kusano 2b45e8
                     CALL ZMAKE( SNAME( 2: 3 ), UPLO, ' ', N, N, A,
kusano 2b45e8
     $                           NMAX, AA, LDA, N - 1, N - 1, RESET,
kusano 2b45e8
     $                           TRANSL )
kusano 2b45e8
*
kusano 2b45e8
                     NC = NC + 1
kusano 2b45e8
*
kusano 2b45e8
*                    Save every datum before calling the subroutine.
kusano 2b45e8
*
kusano 2b45e8
                     UPLOS = UPLO
kusano 2b45e8
                     NS = N
kusano 2b45e8
                     ALS = ALPHA
kusano 2b45e8
                     DO 10 I = 1, LAA
kusano 2b45e8
                        AS( I ) = AA( I )
kusano 2b45e8
   10                CONTINUE
kusano 2b45e8
                     LDAS = LDA
kusano 2b45e8
                     DO 20 I = 1, LX
kusano 2b45e8
                        XS( I ) = XX( I )
kusano 2b45e8
   20                CONTINUE
kusano 2b45e8
                     INCXS = INCX
kusano 2b45e8
                     DO 30 I = 1, LY
kusano 2b45e8
                        YS( I ) = YY( I )
kusano 2b45e8
   30                CONTINUE
kusano 2b45e8
                     INCYS = INCY
kusano 2b45e8
*
kusano 2b45e8
*                    Call the subroutine.
kusano 2b45e8
*
kusano 2b45e8
                     IF( FULL )THEN
kusano 2b45e8
                        IF( TRACE )
kusano 2b45e8
     $                     WRITE( NTRA, FMT = 9993 )NC, SNAME, UPLO, N,
kusano 2b45e8
     $                     ALPHA, INCX, INCY, LDA
kusano 2b45e8
                        IF( REWI )
kusano 2b45e8
     $                     REWIND NTRA
kusano 2b45e8
                        CALL ZHER2( UPLO, N, ALPHA, XX, INCX, YY, INCY,
kusano 2b45e8
     $                              AA, LDA )
kusano 2b45e8
                     ELSE IF( PACKED )THEN
kusano 2b45e8
                        IF( TRACE )
kusano 2b45e8
     $                     WRITE( NTRA, FMT = 9994 )NC, SNAME, UPLO, N,
kusano 2b45e8
     $                     ALPHA, INCX, INCY
kusano 2b45e8
                        IF( REWI )
kusano 2b45e8
     $                     REWIND NTRA
kusano 2b45e8
                        CALL ZHPR2( UPLO, N, ALPHA, XX, INCX, YY, INCY,
kusano 2b45e8
     $                              AA )
kusano 2b45e8
                     END IF
kusano 2b45e8
*
kusano 2b45e8
*                    Check if error-exit was taken incorrectly.
kusano 2b45e8
*
kusano 2b45e8
                     IF( .NOT.OK )THEN
kusano 2b45e8
                        WRITE( NOUT, FMT = 9992 )
kusano 2b45e8
                        FATAL = .TRUE.
kusano 2b45e8
                        GO TO 160
kusano 2b45e8
                     END IF
kusano 2b45e8
*
kusano 2b45e8
*                    See what data changed inside subroutines.
kusano 2b45e8
*
kusano 2b45e8
                     ISAME( 1 ) = UPLO.EQ.UPLOS
kusano 2b45e8
                     ISAME( 2 ) = NS.EQ.N
kusano 2b45e8
                     ISAME( 3 ) = ALS.EQ.ALPHA
kusano 2b45e8
                     ISAME( 4 ) = LZE( XS, XX, LX )
kusano 2b45e8
                     ISAME( 5 ) = INCXS.EQ.INCX
kusano 2b45e8
                     ISAME( 6 ) = LZE( YS, YY, LY )
kusano 2b45e8
                     ISAME( 7 ) = INCYS.EQ.INCY
kusano 2b45e8
                     IF( NULL )THEN
kusano 2b45e8
                        ISAME( 8 ) = LZE( AS, AA, LAA )
kusano 2b45e8
                     ELSE
kusano 2b45e8
                        ISAME( 8 ) = LZERES( SNAME( 2: 3 ), UPLO, N, N,
kusano 2b45e8
     $                               AS, AA, LDA )
kusano 2b45e8
                     END IF
kusano 2b45e8
                     IF( .NOT.PACKED )THEN
kusano 2b45e8
                        ISAME( 9 ) = LDAS.EQ.LDA
kusano 2b45e8
                     END IF
kusano 2b45e8
*
kusano 2b45e8
*                    If data was incorrectly changed, report and return.
kusano 2b45e8
*
kusano 2b45e8
                     SAME = .TRUE.
kusano 2b45e8
                     DO 40 I = 1, NARGS
kusano 2b45e8
                        SAME = SAME.AND.ISAME( I )
kusano 2b45e8
                        IF( .NOT.ISAME( I ) )
kusano 2b45e8
     $                     WRITE( NOUT, FMT = 9998 )I
kusano 2b45e8
   40                CONTINUE
kusano 2b45e8
                     IF( .NOT.SAME )THEN
kusano 2b45e8
                        FATAL = .TRUE.
kusano 2b45e8
                        GO TO 160
kusano 2b45e8
                     END IF
kusano 2b45e8
*
kusano 2b45e8
                     IF( .NOT.NULL )THEN
kusano 2b45e8
*
kusano 2b45e8
*                       Check the result column by column.
kusano 2b45e8
*
kusano 2b45e8
                        IF( INCX.GT.0 )THEN
kusano 2b45e8
                           DO 50 I = 1, N
kusano 2b45e8
                              Z( I, 1 ) = X( I )
kusano 2b45e8
   50                      CONTINUE
kusano 2b45e8
                        ELSE
kusano 2b45e8
                           DO 60 I = 1, N
kusano 2b45e8
                              Z( I, 1 ) = X( N - I + 1 )
kusano 2b45e8
   60                      CONTINUE
kusano 2b45e8
                        END IF
kusano 2b45e8
                        IF( INCY.GT.0 )THEN
kusano 2b45e8
                           DO 70 I = 1, N
kusano 2b45e8
                              Z( I, 2 ) = Y( I )
kusano 2b45e8
   70                      CONTINUE
kusano 2b45e8
                        ELSE
kusano 2b45e8
                           DO 80 I = 1, N
kusano 2b45e8
                              Z( I, 2 ) = Y( N - I + 1 )
kusano 2b45e8
   80                      CONTINUE
kusano 2b45e8
                        END IF
kusano 2b45e8
                        JA = 1
kusano 2b45e8
                        DO 90 J = 1, N
kusano 2b45e8
                           W( 1 ) = ALPHA*DCONJG( Z( J, 2 ) )
kusano 2b45e8
                           W( 2 ) = DCONJG( ALPHA )*DCONJG( Z( J, 1 ) )
kusano 2b45e8
                           IF( UPPER )THEN
kusano 2b45e8
                              JJ = 1
kusano 2b45e8
                              LJ = J
kusano 2b45e8
                           ELSE
kusano 2b45e8
                              JJ = J
kusano 2b45e8
                              LJ = N - J + 1
kusano 2b45e8
                           END IF
kusano 2b45e8
                           CALL ZMVCH( 'N', LJ, 2, ONE, Z( JJ, 1 ),
kusano 2b45e8
     $                                 NMAX, W, 1, ONE, A( JJ, J ), 1,
kusano 2b45e8
     $                                 YT, G, AA( JA ), EPS, ERR, FATAL,
kusano 2b45e8
     $                                 NOUT, .TRUE. )
kusano 2b45e8
                           IF( FULL )THEN
kusano 2b45e8
                              IF( UPPER )THEN
kusano 2b45e8
                                 JA = JA + LDA
kusano 2b45e8
                              ELSE
kusano 2b45e8
                                 JA = JA + LDA + 1
kusano 2b45e8
                              END IF
kusano 2b45e8
                           ELSE
kusano 2b45e8
                              JA = JA + LJ
kusano 2b45e8
                           END IF
kusano 2b45e8
                           ERRMAX = MAX( ERRMAX, ERR )
kusano 2b45e8
*                          If got really bad answer, report and return.
kusano 2b45e8
                           IF( FATAL )
kusano 2b45e8
     $                        GO TO 150
kusano 2b45e8
   90                   CONTINUE
kusano 2b45e8
                     ELSE
kusano 2b45e8
*                       Avoid repeating tests with N.le.0.
kusano 2b45e8
                        IF( N.LE.0 )
kusano 2b45e8
     $                     GO TO 140
kusano 2b45e8
                     END IF
kusano 2b45e8
*
kusano 2b45e8
  100             CONTINUE
kusano 2b45e8
*
kusano 2b45e8
  110          CONTINUE
kusano 2b45e8
*
kusano 2b45e8
  120       CONTINUE
kusano 2b45e8
*
kusano 2b45e8
  130    CONTINUE
kusano 2b45e8
*
kusano 2b45e8
  140 CONTINUE
kusano 2b45e8
*
kusano 2b45e8
*     Report result.
kusano 2b45e8
*
kusano 2b45e8
      IF( ERRMAX.LT.THRESH )THEN
kusano 2b45e8
         WRITE( NOUT, FMT = 9999 )SNAME, NC
kusano 2b45e8
      ELSE
kusano 2b45e8
         WRITE( NOUT, FMT = 9997 )SNAME, NC, ERRMAX
kusano 2b45e8
      END IF
kusano 2b45e8
      GO TO 170
kusano 2b45e8
*
kusano 2b45e8
  150 CONTINUE
kusano 2b45e8
      WRITE( NOUT, FMT = 9995 )J
kusano 2b45e8
*
kusano 2b45e8
  160 CONTINUE
kusano 2b45e8
      WRITE( NOUT, FMT = 9996 )SNAME
kusano 2b45e8
      IF( FULL )THEN
kusano 2b45e8
         WRITE( NOUT, FMT = 9993 )NC, SNAME, UPLO, N, ALPHA, INCX,
kusano 2b45e8
     $      INCY, LDA
kusano 2b45e8
      ELSE IF( PACKED )THEN
kusano 2b45e8
         WRITE( NOUT, FMT = 9994 )NC, SNAME, UPLO, N, ALPHA, INCX, INCY
kusano 2b45e8
      END IF
kusano 2b45e8
*
kusano 2b45e8
  170 CONTINUE
kusano 2b45e8
      RETURN
kusano 2b45e8
*
kusano 2b45e8
 9999 FORMAT( ' ', A6, ' PASSED THE COMPUTATIONAL TESTS (', I6, ' CALL',
kusano 2b45e8
     $      'S)' )
kusano 2b45e8
 9998 FORMAT( ' ******* FATAL ERROR - PARAMETER NUMBER ', I2, ' WAS CH',
kusano 2b45e8
     $      'ANGED INCORRECTLY *******' )
kusano 2b45e8
 9997 FORMAT( ' ', A6, ' COMPLETED THE COMPUTATIONAL TESTS (', I6, ' C',
kusano 2b45e8
     $      'ALLS)', /' ******* BUT WITH MAXIMUM TEST RATIO', F8.2,
kusano 2b45e8
     $      ' - SUSPECT *******' )
kusano 2b45e8
 9996 FORMAT( ' ******* ', A6, ' FAILED ON CALL NUMBER:' )
kusano 2b45e8
 9995 FORMAT( '      THESE ARE THE RESULTS FOR COLUMN ', I3 )
kusano 2b45e8
 9994 FORMAT( 1X, I6, ': ', A6, '(''', A1, ''',', I3, ',(', F4.1, ',',
kusano 2b45e8
     $      F4.1, '), X,', I2, ', Y,', I2, ', AP)                     ',
kusano 2b45e8
     $      '       .' )
kusano 2b45e8
 9993 FORMAT( 1X, I6, ': ', A6, '(''', A1, ''',', I3, ',(', F4.1, ',',
kusano 2b45e8
     $      F4.1, '), X,', I2, ', Y,', I2, ', A,', I3, ')             ',
kusano 2b45e8
     $      '            .' )
kusano 2b45e8
 9992 FORMAT( ' ******* FATAL ERROR - ERROR-EXIT TAKEN ON VALID CALL *',
kusano 2b45e8
     $      '******' )
kusano 2b45e8
*
kusano 2b45e8
*     End of ZCHK6.
kusano 2b45e8
*
kusano 2b45e8
      END
kusano 2b45e8
      SUBROUTINE ZCHKE( ISNUM, SRNAMT, NOUT )
kusano 2b45e8
*
kusano 2b45e8
*  Tests the error exits from the Level 2 Blas.
kusano 2b45e8
*  Requires a special version of the error-handling routine XERBLA.
kusano 2b45e8
*  ALPHA, RALPHA, BETA, A, X and Y should not need to be defined.
kusano 2b45e8
*
kusano 2b45e8
*  Auxiliary routine for test program for Level 2 Blas.
kusano 2b45e8
*
kusano 2b45e8
*  -- Written on 10-August-1987.
kusano 2b45e8
*     Richard Hanson, Sandia National Labs.
kusano 2b45e8
*     Jeremy Du Croz, NAG Central Office.
kusano 2b45e8
*
kusano 2b45e8
*     .. Scalar Arguments ..
kusano 2b45e8
      INTEGER            ISNUM, NOUT
kusano 2b45e8
      CHARACTER*6        SRNAMT
kusano 2b45e8
*     .. Scalars in Common ..
kusano 2b45e8
      INTEGER            INFOT, NOUTC
kusano 2b45e8
      LOGICAL            LERR, OK
kusano 2b45e8
*     .. Local Scalars ..
kusano 2b45e8
      COMPLEX*16         ALPHA, BETA
kusano 2b45e8
      DOUBLE PRECISION   RALPHA
kusano 2b45e8
*     .. Local Arrays ..
kusano 2b45e8
      COMPLEX*16         A( 1, 1 ), X( 1 ), Y( 1 )
kusano 2b45e8
*     .. External Subroutines ..
kusano 2b45e8
      EXTERNAL           CHKXER, ZGBMV, ZGEMV, ZGERC, ZGERU, ZHBMV,
kusano 2b45e8
     $                   ZHEMV, ZHER, ZHER2, ZHPMV, ZHPR, ZHPR2, ZTBMV,
kusano 2b45e8
     $                   ZTBSV, ZTPMV, ZTPSV, ZTRMV, ZTRSV
kusano 2b45e8
*     .. Common blocks ..
kusano 2b45e8
      COMMON             /INFOC/INFOT, NOUTC, OK, LERR
kusano 2b45e8
*     .. Executable Statements ..
kusano 2b45e8
*     OK is set to .FALSE. by the special version of XERBLA or by CHKXER
kusano 2b45e8
*     if anything is wrong.
kusano 2b45e8
      OK = .TRUE.
kusano 2b45e8
*     LERR is set to .TRUE. by the special version of XERBLA each time
kusano 2b45e8
*     it is called, and is then tested and re-set by CHKXER.
kusano 2b45e8
      LERR = .FALSE.
kusano 2b45e8
      GO TO ( 10, 20, 30, 40, 50, 60, 70, 80,
kusano 2b45e8
     $        90, 100, 110, 120, 130, 140, 150, 160,
kusano 2b45e8
     $        170 )ISNUM
kusano 2b45e8
   10 INFOT = 1
kusano 2b45e8
      CALL ZGEMV( '/', 0, 0, ALPHA, A, 1, X, 1, BETA, Y, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 2
kusano 2b45e8
      CALL ZGEMV( 'N', -1, 0, ALPHA, A, 1, X, 1, BETA, Y, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 3
kusano 2b45e8
      CALL ZGEMV( 'N', 0, -1, ALPHA, A, 1, X, 1, BETA, Y, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 6
kusano 2b45e8
      CALL ZGEMV( 'N', 2, 0, ALPHA, A, 1, X, 1, BETA, Y, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 8
kusano 2b45e8
      CALL ZGEMV( 'N', 0, 0, ALPHA, A, 1, X, 0, BETA, Y, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 11
kusano 2b45e8
      CALL ZGEMV( 'N', 0, 0, ALPHA, A, 1, X, 1, BETA, Y, 0 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      GO TO 180
kusano 2b45e8
   20 INFOT = 1
kusano 2b45e8
      CALL ZGBMV( '/', 0, 0, 0, 0, ALPHA, A, 1, X, 1, BETA, Y, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 2
kusano 2b45e8
      CALL ZGBMV( 'N', -1, 0, 0, 0, ALPHA, A, 1, X, 1, BETA, Y, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 3
kusano 2b45e8
      CALL ZGBMV( 'N', 0, -1, 0, 0, ALPHA, A, 1, X, 1, BETA, Y, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 4
kusano 2b45e8
      CALL ZGBMV( 'N', 0, 0, -1, 0, ALPHA, A, 1, X, 1, BETA, Y, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 5
kusano 2b45e8
      CALL ZGBMV( 'N', 2, 0, 0, -1, ALPHA, A, 1, X, 1, BETA, Y, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 8
kusano 2b45e8
      CALL ZGBMV( 'N', 0, 0, 1, 0, ALPHA, A, 1, X, 1, BETA, Y, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 10
kusano 2b45e8
      CALL ZGBMV( 'N', 0, 0, 0, 0, ALPHA, A, 1, X, 0, BETA, Y, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 13
kusano 2b45e8
      CALL ZGBMV( 'N', 0, 0, 0, 0, ALPHA, A, 1, X, 1, BETA, Y, 0 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      GO TO 180
kusano 2b45e8
   30 INFOT = 1
kusano 2b45e8
      CALL ZHEMV( '/', 0, ALPHA, A, 1, X, 1, BETA, Y, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 2
kusano 2b45e8
      CALL ZHEMV( 'U', -1, ALPHA, A, 1, X, 1, BETA, Y, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 5
kusano 2b45e8
      CALL ZHEMV( 'U', 2, ALPHA, A, 1, X, 1, BETA, Y, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 7
kusano 2b45e8
      CALL ZHEMV( 'U', 0, ALPHA, A, 1, X, 0, BETA, Y, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 10
kusano 2b45e8
      CALL ZHEMV( 'U', 0, ALPHA, A, 1, X, 1, BETA, Y, 0 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      GO TO 180
kusano 2b45e8
   40 INFOT = 1
kusano 2b45e8
      CALL ZHBMV( '/', 0, 0, ALPHA, A, 1, X, 1, BETA, Y, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 2
kusano 2b45e8
      CALL ZHBMV( 'U', -1, 0, ALPHA, A, 1, X, 1, BETA, Y, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 3
kusano 2b45e8
      CALL ZHBMV( 'U', 0, -1, ALPHA, A, 1, X, 1, BETA, Y, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 6
kusano 2b45e8
      CALL ZHBMV( 'U', 0, 1, ALPHA, A, 1, X, 1, BETA, Y, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 8
kusano 2b45e8
      CALL ZHBMV( 'U', 0, 0, ALPHA, A, 1, X, 0, BETA, Y, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 11
kusano 2b45e8
      CALL ZHBMV( 'U', 0, 0, ALPHA, A, 1, X, 1, BETA, Y, 0 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      GO TO 180
kusano 2b45e8
   50 INFOT = 1
kusano 2b45e8
      CALL ZHPMV( '/', 0, ALPHA, A, X, 1, BETA, Y, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 2
kusano 2b45e8
      CALL ZHPMV( 'U', -1, ALPHA, A, X, 1, BETA, Y, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 6
kusano 2b45e8
      CALL ZHPMV( 'U', 0, ALPHA, A, X, 0, BETA, Y, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 9
kusano 2b45e8
      CALL ZHPMV( 'U', 0, ALPHA, A, X, 1, BETA, Y, 0 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      GO TO 180
kusano 2b45e8
   60 INFOT = 1
kusano 2b45e8
      CALL ZTRMV( '/', 'N', 'N', 0, A, 1, X, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 2
kusano 2b45e8
      CALL ZTRMV( 'U', '/', 'N', 0, A, 1, X, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 3
kusano 2b45e8
      CALL ZTRMV( 'U', 'N', '/', 0, A, 1, X, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 4
kusano 2b45e8
      CALL ZTRMV( 'U', 'N', 'N', -1, A, 1, X, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 6
kusano 2b45e8
      CALL ZTRMV( 'U', 'N', 'N', 2, A, 1, X, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 8
kusano 2b45e8
      CALL ZTRMV( 'U', 'N', 'N', 0, A, 1, X, 0 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      GO TO 180
kusano 2b45e8
   70 INFOT = 1
kusano 2b45e8
      CALL ZTBMV( '/', 'N', 'N', 0, 0, A, 1, X, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 2
kusano 2b45e8
      CALL ZTBMV( 'U', '/', 'N', 0, 0, A, 1, X, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 3
kusano 2b45e8
      CALL ZTBMV( 'U', 'N', '/', 0, 0, A, 1, X, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 4
kusano 2b45e8
      CALL ZTBMV( 'U', 'N', 'N', -1, 0, A, 1, X, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 5
kusano 2b45e8
      CALL ZTBMV( 'U', 'N', 'N', 0, -1, A, 1, X, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 7
kusano 2b45e8
      CALL ZTBMV( 'U', 'N', 'N', 0, 1, A, 1, X, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 9
kusano 2b45e8
      CALL ZTBMV( 'U', 'N', 'N', 0, 0, A, 1, X, 0 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      GO TO 180
kusano 2b45e8
   80 INFOT = 1
kusano 2b45e8
      CALL ZTPMV( '/', 'N', 'N', 0, A, X, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 2
kusano 2b45e8
      CALL ZTPMV( 'U', '/', 'N', 0, A, X, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 3
kusano 2b45e8
      CALL ZTPMV( 'U', 'N', '/', 0, A, X, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 4
kusano 2b45e8
      CALL ZTPMV( 'U', 'N', 'N', -1, A, X, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 7
kusano 2b45e8
      CALL ZTPMV( 'U', 'N', 'N', 0, A, X, 0 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      GO TO 180
kusano 2b45e8
   90 INFOT = 1
kusano 2b45e8
      CALL ZTRSV( '/', 'N', 'N', 0, A, 1, X, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 2
kusano 2b45e8
      CALL ZTRSV( 'U', '/', 'N', 0, A, 1, X, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 3
kusano 2b45e8
      CALL ZTRSV( 'U', 'N', '/', 0, A, 1, X, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 4
kusano 2b45e8
      CALL ZTRSV( 'U', 'N', 'N', -1, A, 1, X, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 6
kusano 2b45e8
      CALL ZTRSV( 'U', 'N', 'N', 2, A, 1, X, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 8
kusano 2b45e8
      CALL ZTRSV( 'U', 'N', 'N', 0, A, 1, X, 0 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      GO TO 180
kusano 2b45e8
  100 INFOT = 1
kusano 2b45e8
      CALL ZTBSV( '/', 'N', 'N', 0, 0, A, 1, X, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 2
kusano 2b45e8
      CALL ZTBSV( 'U', '/', 'N', 0, 0, A, 1, X, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 3
kusano 2b45e8
      CALL ZTBSV( 'U', 'N', '/', 0, 0, A, 1, X, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 4
kusano 2b45e8
      CALL ZTBSV( 'U', 'N', 'N', -1, 0, A, 1, X, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 5
kusano 2b45e8
      CALL ZTBSV( 'U', 'N', 'N', 0, -1, A, 1, X, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 7
kusano 2b45e8
      CALL ZTBSV( 'U', 'N', 'N', 0, 1, A, 1, X, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 9
kusano 2b45e8
      CALL ZTBSV( 'U', 'N', 'N', 0, 0, A, 1, X, 0 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      GO TO 180
kusano 2b45e8
  110 INFOT = 1
kusano 2b45e8
      CALL ZTPSV( '/', 'N', 'N', 0, A, X, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 2
kusano 2b45e8
      CALL ZTPSV( 'U', '/', 'N', 0, A, X, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 3
kusano 2b45e8
      CALL ZTPSV( 'U', 'N', '/', 0, A, X, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 4
kusano 2b45e8
      CALL ZTPSV( 'U', 'N', 'N', -1, A, X, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 7
kusano 2b45e8
      CALL ZTPSV( 'U', 'N', 'N', 0, A, X, 0 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      GO TO 180
kusano 2b45e8
  120 INFOT = 1
kusano 2b45e8
      CALL ZGERC( -1, 0, ALPHA, X, 1, Y, 1, A, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 2
kusano 2b45e8
      CALL ZGERC( 0, -1, ALPHA, X, 1, Y, 1, A, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 5
kusano 2b45e8
      CALL ZGERC( 0, 0, ALPHA, X, 0, Y, 1, A, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 7
kusano 2b45e8
      CALL ZGERC( 0, 0, ALPHA, X, 1, Y, 0, A, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 9
kusano 2b45e8
      CALL ZGERC( 2, 0, ALPHA, X, 1, Y, 1, A, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      GO TO 180
kusano 2b45e8
  130 INFOT = 1
kusano 2b45e8
      CALL ZGERU( -1, 0, ALPHA, X, 1, Y, 1, A, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 2
kusano 2b45e8
      CALL ZGERU( 0, -1, ALPHA, X, 1, Y, 1, A, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 5
kusano 2b45e8
      CALL ZGERU( 0, 0, ALPHA, X, 0, Y, 1, A, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 7
kusano 2b45e8
      CALL ZGERU( 0, 0, ALPHA, X, 1, Y, 0, A, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 9
kusano 2b45e8
      CALL ZGERU( 2, 0, ALPHA, X, 1, Y, 1, A, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      GO TO 180
kusano 2b45e8
  140 INFOT = 1
kusano 2b45e8
      CALL ZHER( '/', 0, RALPHA, X, 1, A, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 2
kusano 2b45e8
      CALL ZHER( 'U', -1, RALPHA, X, 1, A, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 5
kusano 2b45e8
      CALL ZHER( 'U', 0, RALPHA, X, 0, A, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 7
kusano 2b45e8
      CALL ZHER( 'U', 2, RALPHA, X, 1, A, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      GO TO 180
kusano 2b45e8
  150 INFOT = 1
kusano 2b45e8
      CALL ZHPR( '/', 0, RALPHA, X, 1, A )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 2
kusano 2b45e8
      CALL ZHPR( 'U', -1, RALPHA, X, 1, A )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 5
kusano 2b45e8
      CALL ZHPR( 'U', 0, RALPHA, X, 0, A )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      GO TO 180
kusano 2b45e8
  160 INFOT = 1
kusano 2b45e8
      CALL ZHER2( '/', 0, ALPHA, X, 1, Y, 1, A, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 2
kusano 2b45e8
      CALL ZHER2( 'U', -1, ALPHA, X, 1, Y, 1, A, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 5
kusano 2b45e8
      CALL ZHER2( 'U', 0, ALPHA, X, 0, Y, 1, A, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 7
kusano 2b45e8
      CALL ZHER2( 'U', 0, ALPHA, X, 1, Y, 0, A, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 9
kusano 2b45e8
      CALL ZHER2( 'U', 2, ALPHA, X, 1, Y, 1, A, 1 )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      GO TO 180
kusano 2b45e8
  170 INFOT = 1
kusano 2b45e8
      CALL ZHPR2( '/', 0, ALPHA, X, 1, Y, 1, A )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 2
kusano 2b45e8
      CALL ZHPR2( 'U', -1, ALPHA, X, 1, Y, 1, A )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 5
kusano 2b45e8
      CALL ZHPR2( 'U', 0, ALPHA, X, 0, Y, 1, A )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
      INFOT = 7
kusano 2b45e8
      CALL ZHPR2( 'U', 0, ALPHA, X, 1, Y, 0, A )
kusano 2b45e8
      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
*
kusano 2b45e8
  180 IF( OK )THEN
kusano 2b45e8
         WRITE( NOUT, FMT = 9999 )SRNAMT
kusano 2b45e8
      ELSE
kusano 2b45e8
         WRITE( NOUT, FMT = 9998 )SRNAMT
kusano 2b45e8
      END IF
kusano 2b45e8
      RETURN
kusano 2b45e8
*
kusano 2b45e8
 9999 FORMAT( ' ', A6, ' PASSED THE TESTS OF ERROR-EXITS' )
kusano 2b45e8
 9998 FORMAT( ' ******* ', A6, ' FAILED THE TESTS OF ERROR-EXITS *****',
kusano 2b45e8
     $      '**' )
kusano 2b45e8
*
kusano 2b45e8
*     End of ZCHKE.
kusano 2b45e8
*
kusano 2b45e8
      END
kusano 2b45e8
      SUBROUTINE ZMAKE( TYPE, UPLO, DIAG, M, N, A, NMAX, AA, LDA, KL,
kusano 2b45e8
     $                  KU, RESET, TRANSL )
kusano 2b45e8
*
kusano 2b45e8
*  Generates values for an M by N matrix A within the bandwidth
kusano 2b45e8
*  defined by KL and KU.
kusano 2b45e8
*  Stores the values in the array AA in the data structure required
kusano 2b45e8
*  by the routine, with unwanted elements set to rogue value.
kusano 2b45e8
*
kusano 2b45e8
*  TYPE is 'GE', 'GB', 'HE', 'HB', 'HP', 'TR', 'TB' OR 'TP'.
kusano 2b45e8
*
kusano 2b45e8
*  Auxiliary routine for test program for Level 2 Blas.
kusano 2b45e8
*
kusano 2b45e8
*  -- Written on 10-August-1987.
kusano 2b45e8
*     Richard Hanson, Sandia National Labs.
kusano 2b45e8
*     Jeremy Du Croz, NAG Central Office.
kusano 2b45e8
*
kusano 2b45e8
*     .. Parameters ..
kusano 2b45e8
      COMPLEX*16         ZERO, ONE
kusano 2b45e8
      PARAMETER          ( ZERO = ( 0.0D0, 0.0D0 ),
kusano 2b45e8
     $                   ONE = ( 1.0D0, 0.0D0 ) )
kusano 2b45e8
      COMPLEX*16         ROGUE
kusano 2b45e8
      PARAMETER          ( ROGUE = ( -1.0D10, 1.0D10 ) )
kusano 2b45e8
      DOUBLE PRECISION   RZERO
kusano 2b45e8
      PARAMETER          ( RZERO = 0.0D0 )
kusano 2b45e8
      DOUBLE PRECISION   RROGUE
kusano 2b45e8
      PARAMETER          ( RROGUE = -1.0D10 )
kusano 2b45e8
*     .. Scalar Arguments ..
kusano 2b45e8
      COMPLEX*16         TRANSL
kusano 2b45e8
      INTEGER            KL, KU, LDA, M, N, NMAX
kusano 2b45e8
      LOGICAL            RESET
kusano 2b45e8
      CHARACTER*1        DIAG, UPLO
kusano 2b45e8
      CHARACTER*2        TYPE
kusano 2b45e8
*     .. Array Arguments ..
kusano 2b45e8
      COMPLEX*16         A( NMAX, * ), AA( * )
kusano 2b45e8
*     .. Local Scalars ..
kusano 2b45e8
      INTEGER            I, I1, I2, I3, IBEG, IEND, IOFF, J, JJ, KK
kusano 2b45e8
      LOGICAL            GEN, LOWER, SYM, TRI, UNIT, UPPER
kusano 2b45e8
*     .. External Functions ..
kusano 2b45e8
      COMPLEX*16         ZBEG
kusano 2b45e8
      EXTERNAL           ZBEG
kusano 2b45e8
*     .. Intrinsic Functions ..
kusano 2b45e8
      INTRINSIC          DBLE, DCMPLX, DCONJG, MAX, MIN
kusano 2b45e8
*     .. Executable Statements ..
kusano 2b45e8
      GEN = TYPE( 1: 1 ).EQ.'G'
kusano 2b45e8
      SYM = TYPE( 1: 1 ).EQ.'H'
kusano 2b45e8
      TRI = TYPE( 1: 1 ).EQ.'T'
kusano 2b45e8
      UPPER = ( SYM.OR.TRI ).AND.UPLO.EQ.'U'
kusano 2b45e8
      LOWER = ( SYM.OR.TRI ).AND.UPLO.EQ.'L'
kusano 2b45e8
      UNIT = TRI.AND.DIAG.EQ.'U'
kusano 2b45e8
*
kusano 2b45e8
*     Generate data in array A.
kusano 2b45e8
*
kusano 2b45e8
      DO 20 J = 1, N
kusano 2b45e8
         DO 10 I = 1, M
kusano 2b45e8
            IF( GEN.OR.( UPPER.AND.I.LE.J ).OR.( LOWER.AND.I.GE.J ) )
kusano 2b45e8
     $          THEN
kusano 2b45e8
               IF( ( I.LE.J.AND.J - I.LE.KU ).OR.
kusano 2b45e8
     $             ( I.GE.J.AND.I - J.LE.KL ) )THEN
kusano 2b45e8
                  A( I, J ) = ZBEG( RESET ) + TRANSL
kusano 2b45e8
               ELSE
kusano 2b45e8
                  A( I, J ) = ZERO
kusano 2b45e8
               END IF
kusano 2b45e8
               IF( I.NE.J )THEN
kusano 2b45e8
                  IF( SYM )THEN
kusano 2b45e8
                     A( J, I ) = DCONJG( A( I, J ) )
kusano 2b45e8
                  ELSE IF( TRI )THEN
kusano 2b45e8
                     A( J, I ) = ZERO
kusano 2b45e8
                  END IF
kusano 2b45e8
               END IF
kusano 2b45e8
            END IF
kusano 2b45e8
   10    CONTINUE
kusano 2b45e8
         IF( SYM )
kusano 2b45e8
     $      A( J, J ) = DCMPLX( DBLE( A( J, J ) ), RZERO )
kusano 2b45e8
         IF( TRI )
kusano 2b45e8
     $      A( J, J ) = A( J, J ) + ONE
kusano 2b45e8
         IF( UNIT )
kusano 2b45e8
     $      A( J, J ) = ONE
kusano 2b45e8
   20 CONTINUE
kusano 2b45e8
*
kusano 2b45e8
*     Store elements in array AS in data structure required by routine.
kusano 2b45e8
*
kusano 2b45e8
      IF( TYPE.EQ.'GE' )THEN
kusano 2b45e8
         DO 50 J = 1, N
kusano 2b45e8
            DO 30 I = 1, M
kusano 2b45e8
               AA( I + ( J - 1 )*LDA ) = A( I, J )
kusano 2b45e8
   30       CONTINUE
kusano 2b45e8
            DO 40 I = M + 1, LDA
kusano 2b45e8
               AA( I + ( J - 1 )*LDA ) = ROGUE
kusano 2b45e8
   40       CONTINUE
kusano 2b45e8
   50    CONTINUE
kusano 2b45e8
      ELSE IF( TYPE.EQ.'GB' )THEN
kusano 2b45e8
         DO 90 J = 1, N
kusano 2b45e8
            DO 60 I1 = 1, KU + 1 - J
kusano 2b45e8
               AA( I1 + ( J - 1 )*LDA ) = ROGUE
kusano 2b45e8
   60       CONTINUE
kusano 2b45e8
            DO 70 I2 = I1, MIN( KL + KU + 1, KU + 1 + M - J )
kusano 2b45e8
               AA( I2 + ( J - 1 )*LDA ) = A( I2 + J - KU - 1, J )
kusano 2b45e8
   70       CONTINUE
kusano 2b45e8
            DO 80 I3 = I2, LDA
kusano 2b45e8
               AA( I3 + ( J - 1 )*LDA ) = ROGUE
kusano 2b45e8
   80       CONTINUE
kusano 2b45e8
   90    CONTINUE
kusano 2b45e8
      ELSE IF( TYPE.EQ.'HE'.OR.TYPE.EQ.'TR' )THEN
kusano 2b45e8
         DO 130 J = 1, N
kusano 2b45e8
            IF( UPPER )THEN
kusano 2b45e8
               IBEG = 1
kusano 2b45e8
               IF( UNIT )THEN
kusano 2b45e8
                  IEND = J - 1
kusano 2b45e8
               ELSE
kusano 2b45e8
                  IEND = J
kusano 2b45e8
               END IF
kusano 2b45e8
            ELSE
kusano 2b45e8
               IF( UNIT )THEN
kusano 2b45e8
                  IBEG = J + 1
kusano 2b45e8
               ELSE
kusano 2b45e8
                  IBEG = J
kusano 2b45e8
               END IF
kusano 2b45e8
               IEND = N
kusano 2b45e8
            END IF
kusano 2b45e8
            DO 100 I = 1, IBEG - 1
kusano 2b45e8
               AA( I + ( J - 1 )*LDA ) = ROGUE
kusano 2b45e8
  100       CONTINUE
kusano 2b45e8
            DO 110 I = IBEG, IEND
kusano 2b45e8
               AA( I + ( J - 1 )*LDA ) = A( I, J )
kusano 2b45e8
  110       CONTINUE
kusano 2b45e8
            DO 120 I = IEND + 1, LDA
kusano 2b45e8
               AA( I + ( J - 1 )*LDA ) = ROGUE
kusano 2b45e8
  120       CONTINUE
kusano 2b45e8
            IF( SYM )THEN
kusano 2b45e8
               JJ = J + ( J - 1 )*LDA
kusano 2b45e8
               AA( JJ ) = DCMPLX( DBLE( AA( JJ ) ), RROGUE )
kusano 2b45e8
            END IF
kusano 2b45e8
  130    CONTINUE
kusano 2b45e8
      ELSE IF( TYPE.EQ.'HB'.OR.TYPE.EQ.'TB' )THEN
kusano 2b45e8
         DO 170 J = 1, N
kusano 2b45e8
            IF( UPPER )THEN
kusano 2b45e8
               KK = KL + 1
kusano 2b45e8
               IBEG = MAX( 1, KL + 2 - J )
kusano 2b45e8
               IF( UNIT )THEN
kusano 2b45e8
                  IEND = KL
kusano 2b45e8
               ELSE
kusano 2b45e8
                  IEND = KL + 1
kusano 2b45e8
               END IF
kusano 2b45e8
            ELSE
kusano 2b45e8
               KK = 1
kusano 2b45e8
               IF( UNIT )THEN
kusano 2b45e8
                  IBEG = 2
kusano 2b45e8
               ELSE
kusano 2b45e8
                  IBEG = 1
kusano 2b45e8
               END IF
kusano 2b45e8
               IEND = MIN( KL + 1, 1 + M - J )
kusano 2b45e8
            END IF
kusano 2b45e8
            DO 140 I = 1, IBEG - 1
kusano 2b45e8
               AA( I + ( J - 1 )*LDA ) = ROGUE
kusano 2b45e8
  140       CONTINUE
kusano 2b45e8
            DO 150 I = IBEG, IEND
kusano 2b45e8
               AA( I + ( J - 1 )*LDA ) = A( I + J - KK, J )
kusano 2b45e8
  150       CONTINUE
kusano 2b45e8
            DO 160 I = IEND + 1, LDA
kusano 2b45e8
               AA( I + ( J - 1 )*LDA ) = ROGUE
kusano 2b45e8
  160       CONTINUE
kusano 2b45e8
            IF( SYM )THEN
kusano 2b45e8
               JJ = KK + ( J - 1 )*LDA
kusano 2b45e8
               AA( JJ ) = DCMPLX( DBLE( AA( JJ ) ), RROGUE )
kusano 2b45e8
            END IF
kusano 2b45e8
  170    CONTINUE
kusano 2b45e8
      ELSE IF( TYPE.EQ.'HP'.OR.TYPE.EQ.'TP' )THEN
kusano 2b45e8
         IOFF = 0
kusano 2b45e8
         DO 190 J = 1, N
kusano 2b45e8
            IF( UPPER )THEN
kusano 2b45e8
               IBEG = 1
kusano 2b45e8
               IEND = J
kusano 2b45e8
            ELSE
kusano 2b45e8
               IBEG = J
kusano 2b45e8
               IEND = N
kusano 2b45e8
            END IF
kusano 2b45e8
            DO 180 I = IBEG, IEND
kusano 2b45e8
               IOFF = IOFF + 1
kusano 2b45e8
               AA( IOFF ) = A( I, J )
kusano 2b45e8
               IF( I.EQ.J )THEN
kusano 2b45e8
                  IF( UNIT )
kusano 2b45e8
     $               AA( IOFF ) = ROGUE
kusano 2b45e8
                  IF( SYM )
kusano 2b45e8
     $               AA( IOFF ) = DCMPLX( DBLE( AA( IOFF ) ), RROGUE )
kusano 2b45e8
               END IF
kusano 2b45e8
  180       CONTINUE
kusano 2b45e8
  190    CONTINUE
kusano 2b45e8
      END IF
kusano 2b45e8
      RETURN
kusano 2b45e8
*
kusano 2b45e8
*     End of ZMAKE.
kusano 2b45e8
*
kusano 2b45e8
      END
kusano 2b45e8
      SUBROUTINE ZMVCH( TRANS, M, N, ALPHA, A, NMAX, X, INCX, BETA, Y,
kusano 2b45e8
     $                  INCY, YT, G, YY, EPS, ERR, FATAL, NOUT, MV )
kusano 2b45e8
*
kusano 2b45e8
*  Checks the results of the computational tests.
kusano 2b45e8
*
kusano 2b45e8
*  Auxiliary routine for test program for Level 2 Blas.
kusano 2b45e8
*
kusano 2b45e8
*  -- Written on 10-August-1987.
kusano 2b45e8
*     Richard Hanson, Sandia National Labs.
kusano 2b45e8
*     Jeremy Du Croz, NAG Central Office.
kusano 2b45e8
*
kusano 2b45e8
*     .. Parameters ..
kusano 2b45e8
      COMPLEX*16         ZERO
kusano 2b45e8
      PARAMETER          ( ZERO = ( 0.0D0, 0.0D0 ) )
kusano 2b45e8
      DOUBLE PRECISION   RZERO, RONE
kusano 2b45e8
      PARAMETER          ( RZERO = 0.0D0, RONE = 1.0D0 )
kusano 2b45e8
*     .. Scalar Arguments ..
kusano 2b45e8
      COMPLEX*16         ALPHA, BETA
kusano 2b45e8
      DOUBLE PRECISION   EPS, ERR
kusano 2b45e8
      INTEGER            INCX, INCY, M, N, NMAX, NOUT
kusano 2b45e8
      LOGICAL            FATAL, MV
kusano 2b45e8
      CHARACTER*1        TRANS
kusano 2b45e8
*     .. Array Arguments ..
kusano 2b45e8
      COMPLEX*16         A( NMAX, * ), X( * ), Y( * ), YT( * ), YY( * )
kusano 2b45e8
      DOUBLE PRECISION   G( * )
kusano 2b45e8
*     .. Local Scalars ..
kusano 2b45e8
      COMPLEX*16         C
kusano 2b45e8
      DOUBLE PRECISION   ERRI
kusano 2b45e8
      INTEGER            I, INCXL, INCYL, IY, J, JX, KX, KY, ML, NL
kusano 2b45e8
      LOGICAL            CTRAN, TRAN
kusano 2b45e8
*     .. Intrinsic Functions ..
kusano 2b45e8
      INTRINSIC          ABS, DBLE, DCONJG, DIMAG, MAX, SQRT
kusano 2b45e8
*     .. Statement Functions ..
kusano 2b45e8
      DOUBLE PRECISION   ABS1
kusano 2b45e8
*     .. Statement Function definitions ..
kusano 2b45e8
      ABS1( C ) = ABS( DBLE( C ) ) + ABS( DIMAG( C ) )
kusano 2b45e8
*     .. Executable Statements ..
kusano 2b45e8
      TRAN = TRANS.EQ.'T'
kusano 2b45e8
      CTRAN = TRANS.EQ.'C'
kusano 2b45e8
      IF( TRAN.OR.CTRAN )THEN
kusano 2b45e8
         ML = N
kusano 2b45e8
         NL = M
kusano 2b45e8
      ELSE
kusano 2b45e8
         ML = M
kusano 2b45e8
         NL = N
kusano 2b45e8
      END IF
kusano 2b45e8
      IF( INCX.LT.0 )THEN
kusano 2b45e8
         KX = NL
kusano 2b45e8
         INCXL = -1
kusano 2b45e8
      ELSE
kusano 2b45e8
         KX = 1
kusano 2b45e8
         INCXL = 1
kusano 2b45e8
      END IF
kusano 2b45e8
      IF( INCY.LT.0 )THEN
kusano 2b45e8
         KY = ML
kusano 2b45e8
         INCYL = -1
kusano 2b45e8
      ELSE
kusano 2b45e8
         KY = 1
kusano 2b45e8
         INCYL = 1
kusano 2b45e8
      END IF
kusano 2b45e8
*
kusano 2b45e8
*     Compute expected result in YT using data in A, X and Y.
kusano 2b45e8
*     Compute gauges in G.
kusano 2b45e8
*
kusano 2b45e8
      IY = KY
kusano 2b45e8
      DO 40 I = 1, ML
kusano 2b45e8
         YT( IY ) = ZERO
kusano 2b45e8
         G( IY ) = RZERO
kusano 2b45e8
         JX = KX
kusano 2b45e8
         IF( TRAN )THEN
kusano 2b45e8
            DO 10 J = 1, NL
kusano 2b45e8
               YT( IY ) = YT( IY ) + A( J, I )*X( JX )
kusano 2b45e8
               G( IY ) = G( IY ) + ABS1( A( J, I ) )*ABS1( X( JX ) )
kusano 2b45e8
               JX = JX + INCXL
kusano 2b45e8
   10       CONTINUE
kusano 2b45e8
         ELSE IF( CTRAN )THEN
kusano 2b45e8
            DO 20 J = 1, NL
kusano 2b45e8
               YT( IY ) = YT( IY ) + DCONJG( A( J, I ) )*X( JX )
kusano 2b45e8
               G( IY ) = G( IY ) + ABS1( A( J, I ) )*ABS1( X( JX ) )
kusano 2b45e8
               JX = JX + INCXL
kusano 2b45e8
   20       CONTINUE
kusano 2b45e8
         ELSE
kusano 2b45e8
            DO 30 J = 1, NL
kusano 2b45e8
               YT( IY ) = YT( IY ) + A( I, J )*X( JX )
kusano 2b45e8
               G( IY ) = G( IY ) + ABS1( A( I, J ) )*ABS1( X( JX ) )
kusano 2b45e8
               JX = JX + INCXL
kusano 2b45e8
   30       CONTINUE
kusano 2b45e8
         END IF
kusano 2b45e8
         YT( IY ) = ALPHA*YT( IY ) + BETA*Y( IY )
kusano 2b45e8
         G( IY ) = ABS1( ALPHA )*G( IY ) + ABS1( BETA )*ABS1( Y( IY ) )
kusano 2b45e8
         IY = IY + INCYL
kusano 2b45e8
   40 CONTINUE
kusano 2b45e8
*
kusano 2b45e8
*     Compute the error ratio for this result.
kusano 2b45e8
*
kusano 2b45e8
      ERR = ZERO
kusano 2b45e8
      DO 50 I = 1, ML
kusano 2b45e8
         ERRI = ABS( YT( I ) - YY( 1 + ( I - 1 )*ABS( INCY ) ) )/EPS
kusano 2b45e8
         IF( G( I ).NE.RZERO )
kusano 2b45e8
     $      ERRI = ERRI/G( I )
kusano 2b45e8
         ERR = MAX( ERR, ERRI )
kusano 2b45e8
         IF( ERR*SQRT( EPS ).GE.RONE )
kusano 2b45e8
     $      GO TO 60
kusano 2b45e8
   50 CONTINUE
kusano 2b45e8
*     If the loop completes, all results are at least half accurate.
kusano 2b45e8
      GO TO 80
kusano 2b45e8
*
kusano 2b45e8
*     Report fatal error.
kusano 2b45e8
*
kusano 2b45e8
   60 FATAL = .TRUE.
kusano 2b45e8
      WRITE( NOUT, FMT = 9999 )
kusano 2b45e8
      DO 70 I = 1, ML
kusano 2b45e8
         IF( MV )THEN
kusano 2b45e8
            WRITE( NOUT, FMT = 9998 )I, YT( I ),
kusano 2b45e8
     $         YY( 1 + ( I - 1 )*ABS( INCY ) )
kusano 2b45e8
         ELSE
kusano 2b45e8
            WRITE( NOUT, FMT = 9998 )I,
kusano 2b45e8
     $         YY( 1 + ( I - 1 )*ABS( INCY ) ), YT( I )
kusano 2b45e8
         END IF
kusano 2b45e8
   70 CONTINUE
kusano 2b45e8
*
kusano 2b45e8
   80 CONTINUE
kusano 2b45e8
      RETURN
kusano 2b45e8
*
kusano 2b45e8
 9999 FORMAT( ' ******* FATAL ERROR - COMPUTED RESULT IS LESS THAN HAL',
kusano 2b45e8
     $      'F ACCURATE *******', /'                       EXPECTED RE',
kusano 2b45e8
     $      'SULT                    COMPUTED RESULT' )
kusano 2b45e8
 9998 FORMAT( 1X, I7, 2( '  (', G15.6, ',', G15.6, ')' ) )
kusano 2b45e8
*
kusano 2b45e8
*     End of ZMVCH.
kusano 2b45e8
*
kusano 2b45e8
      END
kusano 2b45e8
      LOGICAL FUNCTION LZE( RI, RJ, LR )
kusano 2b45e8
*
kusano 2b45e8
*  Tests if two arrays are identical.
kusano 2b45e8
*
kusano 2b45e8
*  Auxiliary routine for test program for Level 2 Blas.
kusano 2b45e8
*
kusano 2b45e8
*  -- Written on 10-August-1987.
kusano 2b45e8
*     Richard Hanson, Sandia National Labs.
kusano 2b45e8
*     Jeremy Du Croz, NAG Central Office.
kusano 2b45e8
*
kusano 2b45e8
*     .. Scalar Arguments ..
kusano 2b45e8
      INTEGER            LR
kusano 2b45e8
*     .. Array Arguments ..
kusano 2b45e8
      COMPLEX*16         RI( * ), RJ( * )
kusano 2b45e8
*     .. Local Scalars ..
kusano 2b45e8
      INTEGER            I
kusano 2b45e8
*     .. Executable Statements ..
kusano 2b45e8
      DO 10 I = 1, LR
kusano 2b45e8
         IF( RI( I ).NE.RJ( I ) )
kusano 2b45e8
     $      GO TO 20
kusano 2b45e8
   10 CONTINUE
kusano 2b45e8
      LZE = .TRUE.
kusano 2b45e8
      GO TO 30
kusano 2b45e8
   20 CONTINUE
kusano 2b45e8
      LZE = .FALSE.
kusano 2b45e8
   30 RETURN
kusano 2b45e8
*
kusano 2b45e8
*     End of LZE.
kusano 2b45e8
*
kusano 2b45e8
      END
kusano 2b45e8
      LOGICAL FUNCTION LZERES( TYPE, UPLO, M, N, AA, AS, LDA )
kusano 2b45e8
*
kusano 2b45e8
*  Tests if selected elements in two arrays are equal.
kusano 2b45e8
*
kusano 2b45e8
*  TYPE is 'GE', 'HE' or 'HP'.
kusano 2b45e8
*
kusano 2b45e8
*  Auxiliary routine for test program for Level 2 Blas.
kusano 2b45e8
*
kusano 2b45e8
*  -- Written on 10-August-1987.
kusano 2b45e8
*     Richard Hanson, Sandia National Labs.
kusano 2b45e8
*     Jeremy Du Croz, NAG Central Office.
kusano 2b45e8
*
kusano 2b45e8
*     .. Scalar Arguments ..
kusano 2b45e8
      INTEGER            LDA, M, N
kusano 2b45e8
      CHARACTER*1        UPLO
kusano 2b45e8
      CHARACTER*2        TYPE
kusano 2b45e8
*     .. Array Arguments ..
kusano 2b45e8
      COMPLEX*16         AA( LDA, * ), AS( LDA, * )
kusano 2b45e8
*     .. Local Scalars ..
kusano 2b45e8
      INTEGER            I, IBEG, IEND, J
kusano 2b45e8
      LOGICAL            UPPER
kusano 2b45e8
*     .. Executable Statements ..
kusano 2b45e8
      UPPER = UPLO.EQ.'U'
kusano 2b45e8
      IF( TYPE.EQ.'GE' )THEN
kusano 2b45e8
         DO 20 J = 1, N
kusano 2b45e8
            DO 10 I = M + 1, LDA
kusano 2b45e8
               IF( AA( I, J ).NE.AS( I, J ) )
kusano 2b45e8
     $            GO TO 70
kusano 2b45e8
   10       CONTINUE
kusano 2b45e8
   20    CONTINUE
kusano 2b45e8
      ELSE IF( TYPE.EQ.'HE' )THEN
kusano 2b45e8
         DO 50 J = 1, N
kusano 2b45e8
            IF( UPPER )THEN
kusano 2b45e8
               IBEG = 1
kusano 2b45e8
               IEND = J
kusano 2b45e8
            ELSE
kusano 2b45e8
               IBEG = J
kusano 2b45e8
               IEND = N
kusano 2b45e8
            END IF
kusano 2b45e8
            DO 30 I = 1, IBEG - 1
kusano 2b45e8
               IF( AA( I, J ).NE.AS( I, J ) )
kusano 2b45e8
     $            GO TO 70
kusano 2b45e8
   30       CONTINUE
kusano 2b45e8
            DO 40 I = IEND + 1, LDA
kusano 2b45e8
               IF( AA( I, J ).NE.AS( I, J ) )
kusano 2b45e8
     $            GO TO 70
kusano 2b45e8
   40       CONTINUE
kusano 2b45e8
   50    CONTINUE
kusano 2b45e8
      END IF
kusano 2b45e8
*
kusano 2b45e8
   60 CONTINUE
kusano 2b45e8
      LZERES = .TRUE.
kusano 2b45e8
      GO TO 80
kusano 2b45e8
   70 CONTINUE
kusano 2b45e8
      LZERES = .FALSE.
kusano 2b45e8
   80 RETURN
kusano 2b45e8
*
kusano 2b45e8
*     End of LZERES.
kusano 2b45e8
*
kusano 2b45e8
      END
kusano 2b45e8
      COMPLEX*16 FUNCTION ZBEG( RESET )
kusano 2b45e8
*
kusano 2b45e8
*  Generates complex numbers as pairs of random numbers uniformly
kusano 2b45e8
*  distributed between -0.5 and 0.5.
kusano 2b45e8
*
kusano 2b45e8
*  Auxiliary routine for test program for Level 2 Blas.
kusano 2b45e8
*
kusano 2b45e8
*  -- Written on 10-August-1987.
kusano 2b45e8
*     Richard Hanson, Sandia National Labs.
kusano 2b45e8
*     Jeremy Du Croz, NAG Central Office.
kusano 2b45e8
*
kusano 2b45e8
*     .. Scalar Arguments ..
kusano 2b45e8
      LOGICAL            RESET
kusano 2b45e8
*     .. Local Scalars ..
kusano 2b45e8
      INTEGER            I, IC, J, MI, MJ
kusano 2b45e8
*     .. Save statement ..
kusano 2b45e8
      SAVE               I, IC, J, MI, MJ
kusano 2b45e8
*     .. Intrinsic Functions ..
kusano 2b45e8
      INTRINSIC          DCMPLX
kusano 2b45e8
*     .. Executable Statements ..
kusano 2b45e8
      IF( RESET )THEN
kusano 2b45e8
*        Initialize local variables.
kusano 2b45e8
         MI = 891
kusano 2b45e8
         MJ = 457
kusano 2b45e8
         I = 7
kusano 2b45e8
         J = 7
kusano 2b45e8
         IC = 0
kusano 2b45e8
         RESET = .FALSE.
kusano 2b45e8
      END IF
kusano 2b45e8
*
kusano 2b45e8
*     The sequence of values of I or J is bounded between 1 and 999.
kusano 2b45e8
*     If initial I or J = 1,2,3,6,7 or 9, the period will be 50.
kusano 2b45e8
*     If initial I or J = 4 or 8, the period will be 25.
kusano 2b45e8
*     If initial I or J = 5, the period will be 10.
kusano 2b45e8
*     IC is used to break up the period by skipping 1 value of I or J
kusano 2b45e8
*     in 6.
kusano 2b45e8
*
kusano 2b45e8
      IC = IC + 1
kusano 2b45e8
   10 I = I*MI
kusano 2b45e8
      J = J*MJ
kusano 2b45e8
      I = I - 1000*( I/1000 )
kusano 2b45e8
      J = J - 1000*( J/1000 )
kusano 2b45e8
      IF( IC.GE.5 )THEN
kusano 2b45e8
         IC = 0
kusano 2b45e8
         GO TO 10
kusano 2b45e8
      END IF
kusano 2b45e8
      ZBEG = DCMPLX( ( I - 500 )/1001.0D0, ( J - 500 )/1001.0D0 )
kusano 2b45e8
      RETURN
kusano 2b45e8
*
kusano 2b45e8
*     End of ZBEG.
kusano 2b45e8
*
kusano 2b45e8
      END
kusano 2b45e8
      DOUBLE PRECISION FUNCTION DDIFF( X, Y )
kusano 2b45e8
*
kusano 2b45e8
*  Auxiliary routine for test program for Level 2 Blas.
kusano 2b45e8
*
kusano 2b45e8
*  -- Written on 10-August-1987.
kusano 2b45e8
*     Richard Hanson, Sandia National Labs.
kusano 2b45e8
*
kusano 2b45e8
*     .. Scalar Arguments ..
kusano 2b45e8
      DOUBLE PRECISION   X, Y
kusano 2b45e8
*     .. Executable Statements ..
kusano 2b45e8
      DDIFF = X - Y
kusano 2b45e8
      RETURN
kusano 2b45e8
*
kusano 2b45e8
*     End of DDIFF.
kusano 2b45e8
*
kusano 2b45e8
      END
kusano 2b45e8
      SUBROUTINE CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )
kusano 2b45e8
*
kusano 2b45e8
*  Tests whether XERBLA has detected an error when it should.
kusano 2b45e8
*
kusano 2b45e8
*  Auxiliary routine for test program for Level 2 Blas.
kusano 2b45e8
*
kusano 2b45e8
*  -- Written on 10-August-1987.
kusano 2b45e8
*     Richard Hanson, Sandia National Labs.
kusano 2b45e8
*     Jeremy Du Croz, NAG Central Office.
kusano 2b45e8
*
kusano 2b45e8
*     .. Scalar Arguments ..
kusano 2b45e8
      INTEGER            INFOT, NOUT
kusano 2b45e8
      LOGICAL            LERR, OK
kusano 2b45e8
      CHARACTER*6        SRNAMT
kusano 2b45e8
*     .. Executable Statements ..
kusano 2b45e8
      IF( .NOT.LERR )THEN
kusano 2b45e8
         WRITE( NOUT, FMT = 9999 )INFOT, SRNAMT
kusano 2b45e8
         OK = .FALSE.
kusano 2b45e8
      END IF
kusano 2b45e8
      LERR = .FALSE.
kusano 2b45e8
      RETURN
kusano 2b45e8
*
kusano 2b45e8
 9999 FORMAT( ' ***** ILLEGAL VALUE OF PARAMETER NUMBER ', I2, ' NOT D',
kusano 2b45e8
     $      'ETECTED BY ', A6, ' *****' )
kusano 2b45e8
*
kusano 2b45e8
*     End of CHKXER.
kusano 2b45e8
*
kusano 2b45e8
      END
kusano 2b45e8
      SUBROUTINE XERBLA( SRNAME, INFO )
kusano 2b45e8
*
kusano 2b45e8
*  This is a special version of XERBLA to be used only as part of
kusano 2b45e8
*  the test program for testing error exits from the Level 2 BLAS
kusano 2b45e8
*  routines.
kusano 2b45e8
*
kusano 2b45e8
*  XERBLA  is an error handler for the Level 2 BLAS routines.
kusano 2b45e8
*
kusano 2b45e8
*  It is called by the Level 2 BLAS routines if an input parameter is
kusano 2b45e8
*  invalid.
kusano 2b45e8
*
kusano 2b45e8
*  Auxiliary routine for test program for Level 2 Blas.
kusano 2b45e8
*
kusano 2b45e8
*  -- Written on 10-August-1987.
kusano 2b45e8
*     Richard Hanson, Sandia National Labs.
kusano 2b45e8
*     Jeremy Du Croz, NAG Central Office.
kusano 2b45e8
*
kusano 2b45e8
*     .. Scalar Arguments ..
kusano 2b45e8
      INTEGER            INFO
kusano 2b45e8
      CHARACTER*6        SRNAME
kusano 2b45e8
*     .. Scalars in Common ..
kusano 2b45e8
      INTEGER            INFOT, NOUT
kusano 2b45e8
      LOGICAL            LERR, OK
kusano 2b45e8
      CHARACTER*6        SRNAMT
kusano 2b45e8
*     .. Common blocks ..
kusano 2b45e8
      COMMON             /INFOC/INFOT, NOUT, OK, LERR
kusano 2b45e8
      COMMON             /SRNAMC/SRNAMT
kusano 2b45e8
*     .. Executable Statements ..
kusano 2b45e8
      LERR = .TRUE.
kusano 2b45e8
      IF( INFO.NE.INFOT )THEN
kusano 2b45e8
         IF( INFOT.NE.0 )THEN
kusano 2b45e8
            WRITE( NOUT, FMT = 9999 )INFO, INFOT
kusano 2b45e8
         ELSE
kusano 2b45e8
            WRITE( NOUT, FMT = 9997 )INFO
kusano 2b45e8
         END IF
kusano 2b45e8
         OK = .FALSE.
kusano 2b45e8
      END IF
kusano 2b45e8
      IF( SRNAME.NE.SRNAMT )THEN
kusano 2b45e8
         WRITE( NOUT, FMT = 9998 )SRNAME, SRNAMT
kusano 2b45e8
         OK = .FALSE.
kusano 2b45e8
      END IF
kusano 2b45e8
      RETURN
kusano 2b45e8
*
kusano 2b45e8
 9999 FORMAT( ' ******* XERBLA WAS CALLED WITH INFO = ', I6, ' INSTEAD',
kusano 2b45e8
     $      ' OF ', I2, ' *******' )
kusano 2b45e8
 9998 FORMAT( ' ******* XERBLA WAS CALLED WITH SRNAME = ', A6, ' INSTE',
kusano 2b45e8
     $      'AD OF ', A6, ' *******' )
kusano 2b45e8
 9997 FORMAT( ' ******* XERBLA WAS CALLED WITH INFO = ', I6,
kusano 2b45e8
     $      ' *******' )
kusano 2b45e8
*
kusano 2b45e8
*     End of XERBLA
kusano 2b45e8
*
kusano 2b45e8
      END
kusano 2b45e8