kusano 2b45e8
      PROGRAM CBLAT2
kusano 2b45e8
*
kusano 2b45e8
*  Test program for the COMPLEX          Level 2 Blas.
kusano 2b45e8
*
kusano 2b45e8
*  The program must be driven by a short data file. The first 17 records
kusano 2b45e8
*  of the file are read using list-directed input, the last 17 records
kusano 2b45e8
*  are read using the format ( A12, L2 ). An annotated example of a data
kusano 2b45e8
*  file can be obtained by deleting the first 3 characters from the
kusano 2b45e8
*  following 34 lines:
kusano 2b45e8
*  'CBLAT2.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
*  2        0 TO TEST COLUMN-MAJOR, 1 TO TEST ROW-MAJOR, 2 TO TEST BOTH
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
*  cblas_cgemv  T PUT F FOR NO TEST. SAME COLUMNS.
kusano 2b45e8
*  cblas_cgbmv  T PUT F FOR NO TEST. SAME COLUMNS.
kusano 2b45e8
*  cblas_chemv  T PUT F FOR NO TEST. SAME COLUMNS.
kusano 2b45e8
*  cblas_chbmv  T PUT F FOR NO TEST. SAME COLUMNS.
kusano 2b45e8
*  cblas_chpmv  T PUT F FOR NO TEST. SAME COLUMNS.
kusano 2b45e8
*  cblas_ctrmv  T PUT F FOR NO TEST. SAME COLUMNS.
kusano 2b45e8
*  cblas_ctbmv  T PUT F FOR NO TEST. SAME COLUMNS.
kusano 2b45e8
*  cblas_ctpmv  T PUT F FOR NO TEST. SAME COLUMNS.
kusano 2b45e8
*  cblas_ctrsv  T PUT F FOR NO TEST. SAME COLUMNS.
kusano 2b45e8
*  cblas_ctbsv  T PUT F FOR NO TEST. SAME COLUMNS.
kusano 2b45e8
*  cblas_ctpsv  T PUT F FOR NO TEST. SAME COLUMNS.
kusano 2b45e8
*  cblas_cgerc  T PUT F FOR NO TEST. SAME COLUMNS.
kusano 2b45e8
*  cblas_cgeru  T PUT F FOR NO TEST. SAME COLUMNS.
kusano 2b45e8
*  cblas_cher   T PUT F FOR NO TEST. SAME COLUMNS.
kusano 2b45e8
*  cblas_chpr   T PUT F FOR NO TEST. SAME COLUMNS.
kusano 2b45e8
*  cblas_cher2  T PUT F FOR NO TEST. SAME COLUMNS.
kusano 2b45e8
*  cblas_chpr2  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, NOUT
kusano 2b45e8
      PARAMETER          ( NIN = 5, NOUT = 6 )
kusano 2b45e8
      INTEGER            NSUBS
kusano 2b45e8
      PARAMETER          ( NSUBS = 17 )
kusano 2b45e8
      COMPLEX            ZERO, ONE
kusano 2b45e8
      PARAMETER          ( ZERO = ( 0.0, 0.0 ), ONE = ( 1.0, 0.0 ) )
kusano 2b45e8
      REAL               RZERO, RHALF, RONE
kusano 2b45e8
      PARAMETER          ( RZERO = 0.0, RHALF = 0.5, RONE = 1.0 )
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
      REAL               EPS, ERR, THRESH
kusano 2b45e8
      INTEGER            I, ISNUM, J, N, NALF, NBET, NIDIM, NINC, NKB,
kusano 2b45e8
     $                   NTRA, LAYOUT
kusano 2b45e8
      LOGICAL            FATAL, LTESTT, REWI, SAME, SFATAL, TRACE,
kusano 2b45e8
     $                   TSTERR, CORDER, RORDER
kusano 2b45e8
      CHARACTER*1        TRANS
kusano 2b45e8
      CHARACTER*12       SNAMET
kusano 2b45e8
      CHARACTER*32       SNAPS
kusano 2b45e8
*     .. Local Arrays ..
kusano 2b45e8
      COMPLEX            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
      REAL               G( NMAX )
kusano 2b45e8
      INTEGER            IDIM( NIDMAX ), INC( NINMAX ), KB( NKBMAX )
kusano 2b45e8
      LOGICAL            LTEST( NSUBS )
kusano 2b45e8
      CHARACTER*12       SNAMES( NSUBS )
kusano 2b45e8
*     .. External Functions ..
kusano 2b45e8
      REAL               SDIFF
kusano 2b45e8
      LOGICAL            LCE
kusano 2b45e8
      EXTERNAL           SDIFF, LCE
kusano 2b45e8
*     .. External Subroutines ..
kusano 2b45e8
      EXTERNAL           CCHK1, CCHK2, CCHK3, CCHK4, CCHK5, CCHK6,
kusano 2b45e8
     $                   CC2CHKE, CMVCH
kusano 2b45e8
*     .. Intrinsic Functions ..
kusano 2b45e8
      INTRINSIC          ABS, MAX, MIN
kusano 2b45e8
*     .. Scalars in Common ..
kusano 2b45e8
      INTEGER            INFOT, NOUTC
kusano 2b45e8
      LOGICAL            OK
kusano 2b45e8
      CHARACTER*12       SRNAMT
kusano 2b45e8
*     .. Common blocks ..
kusano 2b45e8
      COMMON             /INFOC/INFOT, NOUTC, OK
kusano 2b45e8
      COMMON             /SRNAMC/SRNAMT
kusano 2b45e8
*     .. Data statements ..
kusano 2b45e8
      DATA               SNAMES/'cblas_cgemv ', 'cblas_cgbmv ',
kusano 2b45e8
     $                   'cblas_chemv ','cblas_chbmv ','cblas_chpmv ',
kusano 2b45e8
     $                   'cblas_ctrmv ','cblas_ctbmv ','cblas_ctpmv ',
kusano 2b45e8
     $                   'cblas_ctrsv ','cblas_ctbsv ','cblas_ctpsv ',
kusano 2b45e8
     $                   'cblas_cgerc ','cblas_cgeru ','cblas_cher  ',
kusano 2b45e8
     $                   'cblas_chpr  ','cblas_cher2 ','cblas_chpr2 '/
kusano 2b45e8
*     .. Executable Statements ..
kusano 2b45e8
*
kusano 2b45e8
      NOUTC = NOUT
kusano 2b45e8
*
kusano 2b45e8
*     Read name and unit number for summary 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 )
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 flag that indicates whether row-major data layout to be tested.
kusano 2b45e8
      READ( NIN, FMT = * )LAYOUT
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
      RORDER = .FALSE.
kusano 2b45e8
      CORDER = .FALSE.
kusano 2b45e8
      IF (LAYOUT.EQ.2) THEN
kusano 2b45e8
         RORDER = .TRUE.
kusano 2b45e8
         CORDER = .TRUE.
kusano 2b45e8
         WRITE( *, FMT = 10002 )
kusano 2b45e8
      ELSE IF (LAYOUT.EQ.1) THEN
kusano 2b45e8
         RORDER = .TRUE.
kusano 2b45e8
         WRITE( *, FMT = 10001 )
kusano 2b45e8
      ELSE IF (LAYOUT.EQ.0) THEN
kusano 2b45e8
         CORDER = .TRUE.
kusano 2b45e8
         WRITE( *, FMT = 10000 )
kusano 2b45e8
      END IF
kusano 2b45e8
      WRITE( *, 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( SDIFF( 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 CMVCH 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 CMVCH YT holds
kusano 2b45e8
*     the result computed by CMVCH.
kusano 2b45e8
      TRANS = 'N'
kusano 2b45e8
      CALL CMVCH( TRANS, N, N, ONE, A, NMAX, X, 1, ZERO, Y, 1, YT, G,
kusano 2b45e8
     $            YY, EPS, ERR, FATAL, NOUT, .TRUE. )
kusano 2b45e8
      SAME = LCE( 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 CMVCH( TRANS, N, N, ONE, A, NMAX, X, -1, ZERO, Y, -1, YT, G,
kusano 2b45e8
     $            YY, EPS, ERR, FATAL, NOUT, .TRUE. )
kusano 2b45e8
      SAME = LCE( 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 CC2CHKE( SNAMES( ISNUM ) )
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 CGEMV, 01, and CGBMV, 02.
kusano 2b45e8
  140       IF (CORDER) THEN
kusano 2b45e8
            CALL CCHK1( 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, 0 )
kusano 2b45e8
            END IF
kusano 2b45e8
            IF (RORDER) THEN
kusano 2b45e8
            CALL CCHK1( 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, 1 )
kusano 2b45e8
            END IF
kusano 2b45e8
            GO TO 200
kusano 2b45e8
*           Test CHEMV, 03, CHBMV, 04, and CHPMV, 05.
kusano 2b45e8
  150      IF (CORDER) THEN
kusano 2b45e8
           CALL CCHK2( 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, 0 )
kusano 2b45e8
           END IF
kusano 2b45e8
           IF (RORDER) THEN
kusano 2b45e8
           CALL CCHK2( 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, 1 )
kusano 2b45e8
           END IF
kusano 2b45e8
            GO TO 200
kusano 2b45e8
*           Test CTRMV, 06, CTBMV, 07, CTPMV, 08,
kusano 2b45e8
*           CTRSV, 09, CTBSV, 10, and CTPSV, 11.
kusano 2b45e8
  160      IF (CORDER) THEN
kusano 2b45e8
           CALL CCHK3( 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
     $			0 )
kusano 2b45e8
           END IF
kusano 2b45e8
           IF (RORDER) THEN
kusano 2b45e8
           CALL CCHK3( 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
     $			1 )
kusano 2b45e8
           END IF
kusano 2b45e8
            GO TO 200
kusano 2b45e8
*           Test CGERC, 12, CGERU, 13.
kusano 2b45e8
  170      IF (CORDER) THEN
kusano 2b45e8
           CALL CCHK4( 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, 0 )
kusano 2b45e8
           END IF
kusano 2b45e8
           IF (RORDER) THEN
kusano 2b45e8
           CALL CCHK4( 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, 1 )
kusano 2b45e8
           END IF
kusano 2b45e8
            GO TO 200
kusano 2b45e8
*           Test CHER, 14, and CHPR, 15.
kusano 2b45e8
  180      IF (CORDER) THEN
kusano 2b45e8
           CALL CCHK5( 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, 0 )
kusano 2b45e8
           END IF
kusano 2b45e8
           IF (RORDER) THEN
kusano 2b45e8
           CALL CCHK5( 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, 1 )
kusano 2b45e8
           END IF
kusano 2b45e8
            GO TO 200
kusano 2b45e8
*           Test CHER2, 16, and CHPR2, 17.
kusano 2b45e8
  190      IF (CORDER) THEN
kusano 2b45e8
           CALL CCHK6( 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, 0 )
kusano 2b45e8
           END IF
kusano 2b45e8
           IF (RORDER) THEN
kusano 2b45e8
           CALL CCHK6( 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, 1 )
kusano 2b45e8
           END IF
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
10002 FORMAT( ' COLUMN-MAJOR AND ROW-MAJOR DATA LAYOUTS ARE TESTED' )
kusano 2b45e8
10001 FORMAT( ' ROW-MAJOR DATA LAYOUT IS TESTED' )
kusano 2b45e8
10000 FORMAT( ' COLUMN-MAJOR DATA LAYOUT IS TESTED' )
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, E9.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          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 ',A12, ' NOT RECOGNIZED', /' ******* T',
kusano 2b45e8
     $      'ESTS ABANDONED *******' )
kusano 2b45e8
 9985 FORMAT(' ERROR IN CMVCH -  IN-LINE DOT PRODUCTS ARE BEING EVALU',
kusano 2b45e8
     $      'ATED WRONGLY.', /' CMVCH 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(A12, L2 )
kusano 2b45e8
 9983 FORMAT( 1X,A12, ' 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 CBLAT2.
kusano 2b45e8
*
kusano 2b45e8
      END
kusano 2b45e8
      SUBROUTINE CCHK1( 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, IORDER )
kusano 2b45e8
*
kusano 2b45e8
*  Tests CGEMV and CGBMV.
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            ZERO, HALF
kusano 2b45e8
      PARAMETER          ( ZERO = ( 0.0, 0.0 ), HALF = ( 0.5, 0.0 ) )
kusano 2b45e8
      REAL               RZERO
kusano 2b45e8
      PARAMETER          ( RZERO = 0.0 )
kusano 2b45e8
*     .. Scalar Arguments ..
kusano 2b45e8
      REAL               EPS, THRESH
kusano 2b45e8
      INTEGER            INCMAX, NALF, NBET, NIDIM, NINC, NKB, NMAX,
kusano 2b45e8
     $                   NOUT, NTRA, IORDER
kusano 2b45e8
      LOGICAL            FATAL, REWI, TRACE
kusano 2b45e8
      CHARACTER*12       SNAME
kusano 2b45e8
*     .. Array Arguments ..
kusano 2b45e8
      COMPLEX            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
      REAL               G( NMAX )
kusano 2b45e8
      INTEGER            IDIM( NIDIM ), INC( NINC ), KB( NKB )
kusano 2b45e8
*     .. Local Scalars ..
kusano 2b45e8
      COMPLEX            ALPHA, ALS, BETA, BLS, TRANSL
kusano 2b45e8
      REAL               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*14       CTRANS
kusano 2b45e8
      CHARACTER*3        ICH
kusano 2b45e8
*     .. Local Arrays ..
kusano 2b45e8
      LOGICAL            ISAME( 13 )
kusano 2b45e8
*     .. External Functions ..
kusano 2b45e8
      LOGICAL            LCE, LCERES
kusano 2b45e8
      EXTERNAL           LCE, LCERES
kusano 2b45e8
*     .. External Subroutines ..
kusano 2b45e8
      EXTERNAL           CCGBMV, CCGEMV, CMAKE, CMVCH
kusano 2b45e8
*     .. Intrinsic Functions ..
kusano 2b45e8
      INTRINSIC          ABS, MAX, MIN
kusano 2b45e8
*     .. Scalars in Common ..
kusano 2b45e8
      INTEGER            INFOT, NOUTC
kusano 2b45e8
      LOGICAL            OK
kusano 2b45e8
*     .. Common blocks ..
kusano 2b45e8
      COMMON             /INFOC/INFOT, NOUTC, OK
kusano 2b45e8
*     .. Data statements ..
kusano 2b45e8
      DATA               ICH/'NTC'/
kusano 2b45e8
*     .. Executable Statements ..
kusano 2b45e8
      FULL = SNAME( 9: 9 ).EQ.'e'
kusano 2b45e8
      BANDED = SNAME( 9: 9 ).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 CMAKE( SNAME( 8: 9 ), ' ', ' ', 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
                  IF (TRANS.EQ.'N')THEN
kusano 2b45e8
                     CTRANS = '  CblasNoTrans'
kusano 2b45e8
                  ELSE IF (TRANS.EQ.'T')THEN
kusano 2b45e8
                     CTRANS = '    CblasTrans'
kusano 2b45e8
                  ELSE 
kusano 2b45e8
                     CTRANS = 'CblasConjTrans'
kusano 2b45e8
                  END IF
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 CMAKE( '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 CMAKE( '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
     $                             CTRANS, M, N, ALPHA, LDA, INCX, BETA,
kusano 2b45e8
     $                              INCY
kusano 2b45e8
                                 IF( REWI )
kusano 2b45e8
     $                              REWIND NTRA
kusano 2b45e8
                                 CALL CCGEMV( IORDER, TRANS, M, N,
kusano 2b45e8
     $                                      ALPHA, AA, LDA, XX, INCX,
kusano 2b45e8
     $                                      BETA, YY, INCY )
kusano 2b45e8
                              ELSE IF( BANDED )THEN
kusano 2b45e8
                                 IF( TRACE )
kusano 2b45e8
     $                              WRITE( NTRA, FMT = 9995 )NC, SNAME,
kusano 2b45e8
     $                              CTRANS, M, N, KL, KU, ALPHA, LDA,
kusano 2b45e8
     $                              INCX, BETA, INCY
kusano 2b45e8
                                 IF( REWI )
kusano 2b45e8
     $                              REWIND NTRA
kusano 2b45e8
                                 CALL CCGBMV( IORDER, TRANS, M, N, KL,
kusano 2b45e8
     $                                       KU, ALPHA, AA, LDA, XX,
kusano 2b45e8
     $                                       INCX, 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 = 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
*        IF(TRANS .NE. 'C' .OR. (INCX .GT. 0 .AND. INCY .GT. 0)) THEN 
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 ) = LCE( AS, AA, LAA )
kusano 2b45e8
                                 ISAME( 6 ) = LDAS.EQ.LDA
kusano 2b45e8
                                 ISAME( 7 ) = LCE( 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 ) = LCE( YS, YY, LY )
kusano 2b45e8
                                 ELSE
kusano 2b45e8
                                    ISAME( 10 ) = LCERES( '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 ) = LCE( AS, AA, LAA )
kusano 2b45e8
                                 ISAME( 8 ) = LDAS.EQ.LDA
kusano 2b45e8
                                 ISAME( 9 ) = LCE( 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 ) = LCE( YS, YY, LY )
kusano 2b45e8
                                 ELSE
kusano 2b45e8
                                    ISAME( 12 ) = LCERES( '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 CMVCH( 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
*                          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, CTRANS, M, N, ALPHA, LDA,
kusano 2b45e8
     $      INCX, BETA, INCY
kusano 2b45e8
      ELSE IF( BANDED )THEN
kusano 2b45e8
         WRITE( NOUT, FMT = 9995 )NC, SNAME, CTRANS, 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(' ',A12, ' 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(' ',A12, ' COMPLETED THE COMPUTATIONAL TESTS (', I6, ' C',
kusano 2b45e8
     $      'ALLS)', /' ******* BUT WITH MAXIMUM TEST RATIO', F8.2,
kusano 2b45e8
     $      ' - SUSPECT *******' )
kusano 2b45e8
 9996 FORMAT( ' ******* ',A12, ' FAILED ON CALL NUMBER:' )
kusano 2b45e8
 9995 FORMAT( 1X, I6, ': ',A12, '(', A14, ',', 4( I3, ',' ), '(',
kusano 2b45e8
     $      F4.1, ',', F4.1, '), A,',/ 10x, I3, ', X,', I2, ',(',
kusano 2b45e8
     $      F4.1, ',', F4.1, '), Y,', I2, ') .' )
kusano 2b45e8
 9994 FORMAT( 1X, I6, ': ',A12, '(', A14, ',', 2( I3, ',' ), '(',
kusano 2b45e8
     $      F4.1, ',', F4.1, '), A,',/ 10x, I3, ', X,', I2, ',(',
kusano 2b45e8
     $       F4.1, ',', F4.1, '), Y,', I2, ') .' )
kusano 2b45e8
 9993 FORMAT(' ******* FATAL ERROR - ERROR-EXIT TAKEN ON VALID CALL *',
kusano 2b45e8
     $      '******' )
kusano 2b45e8
*
kusano 2b45e8
*     End of CCHK1.
kusano 2b45e8
*
kusano 2b45e8
      END
kusano 2b45e8
      SUBROUTINE CCHK2( 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, IORDER )
kusano 2b45e8
*
kusano 2b45e8
*  Tests CHEMV, CHBMV and CHPMV.
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            ZERO, HALF
kusano 2b45e8
      PARAMETER          ( ZERO = ( 0.0, 0.0 ), HALF = ( 0.5, 0.0 ) )
kusano 2b45e8
      REAL               RZERO
kusano 2b45e8
      PARAMETER          ( RZERO = 0.0 )
kusano 2b45e8
*     .. Scalar Arguments ..
kusano 2b45e8
      REAL               EPS, THRESH
kusano 2b45e8
      INTEGER            INCMAX, NALF, NBET, NIDIM, NINC, NKB, NMAX,
kusano 2b45e8
     $                   NOUT, NTRA, IORDER
kusano 2b45e8
      LOGICAL            FATAL, REWI, TRACE
kusano 2b45e8
      CHARACTER*12       SNAME
kusano 2b45e8
*     .. Array Arguments ..
kusano 2b45e8
      COMPLEX            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
      REAL               G( NMAX )
kusano 2b45e8
      INTEGER            IDIM( NIDIM ), INC( NINC ), KB( NKB )
kusano 2b45e8
*     .. Local Scalars ..
kusano 2b45e8
      COMPLEX            ALPHA, ALS, BETA, BLS, TRANSL
kusano 2b45e8
      REAL               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*14       CUPLO
kusano 2b45e8
      CHARACTER*2        ICH
kusano 2b45e8
*     .. Local Arrays ..
kusano 2b45e8
      LOGICAL            ISAME( 13 )
kusano 2b45e8
*     .. External Functions ..
kusano 2b45e8
      LOGICAL            LCE, LCERES
kusano 2b45e8
      EXTERNAL           LCE, LCERES
kusano 2b45e8
*     .. External Subroutines ..
kusano 2b45e8
      EXTERNAL           CCHBMV, CCHEMV, CCHPMV, CMAKE, CMVCH
kusano 2b45e8
*     .. Intrinsic Functions ..
kusano 2b45e8
      INTRINSIC          ABS, MAX
kusano 2b45e8
*     .. Scalars in Common ..
kusano 2b45e8
      INTEGER            INFOT, NOUTC
kusano 2b45e8
      LOGICAL             OK
kusano 2b45e8
*     .. Common blocks ..
kusano 2b45e8
      COMMON             /INFOC/INFOT, NOUTC, OK
kusano 2b45e8
*     .. Data statements ..
kusano 2b45e8
      DATA               ICH/'UL'/
kusano 2b45e8
*     .. Executable Statements ..
kusano 2b45e8
      FULL = SNAME( 9: 9 ).EQ.'e'
kusano 2b45e8
      BANDED = SNAME( 9: 9 ).EQ.'b'
kusano 2b45e8
      PACKED = SNAME( 9: 9 ).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
               IF (UPLO.EQ.'U')THEN
kusano 2b45e8
                  CUPLO = '    CblasUpper'
kusano 2b45e8
               ELSE 
kusano 2b45e8
                  CUPLO = '    CblasLower'
kusano 2b45e8
               END IF
kusano 2b45e8
*
kusano 2b45e8
*              Generate the matrix A.
kusano 2b45e8
*
kusano 2b45e8
               TRANSL = ZERO
kusano 2b45e8
               CALL CMAKE( SNAME( 8: 9 ), 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 CMAKE( '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 CMAKE( '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
     $                           CUPLO, N, ALPHA, LDA, INCX, BETA, INCY
kusano 2b45e8
                              IF( REWI )
kusano 2b45e8
     $                           REWIND NTRA
kusano 2b45e8
                              CALL CCHEMV( IORDER, UPLO, 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 = 9994 )NC, SNAME,
kusano 2b45e8
     $                           CUPLO, N, K, ALPHA, LDA, INCX, BETA,
kusano 2b45e8
     $                           INCY
kusano 2b45e8
                              IF( REWI )
kusano 2b45e8
     $                           REWIND NTRA
kusano 2b45e8
                              CALL CCHBMV( IORDER, UPLO, N, K, ALPHA,
kusano 2b45e8
     $                                    AA, LDA, XX, INCX, BETA,
kusano 2b45e8
     $                                    YY, INCY )
kusano 2b45e8
                           ELSE IF( PACKED )THEN
kusano 2b45e8
                              IF( TRACE )
kusano 2b45e8
     $                           WRITE( NTRA, FMT = 9995 )NC, SNAME,
kusano 2b45e8
     $                           CUPLO, N, ALPHA, INCX, BETA, INCY
kusano 2b45e8
                              IF( REWI )
kusano 2b45e8
     $                           REWIND NTRA
kusano 2b45e8
                              CALL CCHPMV( IORDER, UPLO, N, ALPHA, AA,
kusano 2b45e8
     $                                    XX, INCX, 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 ) = LCE( AS, AA, LAA )
kusano 2b45e8
                              ISAME( 5 ) = LDAS.EQ.LDA
kusano 2b45e8
                              ISAME( 6 ) = LCE( 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 ) = LCE( YS, YY, LY )
kusano 2b45e8
                              ELSE
kusano 2b45e8
                                 ISAME( 9 ) = LCERES( '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 ) = LCE( AS, AA, LAA )
kusano 2b45e8
                              ISAME( 6 ) = LDAS.EQ.LDA
kusano 2b45e8
                              ISAME( 7 ) = LCE( 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 ) = LCE( YS, YY, LY )
kusano 2b45e8
                              ELSE
kusano 2b45e8
                                 ISAME( 10 ) = LCERES( '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 ) = LCE( AS, AA, LAA )
kusano 2b45e8
                              ISAME( 5 ) = LCE( 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 ) = LCE( YS, YY, LY )
kusano 2b45e8
                              ELSE
kusano 2b45e8
                                 ISAME( 8 ) = LCERES( '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 CMVCH( '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, CUPLO, N, ALPHA, LDA, INCX,
kusano 2b45e8
     $      BETA, INCY
kusano 2b45e8
      ELSE IF( BANDED )THEN
kusano 2b45e8
         WRITE( NOUT, FMT = 9994 )NC, SNAME, CUPLO, N, K, ALPHA, LDA,
kusano 2b45e8
     $      INCX, BETA, INCY
kusano 2b45e8
      ELSE IF( PACKED )THEN
kusano 2b45e8
         WRITE( NOUT, FMT = 9995 )NC, SNAME, CUPLO, 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(' ',A12, ' 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(' ',A12, ' COMPLETED THE COMPUTATIONAL TESTS (', I6, ' C',
kusano 2b45e8
     $      'ALLS)', /' ******* BUT WITH MAXIMUM TEST RATIO', F8.2,
kusano 2b45e8
     $      ' - SUSPECT *******' )
kusano 2b45e8
 9996 FORMAT( ' ******* ',A12, ' FAILED ON CALL NUMBER:' )
kusano 2b45e8
 9995 FORMAT( 1X, I6, ': ',A12, '(', A14, ',', I3, ',(', F4.1, ',',
kusano 2b45e8
     $      F4.1, '), AP, X,',/ 10x, I2, ',(', F4.1, ',', F4.1,
kusano 2b45e8
     $      '), Y,', I2, ') .' )
kusano 2b45e8
 9994 FORMAT( 1X, I6, ': ',A12, '(', A14, ',', 2( I3, ',' ), '(',
kusano 2b45e8
     $      F4.1, ',', F4.1, '), A,', I3, ', X,',/ 10x, I2, ',(',
kusano 2b45e8
     $      F4.1, ',', F4.1, '), Y,', I2, ') .' )
kusano 2b45e8
 9993 FORMAT( 1X, I6, ': ',A12, '(', A14, ',', I3, ',(', F4.1, ',',
kusano 2b45e8
     $     F4.1, '), A,', I3, ', X,',/ 10x, I2, ',(', F4.1, ',',
kusano 2b45e8
     $     F4.1, '), ', 'Y,', I2, ') .' )
kusano 2b45e8
 9992 FORMAT(' ******* FATAL ERROR - ERROR-EXIT TAKEN ON VALID CALL *',
kusano 2b45e8
     $      '******' )
kusano 2b45e8
*
kusano 2b45e8
*     End of CCHK2.
kusano 2b45e8
*
kusano 2b45e8
      END
kusano 2b45e8
      SUBROUTINE CCHK3( 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, IORDER )
kusano 2b45e8
*
kusano 2b45e8
*  Tests CTRMV, CTBMV, CTPMV, CTRSV, CTBSV and CTPSV.
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            ZERO, HALF, ONE
kusano 2b45e8
      PARAMETER          ( ZERO = ( 0.0, 0.0 ), HALF = ( 0.5, 0.0 ),
kusano 2b45e8
     $                   ONE = ( 1.0, 0.0 ) )
kusano 2b45e8
      REAL               RZERO
kusano 2b45e8
      PARAMETER          ( RZERO = 0.0 )
kusano 2b45e8
*     .. Scalar Arguments ..
kusano 2b45e8
      REAL               EPS, THRESH
kusano 2b45e8
      INTEGER            INCMAX, NIDIM, NINC, NKB, NMAX, NOUT, NTRA,
kusano 2b45e8
     $                   IORDER
kusano 2b45e8
      LOGICAL            FATAL, REWI, TRACE
kusano 2b45e8
      CHARACTER*12       SNAME
kusano 2b45e8
*     .. Array Arguments ..
kusano 2b45e8
      COMPLEX            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
      REAL               G( NMAX )
kusano 2b45e8
      INTEGER            IDIM( NIDIM ), INC( NINC ), KB( NKB )
kusano 2b45e8
*     .. Local Scalars ..
kusano 2b45e8
      COMPLEX            TRANSL
kusano 2b45e8
      REAL               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*14       CUPLO,CTRANS,CDIAG
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            LCE, LCERES
kusano 2b45e8
      EXTERNAL           LCE, LCERES
kusano 2b45e8
*     .. External Subroutines ..
kusano 2b45e8
      EXTERNAL           CMAKE, CMVCH, CCTBMV, CCTBSV, CCTPMV,
kusano 2b45e8
     $                   CCTPSV, CCTRMV, CCTRSV
kusano 2b45e8
*     .. Intrinsic Functions ..
kusano 2b45e8
      INTRINSIC          ABS, MAX
kusano 2b45e8
*     .. Scalars in Common ..
kusano 2b45e8
      INTEGER            INFOT, NOUTC
kusano 2b45e8
      LOGICAL             OK
kusano 2b45e8
*     .. Common blocks ..
kusano 2b45e8
      COMMON             /INFOC/INFOT, NOUTC, OK
kusano 2b45e8
*     .. Data statements ..
kusano 2b45e8
      DATA               ICHU/'UL'/, ICHT/'NTC'/, ICHD/'UN'/
kusano 2b45e8
*     .. Executable Statements ..
kusano 2b45e8
      FULL = SNAME( 9: 9 ).EQ.'r'
kusano 2b45e8
      BANDED = SNAME( 9: 9 ).EQ.'b'
kusano 2b45e8
      PACKED = SNAME( 9: 9 ).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 CMVCH.
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
               IF (UPLO.EQ.'U')THEN
kusano 2b45e8
                  CUPLO = '    CblasUpper'
kusano 2b45e8
               ELSE 
kusano 2b45e8
                  CUPLO = '    CblasLower'
kusano 2b45e8
               END IF
kusano 2b45e8
*
kusano 2b45e8
               DO 80 ICT = 1, 3
kusano 2b45e8
                  TRANS = ICHT( ICT: ICT )
kusano 2b45e8
                  IF (TRANS.EQ.'N')THEN
kusano 2b45e8
                     CTRANS = '  CblasNoTrans'
kusano 2b45e8
                  ELSE IF (TRANS.EQ.'T')THEN
kusano 2b45e8
                     CTRANS = '    CblasTrans'
kusano 2b45e8
                  ELSE 
kusano 2b45e8
                     CTRANS = 'CblasConjTrans'
kusano 2b45e8
                  END IF
kusano 2b45e8
*
kusano 2b45e8
                  DO 70 ICD = 1, 2
kusano 2b45e8
                     DIAG = ICHD( ICD: ICD )
kusano 2b45e8
                     IF (DIAG.EQ.'N')THEN
kusano 2b45e8
                        CDIAG = '  CblasNonUnit'
kusano 2b45e8
                     ELSE
kusano 2b45e8
                        CDIAG = '     CblasUnit'
kusano 2b45e8
                     END IF
kusano 2b45e8
*
kusano 2b45e8
*                    Generate the matrix A.
kusano 2b45e8
*
kusano 2b45e8
                     TRANSL = ZERO
kusano 2b45e8
                     CALL CMAKE( SNAME( 8: 9 ), 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 CMAKE( '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( 10: 11 ).EQ.'mv' )THEN
kusano 2b45e8
                           IF( FULL )THEN
kusano 2b45e8
                              IF( TRACE )
kusano 2b45e8
     $                           WRITE( NTRA, FMT = 9993 )NC, SNAME,
kusano 2b45e8
     $                           CUPLO, CTRANS, CDIAG, N, LDA, INCX
kusano 2b45e8
                              IF( REWI )
kusano 2b45e8
     $                           REWIND NTRA
kusano 2b45e8
                              CALL CCTRMV( IORDER, UPLO, TRANS, DIAG,
kusano 2b45e8
     $                                    N, AA, LDA, XX, INCX )
kusano 2b45e8
                           ELSE IF( BANDED )THEN
kusano 2b45e8
                              IF( TRACE )
kusano 2b45e8
     $                           WRITE( NTRA, FMT = 9994 )NC, SNAME,
kusano 2b45e8
     $                           CUPLO, CTRANS, CDIAG, N, K, LDA, INCX
kusano 2b45e8
                              IF( REWI )
kusano 2b45e8
     $                           REWIND NTRA
kusano 2b45e8
                              CALL CCTBMV( IORDER, UPLO, TRANS, DIAG,
kusano 2b45e8
     $                                    N, K, AA, LDA, XX, INCX )
kusano 2b45e8
                           ELSE IF( PACKED )THEN
kusano 2b45e8
                              IF( TRACE )
kusano 2b45e8
     $                           WRITE( NTRA, FMT = 9995 )NC, SNAME,
kusano 2b45e8
     $                           CUPLO, CTRANS, CDIAG, N, INCX
kusano 2b45e8
                              IF( REWI )
kusano 2b45e8
     $                           REWIND NTRA
kusano 2b45e8
                              CALL CCTPMV( IORDER, UPLO, TRANS, DIAG,
kusano 2b45e8
     $                                    N, AA, XX, INCX )
kusano 2b45e8
                           END IF
kusano 2b45e8
                        ELSE IF( SNAME( 10: 11 ).EQ.'sv' )THEN
kusano 2b45e8
                           IF( FULL )THEN
kusano 2b45e8
                              IF( TRACE )
kusano 2b45e8
     $                           WRITE( NTRA, FMT = 9993 )NC, SNAME,
kusano 2b45e8
     $                           CUPLO, CTRANS, CDIAG, N, LDA, INCX
kusano 2b45e8
                              IF( REWI )
kusano 2b45e8
     $                           REWIND NTRA
kusano 2b45e8
                              CALL CCTRSV( IORDER, UPLO, TRANS, DIAG,
kusano 2b45e8
     $                                    N, AA, LDA, XX, INCX )
kusano 2b45e8
                           ELSE IF( BANDED )THEN
kusano 2b45e8
                              IF( TRACE )
kusano 2b45e8
     $                           WRITE( NTRA, FMT = 9994 )NC, SNAME,
kusano 2b45e8
     $                           CUPLO, CTRANS, CDIAG, N, K, LDA, INCX
kusano 2b45e8
                              IF( REWI )
kusano 2b45e8
     $                           REWIND NTRA
kusano 2b45e8
                              CALL CCTBSV( IORDER, UPLO, TRANS, DIAG,
kusano 2b45e8
     $                                    N, K, AA, LDA, XX, INCX )
kusano 2b45e8
                           ELSE IF( PACKED )THEN
kusano 2b45e8
                              IF( TRACE )
kusano 2b45e8
     $                           WRITE( NTRA, FMT = 9995 )NC, SNAME,
kusano 2b45e8
     $                           CUPLO, CTRANS, CDIAG, N, INCX
kusano 2b45e8
                              IF( REWI )
kusano 2b45e8
     $                           REWIND NTRA
kusano 2b45e8
                              CALL CCTPSV( IORDER, UPLO, TRANS, DIAG,
kusano 2b45e8
     $                                    N, AA, XX, 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 ) = LCE( AS, AA, LAA )
kusano 2b45e8
                           ISAME( 6 ) = LDAS.EQ.LDA
kusano 2b45e8
                           IF( NULL )THEN
kusano 2b45e8
                              ISAME( 7 ) = LCE( XS, XX, LX )
kusano 2b45e8
                           ELSE
kusano 2b45e8
                              ISAME( 7 ) = LCERES( '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 ) = LCE( AS, AA, LAA )
kusano 2b45e8
                           ISAME( 7 ) = LDAS.EQ.LDA
kusano 2b45e8
                           IF( NULL )THEN
kusano 2b45e8
                              ISAME( 8 ) = LCE( XS, XX, LX )
kusano 2b45e8
                           ELSE
kusano 2b45e8
                              ISAME( 8 ) = LCERES( '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 ) = LCE( AS, AA, LAA )
kusano 2b45e8
                           IF( NULL )THEN
kusano 2b45e8
                              ISAME( 6 ) = LCE( XS, XX, LX )
kusano 2b45e8
                           ELSE
kusano 2b45e8
                              ISAME( 6 ) = LCERES( '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( 10: 11 ).EQ.'mv' )THEN
kusano 2b45e8
*
kusano 2b45e8
*                             Check the result.
kusano 2b45e8
*
kusano 2b45e8
                              CALL CMVCH( 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( 10: 11 ).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 CMVCH( 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, CUPLO, CTRANS, CDIAG, N,
kusano 2b45e8
     $          LDA, INCX
kusano 2b45e8
      ELSE IF( BANDED )THEN
kusano 2b45e8
         WRITE( NOUT, FMT = 9994 )NC, SNAME, CUPLO, CTRANS, CDIAG, N, K,
kusano 2b45e8
     $      LDA, INCX
kusano 2b45e8
      ELSE IF( PACKED )THEN
kusano 2b45e8
         WRITE( NOUT, FMT = 9995 )NC, SNAME, CUPLO, CTRANS, CDIAG, N,
kusano 2b45e8
     $          INCX
kusano 2b45e8
      END IF
kusano 2b45e8
*
kusano 2b45e8
  130 CONTINUE
kusano 2b45e8
      RETURN
kusano 2b45e8
*
kusano 2b45e8
 9999 FORMAT(' ',A12, ' 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(' ',A12, ' COMPLETED THE COMPUTATIONAL TESTS (', I6, ' C',
kusano 2b45e8
     $      'ALLS)', /' ******* BUT WITH MAXIMUM TEST RATIO', F8.2,
kusano 2b45e8
     $      ' - SUSPECT *******' )
kusano 2b45e8
 9996 FORMAT( ' ******* ',A12, ' FAILED ON CALL NUMBER:' )
kusano 2b45e8
 9995 FORMAT(1X, I6, ': ',A12, '(', 3( A14, ',' ),/ 10x, I3, ', AP, ',
kusano 2b45e8
     $      'X,', I2, ') .' )
kusano 2b45e8
 9994 FORMAT(1X, I6, ': ',A12, '(', 3( A14, ',' ),/ 10x,  2( I3, ',' ),
kusano 2b45e8
     $     ' A,', I3, ', X,', I2, ') .' )
kusano 2b45e8
 9993 FORMAT( 1X, I6, ': ',A12, '(', 3( A14, ',' ),/ 10x, 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 CCHK3.
kusano 2b45e8
*
kusano 2b45e8
      END
kusano 2b45e8
      SUBROUTINE CCHK4( 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, IORDER )
kusano 2b45e8
*
kusano 2b45e8
*  Tests CGERC and CGERU.
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            ZERO, HALF, ONE
kusano 2b45e8
      PARAMETER          ( ZERO = ( 0.0, 0.0 ), HALF = ( 0.5, 0.0 ),
kusano 2b45e8
     $                   ONE = ( 1.0, 0.0 ) )
kusano 2b45e8
      REAL               RZERO
kusano 2b45e8
      PARAMETER          ( RZERO = 0.0 )
kusano 2b45e8
*     .. Scalar Arguments ..
kusano 2b45e8
      REAL               EPS, THRESH
kusano 2b45e8
      INTEGER            INCMAX, NALF, NIDIM, NINC, NMAX, NOUT, NTRA,
kusano 2b45e8
     $                   IORDER
kusano 2b45e8
      LOGICAL            FATAL, REWI, TRACE
kusano 2b45e8
      CHARACTER*12       SNAME
kusano 2b45e8
*     .. Array Arguments ..
kusano 2b45e8
      COMPLEX            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
      REAL               G( NMAX )
kusano 2b45e8
      INTEGER            IDIM( NIDIM ), INC( NINC )
kusano 2b45e8
*     .. Local Scalars ..
kusano 2b45e8
      COMPLEX            ALPHA, ALS, TRANSL
kusano 2b45e8
      REAL               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            W( 1 )
kusano 2b45e8
      LOGICAL            ISAME( 13 )
kusano 2b45e8
*     .. External Functions ..
kusano 2b45e8
      LOGICAL            LCE, LCERES
kusano 2b45e8
      EXTERNAL           LCE, LCERES
kusano 2b45e8
*     .. External Subroutines ..
kusano 2b45e8
      EXTERNAL           CCGERC, CCGERU, CMAKE, CMVCH
kusano 2b45e8
*     .. Intrinsic Functions ..
kusano 2b45e8
      INTRINSIC          ABS, CONJG, MAX, MIN
kusano 2b45e8
*     .. Scalars in Common ..
kusano 2b45e8
      INTEGER            INFOT, NOUTC
kusano 2b45e8
      LOGICAL             OK
kusano 2b45e8
*     .. Common blocks ..
kusano 2b45e8
      COMMON             /INFOC/INFOT, NOUTC, OK
kusano 2b45e8
*     .. Executable Statements ..
kusano 2b45e8
      CONJ = SNAME( 11: 11 ).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 CMAKE( '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 CMAKE( '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 CMAKE(SNAME( 8: 9 ), ' ', ' ', 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 CCGERC( IORDER, M, N, ALPHA, XX, INCX,
kusano 2b45e8
     $                              YY, INCY, AA, LDA )
kusano 2b45e8
                     ELSE
kusano 2b45e8
                        IF( REWI )
kusano 2b45e8
     $                     REWIND NTRA
kusano 2b45e8
                        CALL CCGERU( IORDER, M, N, ALPHA, XX, INCX,
kusano 2b45e8
     $                              YY, INCY, AA, 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 ) = LCE( XS, XX, LX )
kusano 2b45e8
                     ISAME( 5 ) = INCXS.EQ.INCX
kusano 2b45e8
                     ISAME( 6 ) = LCE( YS, YY, LY )
kusano 2b45e8
                     ISAME( 7 ) = INCYS.EQ.INCY
kusano 2b45e8
                     IF( NULL )THEN
kusano 2b45e8
                        ISAME( 8 ) = LCE( AS, AA, LAA )
kusano 2b45e8
                     ELSE
kusano 2b45e8
                        ISAME( 8 ) = LCERES( '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 ) = CONJG( W( 1 ) )
kusano 2b45e8
                           CALL CMVCH( '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(' ',A12, ' 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(' ',A12, ' COMPLETED THE COMPUTATIONAL TESTS (', I6, ' C',
kusano 2b45e8
     $      'ALLS)', /' ******* BUT WITH MAXIMUM TEST RATIO', F8.2,
kusano 2b45e8
     $      ' - SUSPECT *******' )
kusano 2b45e8
 9996 FORMAT( ' ******* ',A12, ' FAILED ON CALL NUMBER:' )
kusano 2b45e8
 9995 FORMAT( '      THESE ARE THE RESULTS FOR COLUMN ', I3 )
kusano 2b45e8
 9994 FORMAT(1X, I6, ': ',A12, '(', 2( I3, ',' ), '(', F4.1, ',', F4.1,
kusano 2b45e8
     $     '), X,', I2, ', Y,', I2, ', A,', I3, ') .' )
kusano 2b45e8
 9993 FORMAT(' ******* FATAL ERROR - ERROR-EXIT TAKEN ON VALID CALL *',
kusano 2b45e8
     $      '******' )
kusano 2b45e8
*
kusano 2b45e8
*     End of CCHK4.
kusano 2b45e8
*
kusano 2b45e8
      END
kusano 2b45e8
      SUBROUTINE CCHK5( 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, IORDER )
kusano 2b45e8
*
kusano 2b45e8
*  Tests CHER and CHPR.
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            ZERO, HALF, ONE
kusano 2b45e8
      PARAMETER          ( ZERO = ( 0.0, 0.0 ), HALF = ( 0.5, 0.0 ),
kusano 2b45e8
     $                   ONE = ( 1.0, 0.0 ) )
kusano 2b45e8
      REAL               RZERO
kusano 2b45e8
      PARAMETER          ( RZERO = 0.0 )
kusano 2b45e8
*     .. Scalar Arguments ..
kusano 2b45e8
      REAL               EPS, THRESH
kusano 2b45e8
      INTEGER            INCMAX, NALF, NIDIM, NINC, NMAX, NOUT, NTRA,
kusano 2b45e8
     $                   IORDER
kusano 2b45e8
      LOGICAL            FATAL, REWI, TRACE
kusano 2b45e8
      CHARACTER*12       SNAME
kusano 2b45e8
*     .. Array Arguments ..
kusano 2b45e8
      COMPLEX            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
      REAL               G( NMAX )
kusano 2b45e8
      INTEGER            IDIM( NIDIM ), INC( NINC )
kusano 2b45e8
*     .. Local Scalars ..
kusano 2b45e8
      COMPLEX            ALPHA, TRANSL
kusano 2b45e8
      REAL               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*14       CUPLO
kusano 2b45e8
      CHARACTER*2        ICH
kusano 2b45e8
*     .. Local Arrays ..
kusano 2b45e8
      COMPLEX            W( 1 )
kusano 2b45e8
      LOGICAL            ISAME( 13 )
kusano 2b45e8
*     .. External Functions ..
kusano 2b45e8
      LOGICAL            LCE, LCERES
kusano 2b45e8
      EXTERNAL           LCE, LCERES
kusano 2b45e8
*     .. External Subroutines ..
kusano 2b45e8
      EXTERNAL           CCHER, CCHPR, CMAKE, CMVCH
kusano 2b45e8
*     .. Intrinsic Functions ..
kusano 2b45e8
      INTRINSIC          ABS, CMPLX, CONJG, MAX, REAL
kusano 2b45e8
*     .. Scalars in Common ..
kusano 2b45e8
      INTEGER            INFOT, NOUTC
kusano 2b45e8
      LOGICAL             OK
kusano 2b45e8
*     .. Common blocks ..
kusano 2b45e8
      COMMON             /INFOC/INFOT, NOUTC, OK
kusano 2b45e8
*     .. Data statements ..
kusano 2b45e8
      DATA               ICH/'UL'/
kusano 2b45e8
*     .. Executable Statements ..
kusano 2b45e8
      FULL = SNAME( 9: 9 ).EQ.'e'
kusano 2b45e8
      PACKED = SNAME( 9: 9 ).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
            IF (UPLO.EQ.'U')THEN
kusano 2b45e8
               CUPLO = '    CblasUpper'
kusano 2b45e8
            ELSE
kusano 2b45e8
               CUPLO = '    CblasLower'
kusano 2b45e8
            END IF
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 CMAKE( '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 = REAL( ALF( IA ) )
kusano 2b45e8
                  ALPHA = CMPLX( 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 CMAKE( SNAME( 8: 9 ), 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, CUPLO, N,
kusano 2b45e8
     $                  RALPHA, INCX, LDA
kusano 2b45e8
                     IF( REWI )
kusano 2b45e8
     $                  REWIND NTRA
kusano 2b45e8
                     CALL CCHER( IORDER, UPLO, N, RALPHA, XX,
kusano 2b45e8
     $                            INCX, AA, LDA )
kusano 2b45e8
                  ELSE IF( PACKED )THEN
kusano 2b45e8
                     IF( TRACE )
kusano 2b45e8
     $                  WRITE( NTRA, FMT = 9994 )NC, SNAME, CUPLO, N,
kusano 2b45e8
     $                  RALPHA, INCX
kusano 2b45e8
                     IF( REWI )
kusano 2b45e8
     $                  REWIND NTRA
kusano 2b45e8
                     CALL CCHPR( IORDER, UPLO, N, RALPHA,
kusano 2b45e8
     $                            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 ) = LCE( XS, XX, LX )
kusano 2b45e8
                  ISAME( 5 ) = INCXS.EQ.INCX
kusano 2b45e8
                  IF( NULL )THEN
kusano 2b45e8
                     ISAME( 6 ) = LCE( AS, AA, LAA )
kusano 2b45e8
                  ELSE
kusano 2b45e8
                    ISAME( 6 ) = LCERES( SNAME( 8: 9 ), 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 ) = CONJG( 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 CMVCH( '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, CUPLO, N, RALPHA, INCX, LDA
kusano 2b45e8
      ELSE IF( PACKED )THEN
kusano 2b45e8
         WRITE( NOUT, FMT = 9994 )NC, SNAME, CUPLO, N, RALPHA, INCX
kusano 2b45e8
      END IF
kusano 2b45e8
*
kusano 2b45e8
  130 CONTINUE
kusano 2b45e8
      RETURN
kusano 2b45e8
*
kusano 2b45e8
 9999 FORMAT(' ',A12, ' 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(' ',A12, ' COMPLETED THE COMPUTATIONAL TESTS (', I6, ' C',
kusano 2b45e8
     $      'ALLS)', /' ******* BUT WITH MAXIMUM TEST RATIO', F8.2,
kusano 2b45e8
     $      ' - SUSPECT *******' )
kusano 2b45e8
 9996 FORMAT( ' ******* ',A12, ' FAILED ON CALL NUMBER:' )
kusano 2b45e8
 9995 FORMAT( '      THESE ARE THE RESULTS FOR COLUMN ', I3 )
kusano 2b45e8
 9994 FORMAT(1X, I6, ': ',A12, '(', A14, ',', I3, ',', F4.1, ', X,',
kusano 2b45e8
     $      I2, ', AP) .' )
kusano 2b45e8
 9993 FORMAT(1X, I6, ': ',A12, '(', A14, ',', 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 CCHK5.
kusano 2b45e8
*
kusano 2b45e8
      END
kusano 2b45e8
      SUBROUTINE CCHK6( 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, IORDER )
kusano 2b45e8
*
kusano 2b45e8
*  Tests CHER2 and CHPR2.
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            ZERO, HALF, ONE
kusano 2b45e8
      PARAMETER          ( ZERO = ( 0.0, 0.0 ), HALF = ( 0.5, 0.0 ),
kusano 2b45e8
     $                   ONE = ( 1.0, 0.0 ) )
kusano 2b45e8
      REAL               RZERO
kusano 2b45e8
      PARAMETER          ( RZERO = 0.0 )
kusano 2b45e8
*     .. Scalar Arguments ..
kusano 2b45e8
      REAL               EPS, THRESH
kusano 2b45e8
      INTEGER            INCMAX, NALF, NIDIM, NINC, NMAX, NOUT, NTRA,
kusano 2b45e8
     $                   IORDER
kusano 2b45e8
      LOGICAL            FATAL, REWI, TRACE
kusano 2b45e8
      CHARACTER*12       SNAME
kusano 2b45e8
*     .. Array Arguments ..
kusano 2b45e8
      COMPLEX            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
      REAL               G( NMAX )
kusano 2b45e8
      INTEGER            IDIM( NIDIM ), INC( NINC )
kusano 2b45e8
*     .. Local Scalars ..
kusano 2b45e8
      COMPLEX            ALPHA, ALS, TRANSL
kusano 2b45e8
      REAL               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*14       CUPLO
kusano 2b45e8
      CHARACTER*2        ICH
kusano 2b45e8
*     .. Local Arrays ..
kusano 2b45e8
      COMPLEX            W( 2 )
kusano 2b45e8
      LOGICAL            ISAME( 13 )
kusano 2b45e8
*     .. External Functions ..
kusano 2b45e8
      LOGICAL            LCE, LCERES
kusano 2b45e8
      EXTERNAL           LCE, LCERES
kusano 2b45e8
*     .. External Subroutines ..
kusano 2b45e8
      EXTERNAL           CCHER2, CCHPR2, CMAKE, CMVCH
kusano 2b45e8
*     .. Intrinsic Functions ..
kusano 2b45e8
      INTRINSIC          ABS, CONJG, MAX
kusano 2b45e8
*     .. Scalars in Common ..
kusano 2b45e8
      INTEGER            INFOT, NOUTC
kusano 2b45e8
      LOGICAL             OK
kusano 2b45e8
*     .. Common blocks ..
kusano 2b45e8
      COMMON             /INFOC/INFOT, NOUTC, OK
kusano 2b45e8
*     .. Data statements ..
kusano 2b45e8
      DATA               ICH/'UL'/
kusano 2b45e8
*     .. Executable Statements ..
kusano 2b45e8
      FULL = SNAME( 9: 9 ).EQ.'e'
kusano 2b45e8
      PACKED = SNAME( 9: 9 ).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
            IF (UPLO.EQ.'U')THEN
kusano 2b45e8
               CUPLO = '    CblasUpper'
kusano 2b45e8
            ELSE
kusano 2b45e8
               CUPLO = '    CblasLower'
kusano 2b45e8
            END IF
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 CMAKE( '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 CMAKE( '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 CMAKE( SNAME( 8: 9 ), 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, CUPLO, N,
kusano 2b45e8
     $                     ALPHA, INCX, INCY, LDA
kusano 2b45e8
                        IF( REWI )
kusano 2b45e8
     $                     REWIND NTRA
kusano 2b45e8
                        CALL CCHER2( IORDER, UPLO, N, ALPHA, XX, INCX,
kusano 2b45e8
     $                              YY, INCY, AA, LDA )
kusano 2b45e8
                     ELSE IF( PACKED )THEN
kusano 2b45e8
                        IF( TRACE )
kusano 2b45e8
     $                     WRITE( NTRA, FMT = 9994 )NC, SNAME, CUPLO, N,
kusano 2b45e8
     $                     ALPHA, INCX, INCY
kusano 2b45e8
                        IF( REWI )
kusano 2b45e8
     $                     REWIND NTRA
kusano 2b45e8
                        CALL CCHPR2( IORDER, UPLO, N, ALPHA, XX, INCX,
kusano 2b45e8
     $                              YY, INCY, 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 ) = LCE( XS, XX, LX )
kusano 2b45e8
                     ISAME( 5 ) = INCXS.EQ.INCX
kusano 2b45e8
                     ISAME( 6 ) = LCE( YS, YY, LY )
kusano 2b45e8
                     ISAME( 7 ) = INCYS.EQ.INCY
kusano 2b45e8
                     IF( NULL )THEN
kusano 2b45e8
                        ISAME( 8 ) = LCE( AS, AA, LAA )
kusano 2b45e8
                     ELSE
kusano 2b45e8
                        ISAME( 8 ) = LCERES( SNAME( 8: 9 ), 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*CONJG( Z( J, 2 ) )
kusano 2b45e8
                           W( 2 ) = CONJG( ALPHA )*CONJG( 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 CMVCH( '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, CUPLO, N, ALPHA, INCX,
kusano 2b45e8
     $      INCY, LDA
kusano 2b45e8
      ELSE IF( PACKED )THEN
kusano 2b45e8
         WRITE( NOUT, FMT = 9994 )NC, SNAME, CUPLO, N, ALPHA, INCX, INCY
kusano 2b45e8
      END IF
kusano 2b45e8
*
kusano 2b45e8
  170 CONTINUE
kusano 2b45e8
      RETURN
kusano 2b45e8
*
kusano 2b45e8
 9999 FORMAT(' ',A12, ' 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(' ',A12, ' COMPLETED THE COMPUTATIONAL TESTS (', I6, ' C',
kusano 2b45e8
     $      'ALLS)', /' ******* BUT WITH MAXIMUM TEST RATIO', F8.2,
kusano 2b45e8
     $      ' - SUSPECT *******' )
kusano 2b45e8
 9996 FORMAT( ' ******* ',A12, ' FAILED ON CALL NUMBER:' )
kusano 2b45e8
 9995 FORMAT( '      THESE ARE THE RESULTS FOR COLUMN ', I3 )
kusano 2b45e8
 9994 FORMAT(1X, I6, ': ',A12, '(', A14, ',', I3, ',(', F4.1, ',',
kusano 2b45e8
     $     F4.1, '), X,', I2, ', Y,', I2, ', AP) .' )
kusano 2b45e8
 9993 FORMAT(1X, I6, ': ',A12, '(', A14, ',', I3, ',(', F4.1, ',',
kusano 2b45e8
     $     F4.1, '), X,', I2, ', Y,', I2, ', A,', I3, ') .' )
kusano 2b45e8
 9992 FORMAT(' ******* FATAL ERROR - ERROR-EXIT TAKEN ON VALID CALL *',
kusano 2b45e8
     $      '******' )
kusano 2b45e8
*
kusano 2b45e8
*     End of CCHK6.
kusano 2b45e8
*
kusano 2b45e8
      END
kusano 2b45e8
      SUBROUTINE CMVCH( 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            ZERO
kusano 2b45e8
      PARAMETER          ( ZERO = ( 0.0, 0.0 ) )
kusano 2b45e8
      REAL               RZERO, RONE
kusano 2b45e8
      PARAMETER          ( RZERO = 0.0, RONE = 1.0 )
kusano 2b45e8
*     .. Scalar Arguments ..
kusano 2b45e8
      COMPLEX            ALPHA, BETA
kusano 2b45e8
      REAL               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            A( NMAX, * ), X( * ), Y( * ), YT( * ), YY( * )
kusano 2b45e8
      REAL               G( * )
kusano 2b45e8
*     .. Local Scalars ..
kusano 2b45e8
      COMPLEX            C
kusano 2b45e8
      REAL               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, AIMAG, CONJG, MAX, REAL, SQRT
kusano 2b45e8
*     .. Statement Functions ..
kusano 2b45e8
      REAL               ABS1
kusano 2b45e8
*     .. Statement Function definitions ..
kusano 2b45e8
      ABS1( C ) = ABS( REAL( C ) ) + ABS( AIMAG( 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 ) + CONJG( 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 CMVCH.
kusano 2b45e8
*
kusano 2b45e8
      END
kusano 2b45e8
      LOGICAL FUNCTION LCE( 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            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
      LCE = .TRUE.
kusano 2b45e8
      GO TO 30
kusano 2b45e8
   20 CONTINUE
kusano 2b45e8
      LCE = .FALSE.
kusano 2b45e8
   30 RETURN
kusano 2b45e8
*
kusano 2b45e8
*     End of LCE.
kusano 2b45e8
*
kusano 2b45e8
      END
kusano 2b45e8
      LOGICAL FUNCTION LCERES( 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            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
      LCERES = .TRUE.
kusano 2b45e8
      GO TO 80
kusano 2b45e8
   70 CONTINUE
kusano 2b45e8
      LCERES = .FALSE.
kusano 2b45e8
   80 RETURN
kusano 2b45e8
*
kusano 2b45e8
*     End of LCERES.
kusano 2b45e8
*
kusano 2b45e8
      END
kusano 2b45e8
      COMPLEX FUNCTION CBEG( 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          CMPLX
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
      CBEG = CMPLX( ( I - 500 )/1001.0, ( J - 500 )/1001.0 )
kusano 2b45e8
      RETURN
kusano 2b45e8
*
kusano 2b45e8
*     End of CBEG.
kusano 2b45e8
*
kusano 2b45e8
      END
kusano 2b45e8
      REAL FUNCTION SDIFF( 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
      REAL               X, Y
kusano 2b45e8
*     .. Executable Statements ..
kusano 2b45e8
      SDIFF = X - Y
kusano 2b45e8
      RETURN
kusano 2b45e8
*
kusano 2b45e8
*     End of SDIFF.
kusano 2b45e8
*
kusano 2b45e8
      END
kusano 2b45e8
      SUBROUTINE CMAKE( 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            ZERO, ONE
kusano 2b45e8
      PARAMETER          ( ZERO = ( 0.0, 0.0 ), ONE = ( 1.0, 0.0 ) )
kusano 2b45e8
      COMPLEX            ROGUE
kusano 2b45e8
      PARAMETER          ( ROGUE = ( -1.0E10, 1.0E10 ) )
kusano 2b45e8
      REAL               RZERO
kusano 2b45e8
      PARAMETER          ( RZERO = 0.0 )
kusano 2b45e8
      REAL               RROGUE
kusano 2b45e8
      PARAMETER          ( RROGUE = -1.0E10 )
kusano 2b45e8
*     .. Scalar Arguments ..
kusano 2b45e8
      COMPLEX            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            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            CBEG
kusano 2b45e8
      EXTERNAL           CBEG
kusano 2b45e8
*     .. Intrinsic Functions ..
kusano 2b45e8
      INTRINSIC          CMPLX, CONJG, MAX, MIN, REAL
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 ) = CBEG( 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 ) = CONJG( 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 ) = CMPLX( REAL( 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 ) = CMPLX( REAL( 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 ) = CMPLX( REAL( 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 ) = CMPLX( REAL( 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 CMAKE.
kusano 2b45e8
*
kusano 2b45e8
      END