kusano 2b45e8
      PROGRAM CBLAT3
kusano 2b45e8
*
kusano 2b45e8
*  Test program for the COMPLEX          Level 3 Blas.
kusano 2b45e8
*
kusano 2b45e8
*  The program must be driven by a short data file. The first 13 records
kusano 2b45e8
*  of the file are read using list-directed input, the last 9 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 22 lines:
kusano 2b45e8
*  'CBLAT3.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
*  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_cgemm  T PUT F FOR NO TEST. SAME COLUMNS.
kusano 2b45e8
*  cblas_chemm  T PUT F FOR NO TEST. SAME COLUMNS.
kusano 2b45e8
*  cblas_csymm  T PUT F FOR NO TEST. SAME COLUMNS.
kusano 2b45e8
*  cblas_ctrmm  T PUT F FOR NO TEST. SAME COLUMNS.
kusano 2b45e8
*  cblas_ctrsm  T PUT F FOR NO TEST. SAME COLUMNS.
kusano 2b45e8
*  cblas_cherk  T PUT F FOR NO TEST. SAME COLUMNS.
kusano 2b45e8
*  cblas_csyrk  T PUT F FOR NO TEST. SAME COLUMNS.
kusano 2b45e8
*  cblas_cher2k T PUT F FOR NO TEST. SAME COLUMNS.
kusano 2b45e8
*  cblas_csyr2k T PUT F FOR NO TEST. SAME COLUMNS.
kusano 2b45e8
*
kusano 2b45e8
*  See:
kusano 2b45e8
*
kusano 2b45e8
*     Dongarra J. J., Du Croz J. J., Duff I. S. and Hammarling S.
kusano 2b45e8
*     A Set of Level 3 Basic Linear Algebra Subprograms.
kusano 2b45e8
*
kusano 2b45e8
*     Technical Memorandum No.88 (Revision 1), Mathematics and
kusano 2b45e8
*     Computer Science Division, Argonne National Laboratory, 9700
kusano 2b45e8
*     South Cass Avenue, Argonne, Illinois 60439, US.
kusano 2b45e8
*
kusano 2b45e8
*  -- Written on 8-February-1989.
kusano 2b45e8
*     Jack Dongarra, Argonne National Laboratory.
kusano 2b45e8
*     Iain Duff, AERE Harwell.
kusano 2b45e8
*     Jeremy Du Croz, Numerical Algorithms Group Ltd.
kusano 2b45e8
*     Sven Hammarling, Numerical Algorithms Group Ltd.
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 = 9 )
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
kusano 2b45e8
      PARAMETER          ( NMAX = 65 )
kusano 2b45e8
      INTEGER            NIDMAX, NALMAX, NBEMAX
kusano 2b45e8
      PARAMETER          ( NIDMAX = 9, NALMAX = 7, NBEMAX = 7 )
kusano 2b45e8
*     .. Local Scalars ..
kusano 2b45e8
      REAL               EPS, ERR, THRESH
kusano 2b45e8
      INTEGER            I, ISNUM, J, N, NALF, NBET, NIDIM, NTRA,
kusano 2b45e8
     $                   LAYOUT
kusano 2b45e8
      LOGICAL            FATAL, LTESTT, REWI, SAME, SFATAL, TRACE,
kusano 2b45e8
     $                   TSTERR, CORDER, RORDER
kusano 2b45e8
      CHARACTER*1        TRANSA, TRANSB
kusano 2b45e8
      CHARACTER*12       SNAMET
kusano 2b45e8
      CHARACTER*32       SNAPS
kusano 2b45e8
*     .. Local Arrays ..
kusano 2b45e8
      COMPLEX            AA( NMAX*NMAX ), AB( NMAX, 2*NMAX ),
kusano 2b45e8
     $                   ALF( NALMAX ), AS( NMAX*NMAX ),
kusano 2b45e8
     $                   BB( NMAX*NMAX ), BET( NBEMAX ),
kusano 2b45e8
     $                   BS( NMAX*NMAX ), C( NMAX, NMAX ),
kusano 2b45e8
     $                   CC( NMAX*NMAX ), CS( NMAX*NMAX ), CT( NMAX ),
kusano 2b45e8
     $                   W( 2*NMAX )
kusano 2b45e8
      REAL               G( NMAX )
kusano 2b45e8
      INTEGER            IDIM( NIDMAX )
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, CMMCH
kusano 2b45e8
*     .. Intrinsic Functions ..
kusano 2b45e8
      INTRINSIC          MAX, MIN
kusano 2b45e8
*     .. Scalars in Common ..
kusano 2b45e8
      INTEGER            INFOT, NOUTC
kusano 2b45e8
      LOGICAL            LERR, OK
kusano 2b45e8
      CHARACTER*12       SRNAMT
kusano 2b45e8
*     .. Common blocks ..
kusano 2b45e8
      COMMON             /INFOC/INFOT, NOUTC, OK, LERR
kusano 2b45e8
      COMMON             /SRNAMC/SRNAMT
kusano 2b45e8
*     .. Data statements ..
kusano 2b45e8
      DATA               SNAMES/'cblas_cgemm ', 'cblas_chemm ',
kusano 2b45e8
     $                   'cblas_csymm ', 'cblas_ctrmm ', 'cblas_ctrsm ',
kusano 2b45e8
     $                   'cblas_cherk ', 'cblas_csyrk ', 'cblas_cher2k',
kusano 2b45e8
     $                   'cblas_csyr2k'/
kusano 2b45e8
*     .. Executable Statements ..
kusano 2b45e8
*
kusano 2b45e8
      NOUTC = NOUT
kusano 2b45e8
*
kusano 2b45e8
*     Read name and unit number for snapshot output file and open file.
kusano 2b45e8
*
kusano 2b45e8
      READ( NIN, FMT = * )SNAPS
kusano 2b45e8
      READ( NIN, FMT = * )NTRA
kusano 2b45e8
      TRACE = NTRA.GE.0
kusano 2b45e8
      IF( TRACE )THEN
kusano 2b45e8
         OPEN( NTRA, FILE = SNAPS )
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 220
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 220
kusano 2b45e8
         END IF
kusano 2b45e8
   10 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 220
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 220
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 = 9995 )
kusano 2b45e8
      WRITE( NOUT, FMT = 9994 )( IDIM( I ), I = 1, NIDIM )
kusano 2b45e8
      WRITE( NOUT, FMT = 9993 )( ALF( I ), I = 1, NALF )
kusano 2b45e8
      WRITE( NOUT, FMT = 9992 )( BET( I ), I = 1, NBET )
kusano 2b45e8
      IF( .NOT.TSTERR )THEN
kusano 2b45e8
         WRITE( NOUT, FMT = * )
kusano 2b45e8
         WRITE( NOUT, FMT = 9984 )
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
*
kusano 2b45e8
*     Read names of subroutines and flags which indicate
kusano 2b45e8
*     whether they are to be tested.
kusano 2b45e8
*
kusano 2b45e8
      DO 20 I = 1, NSUBS
kusano 2b45e8
         LTEST( I ) = .FALSE.
kusano 2b45e8
   20 CONTINUE
kusano 2b45e8
   30 READ( NIN, FMT = 9988, END = 60 )SNAMET, LTESTT
kusano 2b45e8
      DO 40 I = 1, NSUBS
kusano 2b45e8
         IF( SNAMET.EQ.SNAMES( I ) )
kusano 2b45e8
     $      GO TO 50
kusano 2b45e8
   40 CONTINUE
kusano 2b45e8
      WRITE( NOUT, FMT = 9990 )SNAMET
kusano 2b45e8
      STOP
kusano 2b45e8
   50 LTEST( I ) = LTESTT
kusano 2b45e8
      GO TO 30
kusano 2b45e8
*
kusano 2b45e8
   60 CONTINUE
kusano 2b45e8
      CLOSE ( NIN )
kusano 2b45e8
*
kusano 2b45e8
*     Compute EPS (the machine precision).
kusano 2b45e8
*
kusano 2b45e8
      EPS = RONE
kusano 2b45e8
   70 CONTINUE
kusano 2b45e8
      IF( SDIFF( RONE + EPS, RONE ).EQ.RZERO )
kusano 2b45e8
     $   GO TO 80
kusano 2b45e8
      EPS = RHALF*EPS
kusano 2b45e8
      GO TO 70
kusano 2b45e8
   80 CONTINUE
kusano 2b45e8
      EPS = EPS + EPS
kusano 2b45e8
      WRITE( NOUT, FMT = 9998 )EPS
kusano 2b45e8
*
kusano 2b45e8
*     Check the reliability of CMMCH using exact data.
kusano 2b45e8
*
kusano 2b45e8
      N = MIN( 32, NMAX )
kusano 2b45e8
      DO 100 J = 1, N
kusano 2b45e8
         DO 90 I = 1, N
kusano 2b45e8
            AB( I, J ) = MAX( I - J + 1, 0 )
kusano 2b45e8
   90    CONTINUE
kusano 2b45e8
         AB( J, NMAX + 1 ) = J
kusano 2b45e8
         AB( 1, NMAX + J ) = J
kusano 2b45e8
         C( J, 1 ) = ZERO
kusano 2b45e8
  100 CONTINUE
kusano 2b45e8
      DO 110 J = 1, N
kusano 2b45e8
         CC( J ) = J*( ( J + 1 )*J )/2 - ( ( J + 1 )*J*( J - 1 ) )/3
kusano 2b45e8
  110 CONTINUE
kusano 2b45e8
*     CC holds the exact result. On exit from CMMCH CT holds
kusano 2b45e8
*     the result computed by CMMCH.
kusano 2b45e8
      TRANSA = 'N'
kusano 2b45e8
      TRANSB = 'N'
kusano 2b45e8
      CALL CMMCH( TRANSA, TRANSB, N, 1, N, ONE, AB, NMAX,
kusano 2b45e8
     $            AB( 1, NMAX + 1 ), NMAX, ZERO, C, NMAX, CT, G, CC,
kusano 2b45e8
     $            NMAX, EPS, ERR, FATAL, NOUT, .TRUE. )
kusano 2b45e8
      SAME = LCE( CC, CT, N )
kusano 2b45e8
      IF( .NOT.SAME.OR.ERR.NE.RZERO )THEN
kusano 2b45e8
         WRITE( NOUT, FMT = 9989 )TRANSA, TRANSB, SAME, ERR
kusano 2b45e8
         STOP
kusano 2b45e8
      END IF
kusano 2b45e8
      TRANSB = 'C'
kusano 2b45e8
      CALL CMMCH( TRANSA, TRANSB, N, 1, N, ONE, AB, NMAX,
kusano 2b45e8
     $            AB( 1, NMAX + 1 ), NMAX, ZERO, C, NMAX, CT, G, CC,
kusano 2b45e8
     $            NMAX, EPS, ERR, FATAL, NOUT, .TRUE. )
kusano 2b45e8
      SAME = LCE( CC, CT, N )
kusano 2b45e8
      IF( .NOT.SAME.OR.ERR.NE.RZERO )THEN
kusano 2b45e8
         WRITE( NOUT, FMT = 9989 )TRANSA, TRANSB, SAME, ERR
kusano 2b45e8
         STOP
kusano 2b45e8
      END IF
kusano 2b45e8
      DO 120 J = 1, N
kusano 2b45e8
         AB( J, NMAX + 1 ) = N - J + 1
kusano 2b45e8
         AB( 1, NMAX + J ) = N - J + 1
kusano 2b45e8
  120 CONTINUE
kusano 2b45e8
      DO 130 J = 1, N
kusano 2b45e8
         CC( N - J + 1 ) = J*( ( J + 1 )*J )/2 -
kusano 2b45e8
     $                     ( ( J + 1 )*J*( J - 1 ) )/3
kusano 2b45e8
  130 CONTINUE
kusano 2b45e8
      TRANSA = 'C'
kusano 2b45e8
      TRANSB = 'N'
kusano 2b45e8
      CALL CMMCH( TRANSA, TRANSB, N, 1, N, ONE, AB, NMAX,
kusano 2b45e8
     $            AB( 1, NMAX + 1 ), NMAX, ZERO, C, NMAX, CT, G, CC,
kusano 2b45e8
     $            NMAX, EPS, ERR, FATAL, NOUT, .TRUE. )
kusano 2b45e8
      SAME = LCE( CC, CT, N )
kusano 2b45e8
      IF( .NOT.SAME.OR.ERR.NE.RZERO )THEN
kusano 2b45e8
         WRITE( NOUT, FMT = 9989 )TRANSA, TRANSB, SAME, ERR
kusano 2b45e8
         STOP
kusano 2b45e8
      END IF
kusano 2b45e8
      TRANSB = 'C'
kusano 2b45e8
      CALL CMMCH( TRANSA, TRANSB, N, 1, N, ONE, AB, NMAX,
kusano 2b45e8
     $            AB( 1, NMAX + 1 ), NMAX, ZERO, C, NMAX, CT, G, CC,
kusano 2b45e8
     $            NMAX, EPS, ERR, FATAL, NOUT, .TRUE. )
kusano 2b45e8
      SAME = LCE( CC, CT, N )
kusano 2b45e8
      IF( .NOT.SAME.OR.ERR.NE.RZERO )THEN
kusano 2b45e8
         WRITE( NOUT, FMT = 9989 )TRANSA, TRANSB, SAME, ERR
kusano 2b45e8
         STOP
kusano 2b45e8
      END IF
kusano 2b45e8
*
kusano 2b45e8
*     Test each subroutine in turn.
kusano 2b45e8
*
kusano 2b45e8
      DO 200 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 = 9987 )SNAMES( ISNUM )
kusano 2b45e8
         ELSE
kusano 2b45e8
            SRNAMT = SNAMES( ISNUM )
kusano 2b45e8
*           Test error exits.
kusano 2b45e8
            IF( TSTERR )THEN
kusano 2b45e8
               CALL CC3CHKE( 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, 150, 150, 160, 160, 170, 170,
kusano 2b45e8
     $              180, 180 )ISNUM
kusano 2b45e8
*           Test CGEMM, 01.
kusano 2b45e8
  140       IF (CORDER) THEN
kusano 2b45e8
            CALL CCHK1(SNAMES( ISNUM ), EPS, THRESH, NOUT, NTRA, TRACE,
kusano 2b45e8
     $                 REWI, FATAL, NIDIM, IDIM, NALF, ALF, NBET, BET,
kusano 2b45e8
     $                 NMAX, AB, AA, AS, AB( 1, NMAX + 1 ), BB, BS, C,
kusano 2b45e8
     $                 CC, CS, CT, 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, NALF, ALF, NBET, BET,
kusano 2b45e8
     $                 NMAX, AB, AA, AS, AB( 1, NMAX + 1 ), BB, BS, C,
kusano 2b45e8
     $                 CC, CS, CT, G, 1 )
kusano 2b45e8
            END IF
kusano 2b45e8
            GO TO 190
kusano 2b45e8
*           Test CHEMM, 02, CSYMM, 03.
kusano 2b45e8
  150       IF (CORDER) THEN
kusano 2b45e8
            CALL CCHK2(SNAMES( ISNUM ), EPS, THRESH, NOUT, NTRA, TRACE,
kusano 2b45e8
     $                 REWI, FATAL, NIDIM, IDIM, NALF, ALF, NBET, BET,
kusano 2b45e8
     $                 NMAX, AB, AA, AS, AB( 1, NMAX + 1 ), BB, BS, C,
kusano 2b45e8
     $                 CC, CS, CT, 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, NALF, ALF, NBET, BET,
kusano 2b45e8
     $                 NMAX, AB, AA, AS, AB( 1, NMAX + 1 ), BB, BS, C,
kusano 2b45e8
     $                 CC, CS, CT, G, 1 )
kusano 2b45e8
            END IF
kusano 2b45e8
            GO TO 190
kusano 2b45e8
*           Test CTRMM, 04, CTRSM, 05.
kusano 2b45e8
  160       IF (CORDER) THEN
kusano 2b45e8
            CALL CCHK3(SNAMES( ISNUM ), EPS, THRESH, NOUT, NTRA, TRACE,
kusano 2b45e8
     $                 REWI, FATAL, NIDIM, IDIM, NALF, ALF, NMAX, AB,
kusano 2b45e8
     $                 AA, AS, AB( 1, NMAX + 1 ), BB, BS, CT, G, C,
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, NALF, ALF, NMAX, AB,
kusano 2b45e8
     $                 AA, AS, AB( 1, NMAX + 1 ), BB, BS, CT, G, C,
kusano 2b45e8
     $		1 )
kusano 2b45e8
            END IF
kusano 2b45e8
            GO TO 190
kusano 2b45e8
*           Test CHERK, 06, CSYRK, 07.
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, NBET, BET,
kusano 2b45e8
     $                 NMAX, AB, AA, AS, AB( 1, NMAX + 1 ), BB, BS, C,
kusano 2b45e8
     $                 CC, CS, CT, G, 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, NBET, BET,
kusano 2b45e8
     $                 NMAX, AB, AA, AS, AB( 1, NMAX + 1 ), BB, BS, C,
kusano 2b45e8
     $                 CC, CS, CT, G, 1 )
kusano 2b45e8
            END IF
kusano 2b45e8
            GO TO 190
kusano 2b45e8
*           Test CHER2K, 08, CSYR2K, 09.
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, NBET, BET,
kusano 2b45e8
     $                 NMAX, AB, AA, AS, BB, BS, C, CC, CS, CT, G, W,
kusano 2b45e8
     $		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, NBET, BET,
kusano 2b45e8
     $                 NMAX, AB, AA, AS, BB, BS, C, CC, CS, CT, G, W,
kusano 2b45e8
     $		1 )
kusano 2b45e8
            END IF
kusano 2b45e8
            GO TO 190
kusano 2b45e8
*
kusano 2b45e8
  190       IF( FATAL.AND.SFATAL )
kusano 2b45e8
     $         GO TO 210
kusano 2b45e8
         END IF
kusano 2b45e8
  200 CONTINUE
kusano 2b45e8
      WRITE( NOUT, FMT = 9986 )
kusano 2b45e8
      GO TO 230
kusano 2b45e8
*
kusano 2b45e8
  210 CONTINUE
kusano 2b45e8
      WRITE( NOUT, FMT = 9985 )
kusano 2b45e8
      GO TO 230
kusano 2b45e8
*
kusano 2b45e8
  220 CONTINUE
kusano 2b45e8
      WRITE( NOUT, FMT = 9991 )
kusano 2b45e8
*
kusano 2b45e8
  230 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(' TESTS OF THE COMPLEX          LEVEL 3 BLAS', //' THE F',
kusano 2b45e8
     $      'OLLOWING PARAMETER VALUES WILL BE USED:' )
kusano 2b45e8
 9994 FORMAT( '   FOR N              ', 9I6 )
kusano 2b45e8
 9993 FORMAT( '   FOR ALPHA          ',
kusano 2b45e8
     $      7( '(', F4.1, ',', F4.1, ')  ', : ) )
kusano 2b45e8
 9992 FORMAT( '   FOR BETA           ',
kusano 2b45e8
     $      7( '(', F4.1, ',', F4.1, ')  ', : ) )
kusano 2b45e8
 9991 FORMAT( ' AMEND DATA FILE OR INCREASE ARRAY SIZES IN PROGRAM',
kusano 2b45e8
     $      /' ******* TESTS ABANDONED *******' )
kusano 2b45e8
 9990 FORMAT(' SUBPROGRAM NAME ', A12,' NOT RECOGNIZED', /' ******* T',
kusano 2b45e8
     $      'ESTS ABANDONED *******' )
kusano 2b45e8
 9989 FORMAT(' ERROR IN CMMCH -  IN-LINE DOT PRODUCTS ARE BEING EVALU',
kusano 2b45e8
     $      'ATED WRONGLY.', /' CMMCH WAS CALLED WITH TRANSA = ', A1,
kusano 2b45e8
     $      'AND TRANSB = ', A1, /' AND RETURNED SAME = ', L1, ' AND ',
kusano 2b45e8
     $    ' ERR = ', F12.3, '.', /' THIS MAY BE DUE TO FAULTS IN THE ',
kusano 2b45e8
     $     'ARITHMETIC OR THE COMPILER.', /' ******* TESTS ABANDONED ',
kusano 2b45e8
     $      '*******' )
kusano 2b45e8
 9988 FORMAT( A12,L2 )
kusano 2b45e8
 9987 FORMAT( 1X, A12,' WAS NOT TESTED' )
kusano 2b45e8
 9986 FORMAT( /' END OF TESTS' )
kusano 2b45e8
 9985 FORMAT( /' ******* FATAL ERROR - TESTS ABANDONED *******' )
kusano 2b45e8
 9984 FORMAT( ' ERROR-EXITS WILL NOT BE TESTED' )
kusano 2b45e8
*
kusano 2b45e8
*     End of CBLAT3.
kusano 2b45e8
*
kusano 2b45e8
      END
kusano 2b45e8
      SUBROUTINE CCHK1( SNAME, EPS, THRESH, NOUT, NTRA, TRACE, REWI,
kusano 2b45e8
     $                  FATAL, NIDIM, IDIM, NALF, ALF, NBET, BET, NMAX,
kusano 2b45e8
     $                  A, AA, AS, B, BB, BS, C, CC, CS, CT, G, 
kusano 2b45e8
     $                  IORDER )
kusano 2b45e8
*
kusano 2b45e8
*  Tests CGEMM.
kusano 2b45e8
*
kusano 2b45e8
*  Auxiliary routine for test program for Level 3 Blas.
kusano 2b45e8
*
kusano 2b45e8
*  -- Written on 8-February-1989.
kusano 2b45e8
*     Jack Dongarra, Argonne National Laboratory.
kusano 2b45e8
*     Iain Duff, AERE Harwell.
kusano 2b45e8
*     Jeremy Du Croz, Numerical Algorithms Group Ltd.
kusano 2b45e8
*     Sven Hammarling, Numerical Algorithms Group Ltd.
kusano 2b45e8
*
kusano 2b45e8
*     .. Parameters ..
kusano 2b45e8
      COMPLEX            ZERO
kusano 2b45e8
      PARAMETER          ( ZERO = ( 0.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            NALF, NBET, NIDIM, NMAX, 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 ), B( NMAX, NMAX ),
kusano 2b45e8
     $                   BB( NMAX*NMAX ), BET( NBET ), BS( NMAX*NMAX ),
kusano 2b45e8
     $                   C( NMAX, NMAX ), CC( NMAX*NMAX ),
kusano 2b45e8
     $                   CS( NMAX*NMAX ), CT( NMAX )
kusano 2b45e8
      REAL               G( NMAX )
kusano 2b45e8
      INTEGER            IDIM( NIDIM )
kusano 2b45e8
*     .. Local Scalars ..
kusano 2b45e8
      COMPLEX            ALPHA, ALS, BETA, BLS
kusano 2b45e8
      REAL               ERR, ERRMAX
kusano 2b45e8
      INTEGER            I, IA, IB, ICA, ICB, IK, IM, IN, K, KS, LAA,
kusano 2b45e8
     $                   LBB, LCC, LDA, LDAS, LDB, LDBS, LDC, LDCS, M,
kusano 2b45e8
     $                   MA, MB, MS, N, NA, NARGS, NB, NC, NS
kusano 2b45e8
      LOGICAL            NULL, RESET, SAME, TRANA, TRANB
kusano 2b45e8
      CHARACTER*1        TRANAS, TRANBS, TRANSA, TRANSB
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           CCGEMM, CMAKE, CMMCH
kusano 2b45e8
*     .. Intrinsic Functions ..
kusano 2b45e8
      INTRINSIC          MAX
kusano 2b45e8
*     .. Scalars in Common ..
kusano 2b45e8
      INTEGER            INFOT, NOUTC
kusano 2b45e8
      LOGICAL            LERR, OK
kusano 2b45e8
*     .. Common blocks ..
kusano 2b45e8
      COMMON             /INFOC/INFOT, NOUTC, OK, LERR
kusano 2b45e8
*     .. Data statements ..
kusano 2b45e8
      DATA               ICH/'NTC'/
kusano 2b45e8
*     .. Executable Statements ..
kusano 2b45e8
*
kusano 2b45e8
      NARGS = 13
kusano 2b45e8
      NC = 0
kusano 2b45e8
      RESET = .TRUE.
kusano 2b45e8
      ERRMAX = RZERO
kusano 2b45e8
*
kusano 2b45e8
      DO 110 IM = 1, NIDIM
kusano 2b45e8
         M = IDIM( IM )
kusano 2b45e8
*
kusano 2b45e8
         DO 100 IN = 1, NIDIM
kusano 2b45e8
            N = IDIM( IN )
kusano 2b45e8
*           Set LDC to 1 more than minimum value if room.
kusano 2b45e8
            LDC = M
kusano 2b45e8
            IF( LDC.LT.NMAX )
kusano 2b45e8
     $         LDC = LDC + 1
kusano 2b45e8
*           Skip tests if not enough room.
kusano 2b45e8
            IF( LDC.GT.NMAX )
kusano 2b45e8
     $         GO TO 100
kusano 2b45e8
            LCC = LDC*N
kusano 2b45e8
            NULL = N.LE.0.OR.M.LE.0
kusano 2b45e8
*
kusano 2b45e8
            DO 90 IK = 1, NIDIM
kusano 2b45e8
               K = IDIM( IK )
kusano 2b45e8
*
kusano 2b45e8
               DO 80 ICA = 1, 3
kusano 2b45e8
                  TRANSA = ICH( ICA: ICA )
kusano 2b45e8
                  TRANA = TRANSA.EQ.'T'.OR.TRANSA.EQ.'C'
kusano 2b45e8
*
kusano 2b45e8
                  IF( TRANA )THEN
kusano 2b45e8
                     MA = K
kusano 2b45e8
                     NA = M
kusano 2b45e8
                  ELSE
kusano 2b45e8
                     MA = M
kusano 2b45e8
                     NA = K
kusano 2b45e8
                  END IF
kusano 2b45e8
*                 Set LDA to 1 more than minimum value if room.
kusano 2b45e8
                  LDA = MA
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 80
kusano 2b45e8
                  LAA = LDA*NA
kusano 2b45e8
*
kusano 2b45e8
*                 Generate the matrix A.
kusano 2b45e8
*
kusano 2b45e8
                  CALL CMAKE( 'ge', ' ', ' ', MA, NA, A, NMAX, AA, LDA,
kusano 2b45e8
     $                        RESET, ZERO )
kusano 2b45e8
*
kusano 2b45e8
                  DO 70 ICB = 1, 3
kusano 2b45e8
                     TRANSB = ICH( ICB: ICB )
kusano 2b45e8
                     TRANB = TRANSB.EQ.'T'.OR.TRANSB.EQ.'C'
kusano 2b45e8
*
kusano 2b45e8
                     IF( TRANB )THEN
kusano 2b45e8
                        MB = N
kusano 2b45e8
                        NB = K
kusano 2b45e8
                     ELSE
kusano 2b45e8
                        MB = K
kusano 2b45e8
                        NB = N
kusano 2b45e8
                     END IF
kusano 2b45e8
*                    Set LDB to 1 more than minimum value if room.
kusano 2b45e8
                     LDB = MB
kusano 2b45e8
                     IF( LDB.LT.NMAX )
kusano 2b45e8
     $                  LDB = LDB + 1
kusano 2b45e8
*                    Skip tests if not enough room.
kusano 2b45e8
                     IF( LDB.GT.NMAX )
kusano 2b45e8
     $                  GO TO 70
kusano 2b45e8
                     LBB = LDB*NB
kusano 2b45e8
*
kusano 2b45e8
*                    Generate the matrix B.
kusano 2b45e8
*
kusano 2b45e8
                     CALL CMAKE( 'ge', ' ', ' ', MB, NB, B, NMAX, BB,
kusano 2b45e8
     $                           LDB, RESET, ZERO )
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 matrix C.
kusano 2b45e8
*
kusano 2b45e8
                           CALL CMAKE( 'ge', ' ', ' ', M, N, C, NMAX,
kusano 2b45e8
     $                                 CC, LDC, RESET, ZERO )
kusano 2b45e8
*
kusano 2b45e8
                           NC = NC + 1
kusano 2b45e8
*
kusano 2b45e8
*                          Save every datum before calling the
kusano 2b45e8
*                          subroutine.
kusano 2b45e8
*
kusano 2b45e8
                           TRANAS = TRANSA
kusano 2b45e8
                           TRANBS = TRANSB
kusano 2b45e8
                           MS = M
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, LBB
kusano 2b45e8
                              BS( I ) = BB( I )
kusano 2b45e8
   20                      CONTINUE
kusano 2b45e8
                           LDBS = LDB
kusano 2b45e8
                           BLS = BETA
kusano 2b45e8
                           DO 30 I = 1, LCC
kusano 2b45e8
                              CS( I ) = CC( I )
kusano 2b45e8
   30                      CONTINUE
kusano 2b45e8
                           LDCS = LDC
kusano 2b45e8
*
kusano 2b45e8
*                          Call the subroutine.
kusano 2b45e8
*
kusano 2b45e8
                           IF( TRACE )
kusano 2b45e8
     $                        CALL CPRCN1(NTRA, NC, SNAME, IORDER,
kusano 2b45e8
     $                        TRANSA, TRANSB, M, N, K, ALPHA, LDA,
kusano 2b45e8
     $                        LDB, BETA, LDC)
kusano 2b45e8
                           IF( REWI )
kusano 2b45e8
     $                        REWIND NTRA
kusano 2b45e8
                           CALL CCGEMM( IORDER, TRANSA, TRANSB, M, N,
kusano 2b45e8
     $                                 K, ALPHA, AA, LDA, BB, LDB, 
kusano 2b45e8
     $                                 BETA, CC, LDC )
kusano 2b45e8
*
kusano 2b45e8
*                          Check if error-exit was taken incorrectly.
kusano 2b45e8
*
kusano 2b45e8
                           IF( .NOT.OK )THEN
kusano 2b45e8
                              WRITE( NOUT, FMT = 9994 )
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 ) = TRANSA.EQ.TRANAS
kusano 2b45e8
                           ISAME( 2 ) = TRANSB.EQ.TRANBS
kusano 2b45e8
                           ISAME( 3 ) = MS.EQ.M
kusano 2b45e8
                           ISAME( 4 ) = NS.EQ.N
kusano 2b45e8
                           ISAME( 5 ) = KS.EQ.K
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( BS, BB, LBB )
kusano 2b45e8
                           ISAME( 10 ) = LDBS.EQ.LDB
kusano 2b45e8
                           ISAME( 11 ) = BLS.EQ.BETA
kusano 2b45e8
                           IF( NULL )THEN
kusano 2b45e8
                              ISAME( 12 ) = LCE( CS, CC, LCC )
kusano 2b45e8
                           ELSE
kusano 2b45e8
                             ISAME( 12 ) = LCERES( 'ge', ' ', M, N, CS,
kusano 2b45e8
     $                                      CC, LDC )
kusano 2b45e8
                           END IF
kusano 2b45e8
                           ISAME( 13 ) = LDCS.EQ.LDC
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 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 CMMCH( TRANSA, TRANSB, M, N, K,
kusano 2b45e8
     $                                   ALPHA, A, NMAX, B, NMAX, BETA,
kusano 2b45e8
     $                                   C, NMAX, CT, G, CC, LDC, EPS,
kusano 2b45e8
     $                                   ERR, 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 120
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
         IF ( IORDER.EQ.0) WRITE( NOUT, FMT = 10000 )SNAME, NC
kusano 2b45e8
         IF ( IORDER.EQ.1) WRITE( NOUT, FMT = 10001 )SNAME, NC
kusano 2b45e8
      ELSE
kusano 2b45e8
         IF ( IORDER.EQ.0) WRITE( NOUT, FMT = 10002 )SNAME, NC, ERRMAX
kusano 2b45e8
         IF ( IORDER.EQ.1) WRITE( NOUT, FMT = 10003 )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
      CALL CPRCN1(NOUT, NC, SNAME, IORDER, TRANSA, TRANSB, 
kusano 2b45e8
     $           M, N, K, ALPHA, LDA, LDB, BETA, LDC)
kusano 2b45e8
*
kusano 2b45e8
  130 CONTINUE
kusano 2b45e8
      RETURN
kusano 2b45e8
*
kusano 2b45e8
10003 FORMAT( ' ', A12,' COMPLETED THE ROW-MAJOR    COMPUTATIONAL ',
kusano 2b45e8
     $ 'TESTS (', I6, ' CALLS)', /' ******* BUT WITH MAXIMUM TEST ',
kusano 2b45e8
     $ 'RATIO ', F8.2, ' - SUSPECT *******' )
kusano 2b45e8
10002 FORMAT( ' ', A12,' COMPLETED THE COLUMN-MAJOR COMPUTATIONAL ',
kusano 2b45e8
     $ 'TESTS (', I6, ' CALLS)', /' ******* BUT WITH MAXIMUM TEST ',
kusano 2b45e8
     $ 'RATIO ', F8.2, ' - SUSPECT *******' )
kusano 2b45e8
10001 FORMAT( ' ', A12,' PASSED THE ROW-MAJOR    COMPUTATIONAL TESTS',
kusano 2b45e8
     $ ' (', I6, ' CALL', 'S)' )
kusano 2b45e8
10000 FORMAT( ' ', A12,' PASSED THE COLUMN-MAJOR COMPUTATIONAL TESTS',
kusano 2b45e8
     $ ' (', I6, ' CALL', 'S)' )
kusano 2b45e8
 9998 FORMAT(' ******* FATAL ERROR - PARAMETER NUMBER ', I2, ' WAS CH',
kusano 2b45e8
     $      'ANGED INCORRECTLY *******' )
kusano 2b45e8
 9996 FORMAT( ' ******* ', A12,' FAILED ON CALL NUMBER:' )
kusano 2b45e8
 9995 FORMAT( 1X, I6, ': ', A12,'(''', A1, ''',''', A1, ''',',
kusano 2b45e8
     $     3( I3, ',' ), '(', F4.1, ',', F4.1, '), A,', I3, ', B,', I3,
kusano 2b45e8
     $     ',(', F4.1, ',', F4.1, '), C,', I3, ').' )
kusano 2b45e8
 9994 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
*
kusano 2b45e8
      SUBROUTINE CPRCN1(NOUT, NC, SNAME, IORDER, TRANSA, TRANSB, M, N,
kusano 2b45e8
     $                 K, ALPHA, LDA, LDB, BETA, LDC)
kusano 2b45e8
      INTEGER          NOUT, NC, IORDER, M, N, K, LDA, LDB, LDC
kusano 2b45e8
      COMPLEX          ALPHA, BETA
kusano 2b45e8
      CHARACTER*1      TRANSA, TRANSB
kusano 2b45e8
      CHARACTER*12     SNAME
kusano 2b45e8
      CHARACTER*14     CRC, CTA,CTB
kusano 2b45e8
      
kusano 2b45e8
      IF (TRANSA.EQ.'N')THEN
kusano 2b45e8
         CTA = '  CblasNoTrans'
kusano 2b45e8
      ELSE IF (TRANSA.EQ.'T')THEN
kusano 2b45e8
         CTA = '    CblasTrans'
kusano 2b45e8
      ELSE 
kusano 2b45e8
         CTA = 'CblasConjTrans'
kusano 2b45e8
      END IF
kusano 2b45e8
      IF (TRANSB.EQ.'N')THEN
kusano 2b45e8
         CTB = '  CblasNoTrans'
kusano 2b45e8
      ELSE IF (TRANSB.EQ.'T')THEN
kusano 2b45e8
         CTB = '    CblasTrans'
kusano 2b45e8
      ELSE 
kusano 2b45e8
         CTB = 'CblasConjTrans'
kusano 2b45e8
      END IF
kusano 2b45e8
      IF (IORDER.EQ.1)THEN
kusano 2b45e8
         CRC = ' CblasRowMajor'
kusano 2b45e8
      ELSE 
kusano 2b45e8
         CRC = ' CblasColMajor'
kusano 2b45e8
      END IF
kusano 2b45e8
      WRITE(NOUT, FMT = 9995)NC,SNAME,CRC, CTA,CTB
kusano 2b45e8
      WRITE(NOUT, FMT = 9994)M, N, K, ALPHA, LDA, LDB, BETA, LDC
kusano 2b45e8
kusano 2b45e8
 9995 FORMAT( 1X, I6, ': ', A12,'(', A14, ',', A14, ',', A14, ',')
kusano 2b45e8
 9994 FORMAT( 10X, 3( I3, ',' ) ,' (', F4.1,',',F4.1,') , A,',
kusano 2b45e8
     $ I3, ', B,', I3, ', (', F4.1,',',F4.1,') , C,', I3, ').' )
kusano 2b45e8
      END
kusano 2b45e8
*
kusano 2b45e8
      SUBROUTINE CCHK2( SNAME, EPS, THRESH, NOUT, NTRA, TRACE, REWI,
kusano 2b45e8
     $                  FATAL, NIDIM, IDIM, NALF, ALF, NBET, BET, NMAX,
kusano 2b45e8
     $                  A, AA, AS, B, BB, BS, C, CC, CS, CT, G, 
kusano 2b45e8
     $                  IORDER )
kusano 2b45e8
*
kusano 2b45e8
*  Tests CHEMM and CSYMM.
kusano 2b45e8
*
kusano 2b45e8
*  Auxiliary routine for test program for Level 3 Blas.
kusano 2b45e8
*
kusano 2b45e8
*  -- Written on 8-February-1989.
kusano 2b45e8
*     Jack Dongarra, Argonne National Laboratory.
kusano 2b45e8
*     Iain Duff, AERE Harwell.
kusano 2b45e8
*     Jeremy Du Croz, Numerical Algorithms Group Ltd.
kusano 2b45e8
*     Sven Hammarling, Numerical Algorithms Group Ltd.
kusano 2b45e8
*
kusano 2b45e8
*     .. Parameters ..
kusano 2b45e8
      COMPLEX            ZERO
kusano 2b45e8
      PARAMETER          ( ZERO = ( 0.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            NALF, NBET, NIDIM, NMAX, 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 ), B( NMAX, NMAX ),
kusano 2b45e8
     $                   BB( NMAX*NMAX ), BET( NBET ), BS( NMAX*NMAX ),
kusano 2b45e8
     $                   C( NMAX, NMAX ), CC( NMAX*NMAX ),
kusano 2b45e8
     $                   CS( NMAX*NMAX ), CT( NMAX )
kusano 2b45e8
      REAL               G( NMAX )
kusano 2b45e8
      INTEGER            IDIM( NIDIM )
kusano 2b45e8
*     .. Local Scalars ..
kusano 2b45e8
      COMPLEX            ALPHA, ALS, BETA, BLS
kusano 2b45e8
      REAL               ERR, ERRMAX
kusano 2b45e8
      INTEGER            I, IA, IB, ICS, ICU, IM, IN, LAA, LBB, LCC,
kusano 2b45e8
     $                   LDA, LDAS, LDB, LDBS, LDC, LDCS, M, MS, N, NA,
kusano 2b45e8
     $                   NARGS, NC, NS
kusano 2b45e8
      LOGICAL            CONJ, LEFT, NULL, RESET, SAME
kusano 2b45e8
      CHARACTER*1        SIDE, SIDES, UPLO, UPLOS
kusano 2b45e8
      CHARACTER*2        ICHS, ICHU
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           CCHEMM, CMAKE, CMMCH, CCSYMM
kusano 2b45e8
*     .. Intrinsic Functions ..
kusano 2b45e8
      INTRINSIC          MAX
kusano 2b45e8
*     .. Scalars in Common ..
kusano 2b45e8
      INTEGER            INFOT, NOUTC
kusano 2b45e8
      LOGICAL            LERR, OK
kusano 2b45e8
*     .. Common blocks ..
kusano 2b45e8
      COMMON             /INFOC/INFOT, NOUTC, OK, LERR
kusano 2b45e8
*     .. Data statements ..
kusano 2b45e8
      DATA               ICHS/'LR'/, ICHU/'UL'/
kusano 2b45e8
*     .. Executable Statements ..
kusano 2b45e8
      CONJ = SNAME( 8: 9 ).EQ.'he'
kusano 2b45e8
*
kusano 2b45e8
      NARGS = 12
kusano 2b45e8
      NC = 0
kusano 2b45e8
      RESET = .TRUE.
kusano 2b45e8
      ERRMAX = RZERO
kusano 2b45e8
*
kusano 2b45e8
      DO 100 IM = 1, NIDIM
kusano 2b45e8
         M = IDIM( IM )
kusano 2b45e8
*
kusano 2b45e8
         DO 90 IN = 1, NIDIM
kusano 2b45e8
            N = IDIM( IN )
kusano 2b45e8
*           Set LDC to 1 more than minimum value if room.
kusano 2b45e8
            LDC = M
kusano 2b45e8
            IF( LDC.LT.NMAX )
kusano 2b45e8
     $         LDC = LDC + 1
kusano 2b45e8
*           Skip tests if not enough room.
kusano 2b45e8
            IF( LDC.GT.NMAX )
kusano 2b45e8
     $         GO TO 90
kusano 2b45e8
            LCC = LDC*N
kusano 2b45e8
            NULL = N.LE.0.OR.M.LE.0
kusano 2b45e8
*           Set LDB to 1 more than minimum value if room.
kusano 2b45e8
            LDB = M
kusano 2b45e8
            IF( LDB.LT.NMAX )
kusano 2b45e8
     $         LDB = LDB + 1
kusano 2b45e8
*           Skip tests if not enough room.
kusano 2b45e8
            IF( LDB.GT.NMAX )
kusano 2b45e8
     $         GO TO 90
kusano 2b45e8
            LBB = LDB*N
kusano 2b45e8
*
kusano 2b45e8
*           Generate the matrix B.
kusano 2b45e8
*
kusano 2b45e8
            CALL CMAKE( 'ge', ' ', ' ', M, N, B, NMAX, BB, LDB, RESET,
kusano 2b45e8
     $                  ZERO )
kusano 2b45e8
*
kusano 2b45e8
            DO 80 ICS = 1, 2
kusano 2b45e8
               SIDE = ICHS( ICS: ICS )
kusano 2b45e8
               LEFT = SIDE.EQ.'L'
kusano 2b45e8
*
kusano 2b45e8
               IF( LEFT )THEN
kusano 2b45e8
                  NA = M
kusano 2b45e8
               ELSE
kusano 2b45e8
                  NA = N
kusano 2b45e8
               END IF
kusano 2b45e8
*              Set LDA to 1 more than minimum value if room.
kusano 2b45e8
               LDA = NA
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 80
kusano 2b45e8
               LAA = LDA*NA
kusano 2b45e8
*
kusano 2b45e8
               DO 70 ICU = 1, 2
kusano 2b45e8
                  UPLO = ICHU( ICU: ICU )
kusano 2b45e8
*
kusano 2b45e8
*                 Generate the hermitian or symmetric matrix A.
kusano 2b45e8
*
kusano 2b45e8
                  CALL CMAKE(SNAME( 8: 9 ), UPLO, ' ', NA, NA, A, NMAX,
kusano 2b45e8
     $                        AA, LDA, RESET, ZERO )
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 matrix C.
kusano 2b45e8
*
kusano 2b45e8
                        CALL CMAKE( 'ge', ' ', ' ', M, N, C, NMAX, CC,
kusano 2b45e8
     $                              LDC, RESET, ZERO )
kusano 2b45e8
*
kusano 2b45e8
                        NC = NC + 1
kusano 2b45e8
*
kusano 2b45e8
*                       Save every datum before calling the
kusano 2b45e8
*                       subroutine.
kusano 2b45e8
*
kusano 2b45e8
                        SIDES = SIDE
kusano 2b45e8
                        UPLOS = UPLO
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, LBB
kusano 2b45e8
                           BS( I ) = BB( I )
kusano 2b45e8
   20                   CONTINUE
kusano 2b45e8
                        LDBS = LDB
kusano 2b45e8
                        BLS = BETA
kusano 2b45e8
                        DO 30 I = 1, LCC
kusano 2b45e8
                           CS( I ) = CC( I )
kusano 2b45e8
   30                   CONTINUE
kusano 2b45e8
                        LDCS = LDC
kusano 2b45e8
*
kusano 2b45e8
*                       Call the subroutine.
kusano 2b45e8
*
kusano 2b45e8
                        IF( TRACE )
kusano 2b45e8
     $                      CALL CPRCN2(NTRA, NC, SNAME, IORDER, 
kusano 2b45e8
     $                      SIDE, UPLO, M, N, ALPHA, LDA, LDB, 
kusano 2b45e8
     $                      BETA, LDC) 
kusano 2b45e8
                        IF( REWI )
kusano 2b45e8
     $                     REWIND NTRA
kusano 2b45e8
                        IF( CONJ )THEN
kusano 2b45e8
                           CALL CCHEMM( IORDER, SIDE, UPLO, M, N,
kusano 2b45e8
     $                                 ALPHA, AA, LDA, BB, LDB, BETA,
kusano 2b45e8
     $                                 CC, LDC )
kusano 2b45e8
                        ELSE
kusano 2b45e8
                           CALL CCSYMM( IORDER, SIDE, UPLO, M, N,
kusano 2b45e8
     $                                 ALPHA, AA, LDA, BB, LDB, BETA,
kusano 2b45e8
     $                                 CC, LDC )
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 = 9994 )
kusano 2b45e8
                           FATAL = .TRUE.
kusano 2b45e8
                           GO TO 110
kusano 2b45e8
                        END IF
kusano 2b45e8
*
kusano 2b45e8
*                       See what data changed inside subroutines.
kusano 2b45e8
*
kusano 2b45e8
                        ISAME( 1 ) = SIDES.EQ.SIDE
kusano 2b45e8
                        ISAME( 2 ) = UPLOS.EQ.UPLO
kusano 2b45e8
                        ISAME( 3 ) = MS.EQ.M
kusano 2b45e8
                        ISAME( 4 ) = NS.EQ.N
kusano 2b45e8
                        ISAME( 5 ) = ALS.EQ.ALPHA
kusano 2b45e8
                        ISAME( 6 ) = LCE( AS, AA, LAA )
kusano 2b45e8
                        ISAME( 7 ) = LDAS.EQ.LDA
kusano 2b45e8
                        ISAME( 8 ) = LCE( BS, BB, LBB )
kusano 2b45e8
                        ISAME( 9 ) = LDBS.EQ.LDB
kusano 2b45e8
                        ISAME( 10 ) = BLS.EQ.BETA
kusano 2b45e8
                        IF( NULL )THEN
kusano 2b45e8
                           ISAME( 11 ) = LCE( CS, CC, LCC )
kusano 2b45e8
                        ELSE
kusano 2b45e8
                           ISAME( 11 ) = LCERES( 'ge', ' ', M, N, CS,
kusano 2b45e8
     $                                   CC, LDC )
kusano 2b45e8
                        END IF
kusano 2b45e8
                        ISAME( 12 ) = LDCS.EQ.LDC
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 110
kusano 2b45e8
                        END IF
kusano 2b45e8
*
kusano 2b45e8
                        IF( .NOT.NULL )THEN
kusano 2b45e8
*
kusano 2b45e8
*                          Check the result.
kusano 2b45e8
*
kusano 2b45e8
                           IF( LEFT )THEN
kusano 2b45e8
                              CALL CMMCH( 'N', 'N', M, N, M, ALPHA, A,
kusano 2b45e8
     $                                    NMAX, B, NMAX, BETA, C, NMAX,
kusano 2b45e8
     $                                    CT, G, CC, LDC, EPS, ERR,
kusano 2b45e8
     $                                    FATAL, NOUT, .TRUE. )
kusano 2b45e8
                           ELSE
kusano 2b45e8
                              CALL CMMCH( 'N', 'N', M, N, N, ALPHA, B,
kusano 2b45e8
     $                                    NMAX, A, NMAX, BETA, C, NMAX,
kusano 2b45e8
     $                                    CT, G, CC, LDC, EPS, ERR,
kusano 2b45e8
     $                                    FATAL, NOUT, .TRUE. )
kusano 2b45e8
                           END IF
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 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
*     Report result.
kusano 2b45e8
*
kusano 2b45e8
      IF( ERRMAX.LT.THRESH )THEN
kusano 2b45e8
         IF ( IORDER.EQ.0) WRITE( NOUT, FMT = 10000 )SNAME, NC
kusano 2b45e8
         IF ( IORDER.EQ.1) WRITE( NOUT, FMT = 10001 )SNAME, NC
kusano 2b45e8
      ELSE
kusano 2b45e8
         IF ( IORDER.EQ.0) WRITE( NOUT, FMT = 10002 )SNAME, NC, ERRMAX
kusano 2b45e8
         IF ( IORDER.EQ.1) WRITE( NOUT, FMT = 10003 )SNAME, NC, ERRMAX
kusano 2b45e8
      END IF
kusano 2b45e8
      GO TO 120
kusano 2b45e8
*
kusano 2b45e8
  110 CONTINUE
kusano 2b45e8
      WRITE( NOUT, FMT = 9996 )SNAME
kusano 2b45e8
      CALL CPRCN2(NOUT, NC, SNAME, IORDER, SIDE, UPLO, M, N, ALPHA, LDA,
kusano 2b45e8
     $           LDB, BETA, LDC) 
kusano 2b45e8
*
kusano 2b45e8
  120 CONTINUE
kusano 2b45e8
      RETURN
kusano 2b45e8
*
kusano 2b45e8
10003 FORMAT( ' ', A12,' COMPLETED THE ROW-MAJOR    COMPUTATIONAL ',
kusano 2b45e8
     $ 'TESTS (', I6, ' CALLS)', /' ******* BUT WITH MAXIMUM TEST ',
kusano 2b45e8
     $ 'RATIO ', F8.2, ' - SUSPECT *******' )
kusano 2b45e8
10002 FORMAT( ' ', A12,' COMPLETED THE COLUMN-MAJOR COMPUTATIONAL ',
kusano 2b45e8
     $ 'TESTS (', I6, ' CALLS)', /' ******* BUT WITH MAXIMUM TEST ',
kusano 2b45e8
     $ 'RATIO ', F8.2, ' - SUSPECT *******' )
kusano 2b45e8
10001 FORMAT( ' ', A12,' PASSED THE ROW-MAJOR    COMPUTATIONAL TESTS',
kusano 2b45e8
     $ ' (', I6, ' CALL', 'S)' )
kusano 2b45e8
10000 FORMAT( ' ', A12,' PASSED THE COLUMN-MAJOR COMPUTATIONAL TESTS',
kusano 2b45e8
     $ ' (', I6, ' CALL', 'S)' )
kusano 2b45e8
 9998 FORMAT(' ******* FATAL ERROR - PARAMETER NUMBER ', I2, ' WAS CH',
kusano 2b45e8
     $      'ANGED INCORRECTLY *******' )
kusano 2b45e8
 9996 FORMAT( ' ******* ', A12,' FAILED ON CALL NUMBER:' )
kusano 2b45e8
 9995 FORMAT(1X, I6, ': ', A12,'(', 2( '''', A1, ''',' ), 2( I3, ',' ),
kusano 2b45e8
     $      '(', F4.1, ',', F4.1, '), A,', I3, ', B,', I3, ',(', F4.1,
kusano 2b45e8
     $      ',', F4.1, '), C,', I3, ')    .' )
kusano 2b45e8
 9994 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
*
kusano 2b45e8
      SUBROUTINE CPRCN2(NOUT, NC, SNAME, IORDER, SIDE, UPLO, M, N,
kusano 2b45e8
     $                 ALPHA, LDA, LDB, BETA, LDC)
kusano 2b45e8
      INTEGER          NOUT, NC, IORDER, M, N, LDA, LDB, LDC
kusano 2b45e8
      COMPLEX          ALPHA, BETA
kusano 2b45e8
      CHARACTER*1      SIDE, UPLO
kusano 2b45e8
      CHARACTER*12     SNAME
kusano 2b45e8
      CHARACTER*14     CRC, CS,CU
kusano 2b45e8
      
kusano 2b45e8
      IF (SIDE.EQ.'L')THEN
kusano 2b45e8
         CS =  '     CblasLeft'
kusano 2b45e8
      ELSE 
kusano 2b45e8
         CS =  '    CblasRight'
kusano 2b45e8
      END IF
kusano 2b45e8
      IF (UPLO.EQ.'U')THEN
kusano 2b45e8
         CU =  '    CblasUpper'
kusano 2b45e8
      ELSE 
kusano 2b45e8
         CU =  '    CblasLower'
kusano 2b45e8
      END IF
kusano 2b45e8
      IF (IORDER.EQ.1)THEN
kusano 2b45e8
         CRC = ' CblasRowMajor'
kusano 2b45e8
      ELSE 
kusano 2b45e8
         CRC = ' CblasColMajor'
kusano 2b45e8
      END IF
kusano 2b45e8
      WRITE(NOUT, FMT = 9995)NC,SNAME,CRC, CS,CU
kusano 2b45e8
      WRITE(NOUT, FMT = 9994)M, N, ALPHA, LDA, LDB, BETA, LDC
kusano 2b45e8
kusano 2b45e8
 9995 FORMAT( 1X, I6, ': ', A12,'(', A14, ',', A14, ',', A14, ',')
kusano 2b45e8
 9994 FORMAT( 10X, 2( I3, ',' ),' (',F4.1,',',F4.1, '), A,', I3,
kusano 2b45e8
     $ ', B,', I3, ', (',F4.1,',',F4.1, '), ', 'C,', I3, ').' )
kusano 2b45e8
      END
kusano 2b45e8
*
kusano 2b45e8
      SUBROUTINE CCHK3( SNAME, EPS, THRESH, NOUT, NTRA, TRACE, REWI,
kusano 2b45e8
     $                  FATAL, NIDIM, IDIM, NALF, ALF, NMAX, A, AA, AS,
kusano 2b45e8
     $                  B, BB, BS, CT, G, C, IORDER )
kusano 2b45e8
*
kusano 2b45e8
*  Tests CTRMM and CTRSM.
kusano 2b45e8
*
kusano 2b45e8
*  Auxiliary routine for test program for Level 3 Blas.
kusano 2b45e8
*
kusano 2b45e8
*  -- Written on 8-February-1989.
kusano 2b45e8
*     Jack Dongarra, Argonne National Laboratory.
kusano 2b45e8
*     Iain Duff, AERE Harwell.
kusano 2b45e8
*     Jeremy Du Croz, Numerical Algorithms Group Ltd.
kusano 2b45e8
*     Sven Hammarling, Numerical Algorithms Group Ltd.
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
      REAL               RZERO
kusano 2b45e8
      PARAMETER          ( RZERO = 0.0 )
kusano 2b45e8
*     .. Scalar Arguments ..
kusano 2b45e8
      REAL               EPS, THRESH
kusano 2b45e8
      INTEGER            NALF, NIDIM, NMAX, 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 ), B( NMAX, NMAX ),
kusano 2b45e8
     $                   BB( NMAX*NMAX ), BS( NMAX*NMAX ),
kusano 2b45e8
     $                   C( NMAX, NMAX ), CT( NMAX )
kusano 2b45e8
      REAL               G( NMAX )
kusano 2b45e8
      INTEGER            IDIM( NIDIM )
kusano 2b45e8
*     .. Local Scalars ..
kusano 2b45e8
      COMPLEX            ALPHA, ALS
kusano 2b45e8
      REAL               ERR, ERRMAX
kusano 2b45e8
      INTEGER           I, IA, ICD, ICS, ICT, ICU, IM, IN, J, LAA, LBB,
kusano 2b45e8
     $                   LDA, LDAS, LDB, LDBS, M, MS, N, NA, NARGS, NC,
kusano 2b45e8
     $                   NS
kusano 2b45e8
      LOGICAL            LEFT, NULL, RESET, SAME
kusano 2b45e8
      CHARACTER*1       DIAG, DIAGS, SIDE, SIDES, TRANAS, TRANSA, UPLO,
kusano 2b45e8
     $                   UPLOS
kusano 2b45e8
      CHARACTER*2        ICHD, ICHS, 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, CMMCH, CCTRMM, CCTRSM
kusano 2b45e8
*     .. Intrinsic Functions ..
kusano 2b45e8
      INTRINSIC          MAX
kusano 2b45e8
*     .. Scalars in Common ..
kusano 2b45e8
      INTEGER            INFOT, NOUTC
kusano 2b45e8
      LOGICAL            LERR, OK
kusano 2b45e8
*     .. Common blocks ..
kusano 2b45e8
      COMMON             /INFOC/INFOT, NOUTC, OK, LERR
kusano 2b45e8
*     .. Data statements ..
kusano 2b45e8
      DATA              ICHU/'UL'/, ICHT/'NTC'/, ICHD/'UN'/, ICHS/'LR'/
kusano 2b45e8
*     .. Executable Statements ..
kusano 2b45e8
*
kusano 2b45e8
      NARGS = 11
kusano 2b45e8
      NC = 0
kusano 2b45e8
      RESET = .TRUE.
kusano 2b45e8
      ERRMAX = RZERO
kusano 2b45e8
*     Set up zero matrix for CMMCH.
kusano 2b45e8
      DO 20 J = 1, NMAX
kusano 2b45e8
         DO 10 I = 1, NMAX
kusano 2b45e8
            C( I, J ) = ZERO
kusano 2b45e8
   10    CONTINUE
kusano 2b45e8
   20 CONTINUE
kusano 2b45e8
*
kusano 2b45e8
      DO 140 IM = 1, NIDIM
kusano 2b45e8
         M = IDIM( IM )
kusano 2b45e8
*
kusano 2b45e8
         DO 130 IN = 1, NIDIM
kusano 2b45e8
            N = IDIM( IN )
kusano 2b45e8
*           Set LDB to 1 more than minimum value if room.
kusano 2b45e8
            LDB = M
kusano 2b45e8
            IF( LDB.LT.NMAX )
kusano 2b45e8
     $         LDB = LDB + 1
kusano 2b45e8
*           Skip tests if not enough room.
kusano 2b45e8
            IF( LDB.GT.NMAX )
kusano 2b45e8
     $         GO TO 130
kusano 2b45e8
            LBB = LDB*N
kusano 2b45e8
            NULL = M.LE.0.OR.N.LE.0
kusano 2b45e8
*
kusano 2b45e8
            DO 120 ICS = 1, 2
kusano 2b45e8
               SIDE = ICHS( ICS: ICS )
kusano 2b45e8
               LEFT = SIDE.EQ.'L'
kusano 2b45e8
               IF( LEFT )THEN
kusano 2b45e8
                  NA = M
kusano 2b45e8
               ELSE
kusano 2b45e8
                  NA = N
kusano 2b45e8
               END IF
kusano 2b45e8
*              Set LDA to 1 more than minimum value if room.
kusano 2b45e8
               LDA = NA
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 130
kusano 2b45e8
               LAA = LDA*NA
kusano 2b45e8
*
kusano 2b45e8
               DO 110 ICU = 1, 2
kusano 2b45e8
                  UPLO = ICHU( ICU: ICU )
kusano 2b45e8
*
kusano 2b45e8
                  DO 100 ICT = 1, 3
kusano 2b45e8
                     TRANSA = ICHT( ICT: ICT )
kusano 2b45e8
*
kusano 2b45e8
                     DO 90 ICD = 1, 2
kusano 2b45e8
                        DIAG = ICHD( ICD: ICD )
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
                           CALL CMAKE( 'tr', UPLO, DIAG, NA, NA, A,
kusano 2b45e8
     $                                 NMAX, AA, LDA, RESET, ZERO )
kusano 2b45e8
*
kusano 2b45e8
*                          Generate the matrix B.
kusano 2b45e8
*
kusano 2b45e8
                           CALL CMAKE( 'ge', ' ', ' ', M, N, B, NMAX,
kusano 2b45e8
     $                                 BB, LDB, RESET, ZERO )
kusano 2b45e8
*
kusano 2b45e8
                           NC = NC + 1
kusano 2b45e8
*
kusano 2b45e8
*                          Save every datum before calling the
kusano 2b45e8
*                          subroutine.
kusano 2b45e8
*
kusano 2b45e8
                           SIDES = SIDE
kusano 2b45e8
                           UPLOS = UPLO
kusano 2b45e8
                           TRANAS = TRANSA
kusano 2b45e8
                           DIAGS = DIAG
kusano 2b45e8
                           MS = M
kusano 2b45e8
                           NS = N
kusano 2b45e8
                           ALS = ALPHA
kusano 2b45e8
                           DO 30 I = 1, LAA
kusano 2b45e8
                              AS( I ) = AA( I )
kusano 2b45e8
   30                      CONTINUE
kusano 2b45e8
                           LDAS = LDA
kusano 2b45e8
                           DO 40 I = 1, LBB
kusano 2b45e8
                              BS( I ) = BB( I )
kusano 2b45e8
   40                      CONTINUE
kusano 2b45e8
                           LDBS = LDB
kusano 2b45e8
*
kusano 2b45e8
*                          Call the subroutine.
kusano 2b45e8
*
kusano 2b45e8
                           IF( SNAME( 10: 11 ).EQ.'mm' )THEN
kusano 2b45e8
                              IF( TRACE )
kusano 2b45e8
     $                           CALL CPRCN3( NTRA, NC, SNAME, IORDER,
kusano 2b45e8
     $                           SIDE, UPLO, TRANSA, DIAG, M, N, ALPHA,
kusano 2b45e8
     $                           LDA, LDB)
kusano 2b45e8
                              IF( REWI )
kusano 2b45e8
     $                           REWIND NTRA
kusano 2b45e8
                              CALL CCTRMM(IORDER, SIDE, UPLO, TRANSA,
kusano 2b45e8
     $                                    DIAG, M, N, ALPHA, AA, LDA,
kusano 2b45e8
     $                                    BB, LDB )
kusano 2b45e8
                           ELSE IF( SNAME( 10: 11 ).EQ.'sm' )THEN
kusano 2b45e8
                              IF( TRACE )
kusano 2b45e8
     $                           CALL CPRCN3( NTRA, NC, SNAME, IORDER,
kusano 2b45e8
     $                           SIDE, UPLO, TRANSA, DIAG, M, N, ALPHA,
kusano 2b45e8
     $                           LDA, LDB)
kusano 2b45e8
                              IF( REWI )
kusano 2b45e8
     $                           REWIND NTRA
kusano 2b45e8
                              CALL CCTRSM(IORDER, SIDE, UPLO, TRANSA,
kusano 2b45e8
     $                                   DIAG, M, N, ALPHA, AA, LDA,
kusano 2b45e8
     $                                   BB, LDB )
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 = 9994 )
kusano 2b45e8
                              FATAL = .TRUE.
kusano 2b45e8
                              GO TO 150
kusano 2b45e8
                           END IF
kusano 2b45e8
*
kusano 2b45e8
*                          See what data changed inside subroutines.
kusano 2b45e8
*
kusano 2b45e8
                           ISAME( 1 ) = SIDES.EQ.SIDE
kusano 2b45e8
                           ISAME( 2 ) = UPLOS.EQ.UPLO
kusano 2b45e8
                           ISAME( 3 ) = TRANAS.EQ.TRANSA
kusano 2b45e8
                           ISAME( 4 ) = DIAGS.EQ.DIAG
kusano 2b45e8
                           ISAME( 5 ) = MS.EQ.M
kusano 2b45e8
                           ISAME( 6 ) = NS.EQ.N
kusano 2b45e8
                           ISAME( 7 ) = ALS.EQ.ALPHA
kusano 2b45e8
                           ISAME( 8 ) = LCE( AS, AA, LAA )
kusano 2b45e8
                           ISAME( 9 ) = LDAS.EQ.LDA
kusano 2b45e8
                           IF( NULL )THEN
kusano 2b45e8
                              ISAME( 10 ) = LCE( BS, BB, LBB )
kusano 2b45e8
                           ELSE
kusano 2b45e8
                             ISAME( 10 ) = LCERES( 'ge', ' ', M, N, BS,
kusano 2b45e8
     $                                      BB, LDB )
kusano 2b45e8
                           END IF
kusano 2b45e8
                           ISAME( 11 ) = LDBS.EQ.LDB
kusano 2b45e8
*
kusano 2b45e8
*                          If data was incorrectly changed, report and
kusano 2b45e8
*                          return.
kusano 2b45e8
*
kusano 2b45e8
                           SAME = .TRUE.
kusano 2b45e8
                           DO 50 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
   50                      CONTINUE
kusano 2b45e8
                           IF( .NOT.SAME )THEN
kusano 2b45e8
                              FATAL = .TRUE.
kusano 2b45e8
                              GO TO 150
kusano 2b45e8
                           END IF
kusano 2b45e8
*
kusano 2b45e8
                           IF( .NOT.NULL )THEN
kusano 2b45e8
                              IF( SNAME( 10: 11 ).EQ.'mm' )THEN
kusano 2b45e8
*
kusano 2b45e8
*                                Check the result.
kusano 2b45e8
*
kusano 2b45e8
                                 IF( LEFT )THEN
kusano 2b45e8
                                   CALL CMMCH( TRANSA, 'N', M, N, M,
kusano 2b45e8
     $                                         ALPHA, A, NMAX, B, NMAX,
kusano 2b45e8
     $                                          ZERO, C, NMAX, CT, G,
kusano 2b45e8
     $                                          BB, LDB, EPS, ERR,
kusano 2b45e8
     $                                          FATAL, NOUT, .TRUE. )
kusano 2b45e8
                                 ELSE
kusano 2b45e8
                                    CALL CMMCH( 'N', TRANSA, M, N, N,
kusano 2b45e8
     $                                         ALPHA, B, NMAX, A, NMAX,
kusano 2b45e8
     $                                          ZERO, C, NMAX, CT, G,
kusano 2b45e8
     $                                          BB, LDB, EPS, ERR,
kusano 2b45e8
     $                                          FATAL, NOUT, .TRUE. )
kusano 2b45e8
                                 END IF
kusano 2b45e8
                              ELSE IF( SNAME( 10: 11 ).EQ.'sm' )THEN
kusano 2b45e8
*
kusano 2b45e8
*                                Compute approximation to original
kusano 2b45e8
*                                matrix.
kusano 2b45e8
*
kusano 2b45e8
                                 DO 70 J = 1, N
kusano 2b45e8
                                    DO 60 I = 1, M
kusano 2b45e8
                                       C( I, J ) = BB( I + ( J - 1 )*
kusano 2b45e8
     $                                             LDB )
kusano 2b45e8
                                       BB( I + ( J - 1 )*LDB ) = ALPHA*
kusano 2b45e8
     $                                    B( I, J )
kusano 2b45e8
   60                               CONTINUE
kusano 2b45e8
   70                            CONTINUE
kusano 2b45e8
*
kusano 2b45e8
                                 IF( LEFT )THEN
kusano 2b45e8
                                    CALL CMMCH( TRANSA, 'N', M, N, M,
kusano 2b45e8
     $                                          ONE, A, NMAX, C, NMAX,
kusano 2b45e8
     $                                          ZERO, B, NMAX, CT, G,
kusano 2b45e8
     $                                          BB, LDB, EPS, ERR,
kusano 2b45e8
     $                                          FATAL, NOUT, .FALSE. )
kusano 2b45e8
                                 ELSE
kusano 2b45e8
                                    CALL CMMCH( 'N', TRANSA, M, N, N,
kusano 2b45e8
     $                                          ONE, C, NMAX, A, NMAX,
kusano 2b45e8
     $                                          ZERO, B, NMAX, CT, G,
kusano 2b45e8
     $                                          BB, LDB, EPS, ERR,
kusano 2b45e8
     $                                          FATAL, NOUT, .FALSE. )
kusano 2b45e8
                                 END IF
kusano 2b45e8
                              END IF
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 150
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
  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
         IF ( IORDER.EQ.0) WRITE( NOUT, FMT = 10000 )SNAME, NC
kusano 2b45e8
         IF ( IORDER.EQ.1) WRITE( NOUT, FMT = 10001 )SNAME, NC
kusano 2b45e8
      ELSE
kusano 2b45e8
         IF ( IORDER.EQ.0) WRITE( NOUT, FMT = 10002 )SNAME, NC, ERRMAX
kusano 2b45e8
         IF ( IORDER.EQ.1) WRITE( NOUT, FMT = 10003 )SNAME, NC, ERRMAX
kusano 2b45e8
      END IF
kusano 2b45e8
      GO TO 160
kusano 2b45e8
*
kusano 2b45e8
  150 CONTINUE
kusano 2b45e8
      WRITE( NOUT, FMT = 9996 )SNAME
kusano 2b45e8
      CALL CPRCN3( NTRA, NC, SNAME, IORDER, SIDE, UPLO, TRANSA, DIAG,
kusano 2b45e8
     $      M, N, ALPHA, LDA, LDB)
kusano 2b45e8
*
kusano 2b45e8
  160 CONTINUE
kusano 2b45e8
      RETURN
kusano 2b45e8
*
kusano 2b45e8
10003 FORMAT( ' ', A12,' COMPLETED THE ROW-MAJOR    COMPUTATIONAL ',
kusano 2b45e8
     $ 'TESTS (', I6, ' CALLS)', /' ******* BUT WITH MAXIMUM TEST ',
kusano 2b45e8
     $ 'RATIO ', F8.2, ' - SUSPECT *******' )
kusano 2b45e8
10002 FORMAT( ' ', A12,' COMPLETED THE COLUMN-MAJOR COMPUTATIONAL ',
kusano 2b45e8
     $ 'TESTS (', I6, ' CALLS)', /' ******* BUT WITH MAXIMUM TEST ',
kusano 2b45e8
     $ 'RATIO ', F8.2, ' - SUSPECT *******' )
kusano 2b45e8
10001 FORMAT( ' ', A12,' PASSED THE ROW-MAJOR    COMPUTATIONAL TESTS',
kusano 2b45e8
     $ ' (', I6, ' CALL', 'S)' )
kusano 2b45e8
10000 FORMAT( ' ', A12,' PASSED THE COLUMN-MAJOR COMPUTATIONAL TESTS',
kusano 2b45e8
     $ ' (', I6, ' CALL', 'S)' )
kusano 2b45e8
 9998 FORMAT(' ******* FATAL ERROR - PARAMETER NUMBER ', I2, ' WAS CH',
kusano 2b45e8
     $      'ANGED INCORRECTLY *******' )
kusano 2b45e8
 9996 FORMAT(' ******* ', A12,' FAILED ON CALL NUMBER:' )
kusano 2b45e8
 9995 FORMAT(1X, I6, ': ', A12,'(', 4( '''', A1, ''',' ), 2( I3, ',' ),
kusano 2b45e8
     $     '(', F4.1, ',', F4.1, '), A,', I3, ', B,', I3, ')         ',
kusano 2b45e8
     $      '      .' )
kusano 2b45e8
 9994 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
*
kusano 2b45e8
      SUBROUTINE CPRCN3(NOUT, NC, SNAME, IORDER, SIDE, UPLO, TRANSA,
kusano 2b45e8
     $                 DIAG, M, N, ALPHA, LDA, LDB)
kusano 2b45e8
      INTEGER          NOUT, NC, IORDER, M, N, LDA, LDB
kusano 2b45e8
      COMPLEX          ALPHA
kusano 2b45e8
      CHARACTER*1      SIDE, UPLO, TRANSA, DIAG
kusano 2b45e8
      CHARACTER*12     SNAME
kusano 2b45e8
      CHARACTER*14     CRC, CS, CU, CA, CD
kusano 2b45e8
      
kusano 2b45e8
      IF (SIDE.EQ.'L')THEN
kusano 2b45e8
         CS =  '     CblasLeft'
kusano 2b45e8
      ELSE 
kusano 2b45e8
         CS =  '    CblasRight'
kusano 2b45e8
      END IF
kusano 2b45e8
      IF (UPLO.EQ.'U')THEN
kusano 2b45e8
         CU =  '    CblasUpper'
kusano 2b45e8
      ELSE 
kusano 2b45e8
         CU =  '    CblasLower'
kusano 2b45e8
      END IF
kusano 2b45e8
      IF (TRANSA.EQ.'N')THEN
kusano 2b45e8
         CA =  '  CblasNoTrans'
kusano 2b45e8
      ELSE IF (TRANSA.EQ.'T')THEN
kusano 2b45e8
         CA =  '    CblasTrans'
kusano 2b45e8
      ELSE 
kusano 2b45e8
         CA =  'CblasConjTrans'
kusano 2b45e8
      END IF
kusano 2b45e8
      IF (DIAG.EQ.'N')THEN
kusano 2b45e8
         CD =  '  CblasNonUnit'
kusano 2b45e8
      ELSE
kusano 2b45e8
         CD =  '     CblasUnit'
kusano 2b45e8
      END IF
kusano 2b45e8
      IF (IORDER.EQ.1)THEN
kusano 2b45e8
         CRC = ' CblasRowMajor'
kusano 2b45e8
      ELSE 
kusano 2b45e8
         CRC = ' CblasColMajor'
kusano 2b45e8
      END IF
kusano 2b45e8
      WRITE(NOUT, FMT = 9995)NC,SNAME,CRC, CS,CU
kusano 2b45e8
      WRITE(NOUT, FMT = 9994)CA, CD, M, N, ALPHA, LDA, LDB
kusano 2b45e8
kusano 2b45e8
 9995 FORMAT( 1X, I6, ': ', A12,'(', A14, ',', A14, ',', A14, ',')
kusano 2b45e8
 9994 FORMAT( 10X, 2( A14, ',') , 2( I3, ',' ), ' (', F4.1, ',',
kusano 2b45e8
     $    F4.1, '), A,', I3, ', B,', I3, ').' )
kusano 2b45e8
      END
kusano 2b45e8
*
kusano 2b45e8
      SUBROUTINE CCHK4( SNAME, EPS, THRESH, NOUT, NTRA, TRACE, REWI,
kusano 2b45e8
     $                  FATAL, NIDIM, IDIM, NALF, ALF, NBET, BET, NMAX,
kusano 2b45e8
     $                  A, AA, AS, B, BB, BS, C, CC, CS, CT, G,
kusano 2b45e8
     $                  IORDER )
kusano 2b45e8
*
kusano 2b45e8
*  Tests CHERK and CSYRK.
kusano 2b45e8
*
kusano 2b45e8
*  Auxiliary routine for test program for Level 3 Blas.
kusano 2b45e8
*
kusano 2b45e8
*  -- Written on 8-February-1989.
kusano 2b45e8
*     Jack Dongarra, Argonne National Laboratory.
kusano 2b45e8
*     Iain Duff, AERE Harwell.
kusano 2b45e8
*     Jeremy Du Croz, Numerical Algorithms Group Ltd.
kusano 2b45e8
*     Sven Hammarling, Numerical Algorithms Group Ltd.
kusano 2b45e8
*
kusano 2b45e8
*     .. Parameters ..
kusano 2b45e8
      COMPLEX            ZERO
kusano 2b45e8
      PARAMETER          ( ZERO = ( 0.0, 0.0 ) )
kusano 2b45e8
      REAL               RONE, RZERO
kusano 2b45e8
      PARAMETER          ( RONE = 1.0, RZERO = 0.0 )
kusano 2b45e8
*     .. Scalar Arguments ..
kusano 2b45e8
      REAL               EPS, THRESH
kusano 2b45e8
      INTEGER            NALF, NBET, NIDIM, NMAX, 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 ), B( NMAX, NMAX ),
kusano 2b45e8
     $                   BB( NMAX*NMAX ), BET( NBET ), BS( NMAX*NMAX ),
kusano 2b45e8
     $                   C( NMAX, NMAX ), CC( NMAX*NMAX ),
kusano 2b45e8
     $                   CS( NMAX*NMAX ), CT( NMAX )
kusano 2b45e8
      REAL               G( NMAX )
kusano 2b45e8
      INTEGER            IDIM( NIDIM )
kusano 2b45e8
*     .. Local Scalars ..
kusano 2b45e8
      COMPLEX            ALPHA, ALS, BETA, BETS
kusano 2b45e8
      REAL               ERR, ERRMAX, RALPHA, RALS, RBETA, RBETS
kusano 2b45e8
      INTEGER            I, IA, IB, ICT, ICU, IK, IN, J, JC, JJ, K, KS,
kusano 2b45e8
     $                   LAA, LCC, LDA, LDAS, LDC, LDCS, LJ, MA, N, NA,
kusano 2b45e8
     $                   NARGS, NC, NS
kusano 2b45e8
      LOGICAL            CONJ, NULL, RESET, SAME, TRAN, UPPER
kusano 2b45e8
      CHARACTER*1        TRANS, TRANSS, TRANST, UPLO, UPLOS
kusano 2b45e8
      CHARACTER*2        ICHT, ICHU
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           CCHERK, CMAKE, CMMCH, CCSYRK
kusano 2b45e8
*     .. Intrinsic Functions ..
kusano 2b45e8
      INTRINSIC          CMPLX, MAX, REAL
kusano 2b45e8
*     .. Scalars in Common ..
kusano 2b45e8
      INTEGER            INFOT, NOUTC
kusano 2b45e8
      LOGICAL            LERR, OK
kusano 2b45e8
*     .. Common blocks ..
kusano 2b45e8
      COMMON             /INFOC/INFOT, NOUTC, OK, LERR
kusano 2b45e8
*     .. Data statements ..
kusano 2b45e8
      DATA               ICHT/'NC'/, ICHU/'UL'/
kusano 2b45e8
*     .. Executable Statements ..
kusano 2b45e8
      CONJ = SNAME( 8: 9 ).EQ.'he'
kusano 2b45e8
*
kusano 2b45e8
      NARGS = 10
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 LDC to 1 more than minimum value if room.
kusano 2b45e8
         LDC = N
kusano 2b45e8
         IF( LDC.LT.NMAX )
kusano 2b45e8
     $      LDC = LDC + 1
kusano 2b45e8
*        Skip tests if not enough room.
kusano 2b45e8
         IF( LDC.GT.NMAX )
kusano 2b45e8
     $      GO TO 100
kusano 2b45e8
         LCC = LDC*N
kusano 2b45e8
*
kusano 2b45e8
         DO 90 IK = 1, NIDIM
kusano 2b45e8
            K = IDIM( IK )
kusano 2b45e8
*
kusano 2b45e8
            DO 80 ICT = 1, 2
kusano 2b45e8
               TRANS = ICHT( ICT: ICT )
kusano 2b45e8
               TRAN = TRANS.EQ.'C'
kusano 2b45e8
               IF( TRAN.AND..NOT.CONJ )
kusano 2b45e8
     $            TRANS = 'T'
kusano 2b45e8
               IF( TRAN )THEN
kusano 2b45e8
                  MA = K
kusano 2b45e8
                  NA = N
kusano 2b45e8
               ELSE
kusano 2b45e8
                  MA = N
kusano 2b45e8
                  NA = K
kusano 2b45e8
               END IF
kusano 2b45e8
*              Set LDA to 1 more than minimum value if room.
kusano 2b45e8
               LDA = MA
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 80
kusano 2b45e8
               LAA = LDA*NA
kusano 2b45e8
*
kusano 2b45e8
*              Generate the matrix A.
kusano 2b45e8
*
kusano 2b45e8
               CALL CMAKE( 'ge', ' ', ' ', MA, NA, A, NMAX, AA, LDA,
kusano 2b45e8
     $                     RESET, ZERO )
kusano 2b45e8
*
kusano 2b45e8
               DO 70 ICU = 1, 2
kusano 2b45e8
                  UPLO = ICHU( ICU: ICU )
kusano 2b45e8
                  UPPER = UPLO.EQ.'U'
kusano 2b45e8
*
kusano 2b45e8
                  DO 60 IA = 1, NALF
kusano 2b45e8
                     ALPHA = ALF( IA )
kusano 2b45e8
                     IF( CONJ )THEN
kusano 2b45e8
                        RALPHA = REAL( ALPHA )
kusano 2b45e8
                        ALPHA = CMPLX( RALPHA, RZERO )
kusano 2b45e8
                     END IF
kusano 2b45e8
*
kusano 2b45e8
                     DO 50 IB = 1, NBET
kusano 2b45e8
                        BETA = BET( IB )
kusano 2b45e8
                        IF( CONJ )THEN
kusano 2b45e8
                           RBETA = REAL( BETA )
kusano 2b45e8
                           BETA = CMPLX( RBETA, RZERO )
kusano 2b45e8
                        END IF
kusano 2b45e8
                        NULL = N.LE.0
kusano 2b45e8
                        IF( CONJ )
kusano 2b45e8
     $                     NULL = NULL.OR.( ( K.LE.0.OR.RALPHA.EQ.
kusano 2b45e8
     $                            RZERO ).AND.RBETA.EQ.RONE )
kusano 2b45e8
*
kusano 2b45e8
*                       Generate the matrix C.
kusano 2b45e8
*
kusano 2b45e8
                        CALL CMAKE( SNAME( 8: 9 ), UPLO, ' ', N, N, C,
kusano 2b45e8
     $                              NMAX, CC, LDC, RESET, ZERO )
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
                        NS = N
kusano 2b45e8
                        KS = K
kusano 2b45e8
                        IF( CONJ )THEN
kusano 2b45e8
                           RALS = RALPHA
kusano 2b45e8
                        ELSE
kusano 2b45e8
                           ALS = ALPHA
kusano 2b45e8
                        END IF
kusano 2b45e8
                        DO 10 I = 1, LAA
kusano 2b45e8
                           AS( I ) = AA( I )
kusano 2b45e8
   10                   CONTINUE
kusano 2b45e8
                        LDAS = LDA
kusano 2b45e8
                        IF( CONJ )THEN
kusano 2b45e8
                           RBETS = RBETA
kusano 2b45e8
                        ELSE
kusano 2b45e8
                           BETS = BETA
kusano 2b45e8
                        END IF
kusano 2b45e8
                        DO 20 I = 1, LCC
kusano 2b45e8
                           CS( I ) = CC( I )
kusano 2b45e8
   20                   CONTINUE
kusano 2b45e8
                        LDCS = LDC
kusano 2b45e8
*
kusano 2b45e8
*                       Call the subroutine.
kusano 2b45e8
*
kusano 2b45e8
                        IF( CONJ )THEN
kusano 2b45e8
                           IF( TRACE )
kusano 2b45e8
     $                        CALL CPRCN6( NTRA, NC, SNAME, IORDER,
kusano 2b45e8
     $                        UPLO, TRANS, N, K, RALPHA, LDA, RBETA,
kusano 2b45e8
     $                        LDC)
kusano 2b45e8
                           IF( REWI )
kusano 2b45e8
     $                        REWIND NTRA
kusano 2b45e8
                           CALL CCHERK( IORDER, UPLO, TRANS, N, K,
kusano 2b45e8
     $                                 RALPHA, AA, LDA, RBETA, CC,
kusano 2b45e8
     $                                 LDC )
kusano 2b45e8
                        ELSE
kusano 2b45e8
                           IF( TRACE )
kusano 2b45e8
     $                        CALL CPRCN4( NTRA, NC, SNAME, IORDER,
kusano 2b45e8
     $                        UPLO, TRANS, N, K, ALPHA, LDA, BETA, LDC)
kusano 2b45e8
                           IF( REWI )
kusano 2b45e8
     $                        REWIND NTRA
kusano 2b45e8
                           CALL CCSYRK( IORDER, UPLO, TRANS, N, K,
kusano 2b45e8
     $                                 ALPHA, AA, LDA, BETA, CC, LDC )
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 ) = UPLOS.EQ.UPLO
kusano 2b45e8
                        ISAME( 2 ) = TRANSS.EQ.TRANS
kusano 2b45e8
                        ISAME( 3 ) = NS.EQ.N
kusano 2b45e8
                        ISAME( 4 ) = KS.EQ.K
kusano 2b45e8
                        IF( CONJ )THEN
kusano 2b45e8
                           ISAME( 5 ) = RALS.EQ.RALPHA
kusano 2b45e8
                        ELSE
kusano 2b45e8
                           ISAME( 5 ) = ALS.EQ.ALPHA
kusano 2b45e8
                        END IF
kusano 2b45e8
                        ISAME( 6 ) = LCE( AS, AA, LAA )
kusano 2b45e8
                        ISAME( 7 ) = LDAS.EQ.LDA
kusano 2b45e8
                        IF( CONJ )THEN
kusano 2b45e8
                           ISAME( 8 ) = RBETS.EQ.RBETA
kusano 2b45e8
                        ELSE
kusano 2b45e8
                           ISAME( 8 ) = BETS.EQ.BETA
kusano 2b45e8
                        END IF
kusano 2b45e8
                        IF( NULL )THEN
kusano 2b45e8
                           ISAME( 9 ) = LCE( CS, CC, LCC )
kusano 2b45e8
                        ELSE
kusano 2b45e8
                           ISAME( 9 ) = LCERES( SNAME( 8: 9 ), UPLO, N,
kusano 2b45e8
     $                                  N, CS, CC, LDC )
kusano 2b45e8
                        END IF
kusano 2b45e8
                        ISAME( 10 ) = LDCS.EQ.LDC
kusano 2b45e8
*
kusano 2b45e8
*                       If data was incorrectly changed, report and
kusano 2b45e8
*                       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( CONJ )THEN
kusano 2b45e8
                              TRANST = 'C'
kusano 2b45e8
                           ELSE
kusano 2b45e8
                              TRANST = 'T'
kusano 2b45e8
                           END IF
kusano 2b45e8
                           JC = 1
kusano 2b45e8
                           DO 40 J = 1, N
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
                              IF( TRAN )THEN
kusano 2b45e8
                                 CALL CMMCH( TRANST, 'N', LJ, 1, K,
kusano 2b45e8
     $                                       ALPHA, A( 1, JJ ), NMAX,
kusano 2b45e8
     $                                       A( 1, J ), NMAX, BETA,
kusano 2b45e8
     $                                       C( JJ, J ), NMAX, CT, G,
kusano 2b45e8
     $                                       CC( JC ), LDC, EPS, ERR,
kusano 2b45e8
     $                                       FATAL, NOUT, .TRUE. )
kusano 2b45e8
                              ELSE
kusano 2b45e8
                                 CALL CMMCH( 'N', TRANST, LJ, 1, K,
kusano 2b45e8
     $                                       ALPHA, A( JJ, 1 ), NMAX,
kusano 2b45e8
     $                                       A( J, 1 ), NMAX, BETA,
kusano 2b45e8
     $                                       C( JJ, J ), NMAX, CT, G,
kusano 2b45e8
     $                                       CC( JC ), LDC, EPS, ERR,
kusano 2b45e8
     $                                       FATAL, NOUT, .TRUE. )
kusano 2b45e8
                              END IF
kusano 2b45e8
                              IF( UPPER )THEN
kusano 2b45e8
                                 JC = JC + LDC
kusano 2b45e8
                              ELSE
kusano 2b45e8
                                 JC = JC + LDC + 1
kusano 2b45e8
                              END IF
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 110
kusano 2b45e8
   40                      CONTINUE
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
*     Report result.
kusano 2b45e8
*
kusano 2b45e8
      IF( ERRMAX.LT.THRESH )THEN
kusano 2b45e8
         IF ( IORDER.EQ.0) WRITE( NOUT, FMT = 10000 )SNAME, NC
kusano 2b45e8
         IF ( IORDER.EQ.1) WRITE( NOUT, FMT = 10001 )SNAME, NC
kusano 2b45e8
      ELSE
kusano 2b45e8
         IF ( IORDER.EQ.0) WRITE( NOUT, FMT = 10002 )SNAME, NC, ERRMAX
kusano 2b45e8
         IF ( IORDER.EQ.1) WRITE( NOUT, FMT = 10003 )SNAME, NC, ERRMAX
kusano 2b45e8
      END IF
kusano 2b45e8
      GO TO 130
kusano 2b45e8
*
kusano 2b45e8
  110 CONTINUE
kusano 2b45e8
      IF( N.GT.1 )
kusano 2b45e8
     $   WRITE( NOUT, FMT = 9995 )J
kusano 2b45e8
*
kusano 2b45e8
  120 CONTINUE
kusano 2b45e8
      WRITE( NOUT, FMT = 9996 )SNAME
kusano 2b45e8
      IF( CONJ )THEN
kusano 2b45e8
      CALL CPRCN6( NOUT, NC, SNAME, IORDER, UPLO, TRANS, N, K, RALPHA,
kusano 2b45e8
     $   LDA, rBETA, LDC)
kusano 2b45e8
      ELSE
kusano 2b45e8
      CALL CPRCN4( NOUT, NC, SNAME, IORDER, UPLO, TRANS, N, K, ALPHA,
kusano 2b45e8
     $   LDA, BETA, LDC)
kusano 2b45e8
      END IF
kusano 2b45e8
*
kusano 2b45e8
  130 CONTINUE
kusano 2b45e8
      RETURN
kusano 2b45e8
*
kusano 2b45e8
10003 FORMAT( ' ', A12,' COMPLETED THE ROW-MAJOR    COMPUTATIONAL ',
kusano 2b45e8
     $ 'TESTS (', I6, ' CALLS)', /' ******* BUT WITH MAXIMUM TEST ',
kusano 2b45e8
     $ 'RATIO ', F8.2, ' - SUSPECT *******' )
kusano 2b45e8
10002 FORMAT( ' ', A12,' COMPLETED THE COLUMN-MAJOR COMPUTATIONAL ',
kusano 2b45e8
     $ 'TESTS (', I6, ' CALLS)', /' ******* BUT WITH MAXIMUM TEST ',
kusano 2b45e8
     $ 'RATIO ', F8.2, ' - SUSPECT *******' )
kusano 2b45e8
10001 FORMAT( ' ', A12,' PASSED THE ROW-MAJOR    COMPUTATIONAL TESTS',
kusano 2b45e8
     $ ' (', I6, ' CALL', 'S)' )
kusano 2b45e8
10000 FORMAT( ' ', A12,' PASSED THE COLUMN-MAJOR COMPUTATIONAL TESTS',
kusano 2b45e8
     $ ' (', I6, ' CALL', 'S)' )
kusano 2b45e8
 9998 FORMAT(' ******* FATAL ERROR - PARAMETER NUMBER ', I2, ' WAS CH',
kusano 2b45e8
     $      'ANGED INCORRECTLY *******' )
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( '''', A1, ''',' ), 2( I3, ',' ),
kusano 2b45e8
     $     F4.1, ', A,', I3, ',', F4.1, ', C,', I3, ')               ',
kusano 2b45e8
     $      '          .' )
kusano 2b45e8
 9993 FORMAT(1X, I6, ': ', A12,'(', 2( '''', A1, ''',' ), 2( I3, ',' ),
kusano 2b45e8
     $      '(', F4.1, ',', F4.1, ') , A,', I3, ',(', F4.1, ',', F4.1,
kusano 2b45e8
     $      '), C,', I3, ')          .' )
kusano 2b45e8
 9992 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
*
kusano 2b45e8
      SUBROUTINE CPRCN4(NOUT, NC, SNAME, IORDER, UPLO, TRANSA,
kusano 2b45e8
     $                 N, K, ALPHA, LDA, BETA, LDC)
kusano 2b45e8
      INTEGER          NOUT, NC, IORDER, N, K, LDA, LDC
kusano 2b45e8
      COMPLEX          ALPHA, BETA
kusano 2b45e8
      CHARACTER*1      UPLO, TRANSA
kusano 2b45e8
      CHARACTER*12     SNAME
kusano 2b45e8
      CHARACTER*14     CRC, CU, CA
kusano 2b45e8
      
kusano 2b45e8
      IF (UPLO.EQ.'U')THEN
kusano 2b45e8
         CU =  '    CblasUpper'
kusano 2b45e8
      ELSE 
kusano 2b45e8
         CU =  '    CblasLower'
kusano 2b45e8
      END IF
kusano 2b45e8
      IF (TRANSA.EQ.'N')THEN
kusano 2b45e8
         CA =  '  CblasNoTrans'
kusano 2b45e8
      ELSE IF (TRANSA.EQ.'T')THEN
kusano 2b45e8
         CA =  '    CblasTrans'
kusano 2b45e8
      ELSE 
kusano 2b45e8
         CA =  'CblasConjTrans'
kusano 2b45e8
      END IF
kusano 2b45e8
      IF (IORDER.EQ.1)THEN
kusano 2b45e8
         CRC = ' CblasRowMajor'
kusano 2b45e8
      ELSE 
kusano 2b45e8
         CRC = ' CblasColMajor'
kusano 2b45e8
      END IF
kusano 2b45e8
      WRITE(NOUT, FMT = 9995)NC, SNAME, CRC, CU, CA
kusano 2b45e8
      WRITE(NOUT, FMT = 9994)N, K, ALPHA, LDA, BETA, LDC
kusano 2b45e8
kusano 2b45e8
 9995 FORMAT( 1X, I6, ': ', A12,'(', 3( A14, ',') )
kusano 2b45e8
 9994 FORMAT( 10X, 2( I3, ',' ), ' (', F4.1, ',', F4.1 ,'), A,',
kusano 2b45e8
     $        I3, ', (', F4.1,',', F4.1, '), C,', I3, ').' )
kusano 2b45e8
      END
kusano 2b45e8
*
kusano 2b45e8
*
kusano 2b45e8
      SUBROUTINE CPRCN6(NOUT, NC, SNAME, IORDER, UPLO, TRANSA,
kusano 2b45e8
     $                 N, K, ALPHA, LDA, BETA, LDC)
kusano 2b45e8
      INTEGER          NOUT, NC, IORDER, N, K, LDA, LDC
kusano 2b45e8
      REAL             ALPHA, BETA
kusano 2b45e8
      CHARACTER*1      UPLO, TRANSA
kusano 2b45e8
      CHARACTER*12     SNAME
kusano 2b45e8
      CHARACTER*14     CRC, CU, CA
kusano 2b45e8
      
kusano 2b45e8
      IF (UPLO.EQ.'U')THEN
kusano 2b45e8
         CU =  '    CblasUpper'
kusano 2b45e8
      ELSE 
kusano 2b45e8
         CU =  '    CblasLower'
kusano 2b45e8
      END IF
kusano 2b45e8
      IF (TRANSA.EQ.'N')THEN
kusano 2b45e8
         CA =  '  CblasNoTrans'
kusano 2b45e8
      ELSE IF (TRANSA.EQ.'T')THEN
kusano 2b45e8
         CA =  '    CblasTrans'
kusano 2b45e8
      ELSE 
kusano 2b45e8
         CA =  'CblasConjTrans'
kusano 2b45e8
      END IF
kusano 2b45e8
      IF (IORDER.EQ.1)THEN
kusano 2b45e8
         CRC = ' CblasRowMajor'
kusano 2b45e8
      ELSE 
kusano 2b45e8
         CRC = ' CblasColMajor'
kusano 2b45e8
      END IF
kusano 2b45e8
      WRITE(NOUT, FMT = 9995)NC, SNAME, CRC, CU, CA
kusano 2b45e8
      WRITE(NOUT, FMT = 9994)N, K, ALPHA, LDA, BETA, LDC
kusano 2b45e8
kusano 2b45e8
 9995 FORMAT( 1X, I6, ': ', A12,'(', 3( A14, ',') )
kusano 2b45e8
 9994 FORMAT( 10X, 2( I3, ',' ), 
kusano 2b45e8
     $      F4.1, ', A,', I3, ',', F4.1, ', C,', I3, ').' )
kusano 2b45e8
      END
kusano 2b45e8
*
kusano 2b45e8
      SUBROUTINE CCHK5( SNAME, EPS, THRESH, NOUT, NTRA, TRACE, REWI,
kusano 2b45e8
     $                  FATAL, NIDIM, IDIM, NALF, ALF, NBET, BET, NMAX,
kusano 2b45e8
     $                  AB, AA, AS, BB, BS, C, CC, CS, CT, G, W,
kusano 2b45e8
     $                  IORDER )
kusano 2b45e8
*
kusano 2b45e8
*  Tests CHER2K and CSYR2K.
kusano 2b45e8
*
kusano 2b45e8
*  Auxiliary routine for test program for Level 3 Blas.
kusano 2b45e8
*
kusano 2b45e8
*  -- Written on 8-February-1989.
kusano 2b45e8
*     Jack Dongarra, Argonne National Laboratory.
kusano 2b45e8
*     Iain Duff, AERE Harwell.
kusano 2b45e8
*     Jeremy Du Croz, Numerical Algorithms Group Ltd.
kusano 2b45e8
*     Sven Hammarling, Numerical Algorithms Group Ltd.
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
      REAL               RONE, RZERO
kusano 2b45e8
      PARAMETER          ( RONE = 1.0, RZERO = 0.0 )
kusano 2b45e8
*     .. Scalar Arguments ..
kusano 2b45e8
      REAL               EPS, THRESH
kusano 2b45e8
      INTEGER            NALF, NBET, NIDIM, NMAX, NOUT, NTRA, IORDER
kusano 2b45e8
      LOGICAL            FATAL, REWI, TRACE
kusano 2b45e8
      CHARACTER*12       SNAME
kusano 2b45e8
*     .. Array Arguments ..
kusano 2b45e8
      COMPLEX            AA( NMAX*NMAX ), AB( 2*NMAX*NMAX ),
kusano 2b45e8
     $                   ALF( NALF ), AS( NMAX*NMAX ), BB( NMAX*NMAX ),
kusano 2b45e8
     $                   BET( NBET ), BS( NMAX*NMAX ), C( NMAX, NMAX ),
kusano 2b45e8
     $                   CC( NMAX*NMAX ), CS( NMAX*NMAX ), CT( NMAX ),
kusano 2b45e8
     $                   W( 2*NMAX )
kusano 2b45e8
      REAL               G( NMAX )
kusano 2b45e8
      INTEGER            IDIM( NIDIM )
kusano 2b45e8
*     .. Local Scalars ..
kusano 2b45e8
      COMPLEX            ALPHA, ALS, BETA, BETS
kusano 2b45e8
      REAL               ERR, ERRMAX, RBETA, RBETS
kusano 2b45e8
      INTEGER            I, IA, IB, ICT, ICU, IK, IN, J, JC, JJ, JJAB,
kusano 2b45e8
     $                   K, KS, LAA, LBB, LCC, LDA, LDAS, LDB, LDBS,
kusano 2b45e8
     $                   LDC, LDCS, LJ, MA, N, NA, NARGS, NC, NS
kusano 2b45e8
      LOGICAL            CONJ, NULL, RESET, SAME, TRAN, UPPER
kusano 2b45e8
      CHARACTER*1        TRANS, TRANSS, TRANST, UPLO, UPLOS
kusano 2b45e8
      CHARACTER*2        ICHT, ICHU
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           CCHER2K, CMAKE, CMMCH, CCSYR2K
kusano 2b45e8
*     .. Intrinsic Functions ..
kusano 2b45e8
      INTRINSIC          CMPLX, CONJG, MAX, REAL
kusano 2b45e8
*     .. Scalars in Common ..
kusano 2b45e8
      INTEGER            INFOT, NOUTC
kusano 2b45e8
      LOGICAL            LERR, OK
kusano 2b45e8
*     .. Common blocks ..
kusano 2b45e8
      COMMON             /INFOC/INFOT, NOUTC, OK, LERR
kusano 2b45e8
*     .. Data statements ..
kusano 2b45e8
      DATA               ICHT/'NC'/, ICHU/'UL'/
kusano 2b45e8
*     .. Executable Statements ..
kusano 2b45e8
      CONJ = SNAME( 8: 9 ).EQ.'he'
kusano 2b45e8
*
kusano 2b45e8
      NARGS = 12
kusano 2b45e8
      NC = 0
kusano 2b45e8
      RESET = .TRUE.
kusano 2b45e8
      ERRMAX = RZERO
kusano 2b45e8
*
kusano 2b45e8
      DO 130 IN = 1, NIDIM
kusano 2b45e8
         N = IDIM( IN )
kusano 2b45e8
*        Set LDC to 1 more than minimum value if room.
kusano 2b45e8
         LDC = N
kusano 2b45e8
         IF( LDC.LT.NMAX )
kusano 2b45e8
     $      LDC = LDC + 1
kusano 2b45e8
*        Skip tests if not enough room.
kusano 2b45e8
         IF( LDC.GT.NMAX )
kusano 2b45e8
     $      GO TO 130
kusano 2b45e8
         LCC = LDC*N
kusano 2b45e8
*
kusano 2b45e8
         DO 120 IK = 1, NIDIM
kusano 2b45e8
            K = IDIM( IK )
kusano 2b45e8
*
kusano 2b45e8
            DO 110 ICT = 1, 2
kusano 2b45e8
               TRANS = ICHT( ICT: ICT )
kusano 2b45e8
               TRAN = TRANS.EQ.'C'
kusano 2b45e8
               IF( TRAN.AND..NOT.CONJ )
kusano 2b45e8
     $            TRANS = 'T'
kusano 2b45e8
               IF( TRAN )THEN
kusano 2b45e8
                  MA = K
kusano 2b45e8
                  NA = N
kusano 2b45e8
               ELSE
kusano 2b45e8
                  MA = N
kusano 2b45e8
                  NA = K
kusano 2b45e8
               END IF
kusano 2b45e8
*              Set LDA to 1 more than minimum value if room.
kusano 2b45e8
               LDA = MA
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*NA
kusano 2b45e8
*
kusano 2b45e8
*              Generate the matrix A.
kusano 2b45e8
*
kusano 2b45e8
               IF( TRAN )THEN
kusano 2b45e8
                  CALL CMAKE( 'ge', ' ', ' ', MA, NA, AB, 2*NMAX, AA,
kusano 2b45e8
     $                        LDA, RESET, ZERO )
kusano 2b45e8
               ELSE
kusano 2b45e8
                 CALL CMAKE( 'ge', ' ', ' ', MA, NA, AB, NMAX, AA, LDA,
kusano 2b45e8
     $                        RESET, ZERO )
kusano 2b45e8
               END IF
kusano 2b45e8
*
kusano 2b45e8
*              Generate the matrix B.
kusano 2b45e8
*
kusano 2b45e8
               LDB = LDA
kusano 2b45e8
               LBB = LAA
kusano 2b45e8
               IF( TRAN )THEN
kusano 2b45e8
                  CALL CMAKE( 'ge', ' ', ' ', MA, NA, AB( K + 1 ),
kusano 2b45e8
     $                        2*NMAX, BB, LDB, RESET, ZERO )
kusano 2b45e8
               ELSE
kusano 2b45e8
                  CALL CMAKE( 'ge', ' ', ' ', MA, NA, AB( K*NMAX + 1 ),
kusano 2b45e8
     $                        NMAX, BB, LDB, RESET, ZERO )
kusano 2b45e8
               END IF
kusano 2b45e8
*
kusano 2b45e8
               DO 100 ICU = 1, 2
kusano 2b45e8
                  UPLO = ICHU( ICU: ICU )
kusano 2b45e8
                  UPPER = UPLO.EQ.'U'
kusano 2b45e8
*
kusano 2b45e8
                  DO 90 IA = 1, NALF
kusano 2b45e8
                     ALPHA = ALF( IA )
kusano 2b45e8
*
kusano 2b45e8
                     DO 80 IB = 1, NBET
kusano 2b45e8
                        BETA = BET( IB )
kusano 2b45e8
                        IF( CONJ )THEN
kusano 2b45e8
                           RBETA = REAL( BETA )
kusano 2b45e8
                           BETA = CMPLX( RBETA, RZERO )
kusano 2b45e8
                        END IF
kusano 2b45e8
                        NULL = N.LE.0
kusano 2b45e8
                        IF( CONJ )
kusano 2b45e8
     $                     NULL = NULL.OR.( ( K.LE.0.OR.ALPHA.EQ.
kusano 2b45e8
     $                            ZERO ).AND.RBETA.EQ.RONE )
kusano 2b45e8
*
kusano 2b45e8
*                       Generate the matrix C.
kusano 2b45e8
*
kusano 2b45e8
                        CALL CMAKE( SNAME( 8: 9 ), UPLO, ' ', N, N, C,
kusano 2b45e8
     $                              NMAX, CC, LDC, RESET, ZERO )
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
                        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, LBB
kusano 2b45e8
                           BS( I ) = BB( I )
kusano 2b45e8
   20                   CONTINUE
kusano 2b45e8
                        LDBS = LDB
kusano 2b45e8
                        IF( CONJ )THEN
kusano 2b45e8
                           RBETS = RBETA
kusano 2b45e8
                        ELSE
kusano 2b45e8
                           BETS = BETA
kusano 2b45e8
                        END IF
kusano 2b45e8
                        DO 30 I = 1, LCC
kusano 2b45e8
                           CS( I ) = CC( I )
kusano 2b45e8
   30                   CONTINUE
kusano 2b45e8
                        LDCS = LDC
kusano 2b45e8
*
kusano 2b45e8
*                       Call the subroutine.
kusano 2b45e8
*
kusano 2b45e8
                        IF( CONJ )THEN
kusano 2b45e8
                           IF( TRACE )
kusano 2b45e8
     $                        CALL CPRCN7( NTRA, NC, SNAME, IORDER,
kusano 2b45e8
     $                        UPLO, TRANS, N, K, ALPHA, LDA, LDB,
kusano 2b45e8
     $                        RBETA, LDC)
kusano 2b45e8
                           IF( REWI )
kusano 2b45e8
     $                        REWIND NTRA
kusano 2b45e8
                           CALL CCHER2K( IORDER, UPLO, TRANS, N, K,
kusano 2b45e8
     $                                  ALPHA, AA, LDA, BB, LDB, RBETA,
kusano 2b45e8
     $                                  CC, LDC )
kusano 2b45e8
                        ELSE
kusano 2b45e8
                           IF( TRACE )
kusano 2b45e8
     $                        CALL CPRCN5( NTRA, NC, SNAME, IORDER,
kusano 2b45e8
     $                        UPLO, TRANS, N, K, ALPHA, LDA, LDB,
kusano 2b45e8
     $                        BETA, LDC)
kusano 2b45e8
                           IF( REWI )
kusano 2b45e8
     $                        REWIND NTRA
kusano 2b45e8
                           CALL CCSYR2K( IORDER, UPLO, TRANS, N, K,
kusano 2b45e8
     $                                  ALPHA, AA, LDA, BB, LDB, BETA, 
kusano 2b45e8
     $                                  CC, LDC )
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 150
kusano 2b45e8
                        END IF
kusano 2b45e8
*
kusano 2b45e8
*                       See what data changed inside subroutines.
kusano 2b45e8
*
kusano 2b45e8
                        ISAME( 1 ) = UPLOS.EQ.UPLO
kusano 2b45e8
                        ISAME( 2 ) = TRANSS.EQ.TRANS
kusano 2b45e8
                        ISAME( 3 ) = NS.EQ.N
kusano 2b45e8
                        ISAME( 4 ) = KS.EQ.K
kusano 2b45e8
                        ISAME( 5 ) = ALS.EQ.ALPHA
kusano 2b45e8
                        ISAME( 6 ) = LCE( AS, AA, LAA )
kusano 2b45e8
                        ISAME( 7 ) = LDAS.EQ.LDA
kusano 2b45e8
                        ISAME( 8 ) = LCE( BS, BB, LBB )
kusano 2b45e8
                        ISAME( 9 ) = LDBS.EQ.LDB
kusano 2b45e8
                        IF( CONJ )THEN
kusano 2b45e8
                           ISAME( 10 ) = RBETS.EQ.RBETA
kusano 2b45e8
                        ELSE
kusano 2b45e8
                           ISAME( 10 ) = BETS.EQ.BETA
kusano 2b45e8
                        END IF
kusano 2b45e8
                        IF( NULL )THEN
kusano 2b45e8
                           ISAME( 11 ) = LCE( CS, CC, LCC )
kusano 2b45e8
                        ELSE
kusano 2b45e8
                           ISAME( 11 ) = LCERES( 'he', UPLO, N, N, CS,
kusano 2b45e8
     $                                   CC, LDC )
kusano 2b45e8
                        END IF
kusano 2b45e8
                        ISAME( 12 ) = LDCS.EQ.LDC
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 150
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( CONJ )THEN
kusano 2b45e8
                              TRANST = 'C'
kusano 2b45e8
                           ELSE
kusano 2b45e8
                              TRANST = 'T'
kusano 2b45e8
                           END IF
kusano 2b45e8
                           JJAB = 1
kusano 2b45e8
                           JC = 1
kusano 2b45e8
                           DO 70 J = 1, N
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
                              IF( TRAN )THEN
kusano 2b45e8
                                 DO 50 I = 1, K
kusano 2b45e8
                                    W( I ) = ALPHA*AB( ( J - 1 )*2*
kusano 2b45e8
     $                                       NMAX + K + I )
kusano 2b45e8
                                    IF( CONJ )THEN
kusano 2b45e8
                                       W( K + I ) = CONJG( ALPHA )*
kusano 2b45e8
     $                                              AB( ( J - 1 )*2*
kusano 2b45e8
     $                                              NMAX + I )
kusano 2b45e8
                                    ELSE
kusano 2b45e8
                                       W( K + I ) = ALPHA*
kusano 2b45e8
     $                                              AB( ( J - 1 )*2*
kusano 2b45e8
     $                                              NMAX + I )
kusano 2b45e8
                                    END IF
kusano 2b45e8
   50                            CONTINUE
kusano 2b45e8
                                 CALL CMMCH( TRANST, 'N', LJ, 1, 2*K,
kusano 2b45e8
     $                                      ONE, AB( JJAB ), 2*NMAX, W,
kusano 2b45e8
     $                                       2*NMAX, BETA, C( JJ, J ),
kusano 2b45e8
     $                                      NMAX, CT, G, CC( JC ), LDC,
kusano 2b45e8
     $                                       EPS, ERR, FATAL, NOUT,
kusano 2b45e8
     $                                       .TRUE. )
kusano 2b45e8
                              ELSE
kusano 2b45e8
                                 DO 60 I = 1, K
kusano 2b45e8
                                    IF( CONJ )THEN
kusano 2b45e8
                                       W( I ) = ALPHA*CONJG( AB( ( K +
kusano 2b45e8
     $                                          I - 1 )*NMAX + J ) )
kusano 2b45e8
                                       W( K + I ) = CONJG( ALPHA*
kusano 2b45e8
     $                                              AB( ( I - 1 )*NMAX +
kusano 2b45e8
     $                                              J ) )
kusano 2b45e8
                                    ELSE
kusano 2b45e8
                                       W( I ) = ALPHA*AB( ( K + I - 1 )*
kusano 2b45e8
     $                                          NMAX + J )
kusano 2b45e8
                                       W( K + I ) = ALPHA*
kusano 2b45e8
     $                                              AB( ( I - 1 )*NMAX +
kusano 2b45e8
     $                                              J )
kusano 2b45e8
                                    END IF
kusano 2b45e8
   60                            CONTINUE
kusano 2b45e8
                                 CALL CMMCH( 'N', 'N', LJ, 1, 2*K, ONE,
kusano 2b45e8
     $                                       AB( JJ ), NMAX, W, 2*NMAX,
kusano 2b45e8
     $                                      BETA, C( JJ, J ), NMAX, CT,
kusano 2b45e8
     $                                      G, CC( JC ), LDC, EPS, ERR,
kusano 2b45e8
     $                                       FATAL, NOUT, .TRUE. )
kusano 2b45e8
                              END IF
kusano 2b45e8
                              IF( UPPER )THEN
kusano 2b45e8
                                 JC = JC + LDC
kusano 2b45e8
                              ELSE
kusano 2b45e8
                                 JC = JC + LDC + 1
kusano 2b45e8
                                 IF( TRAN )
kusano 2b45e8
     $                              JJAB = JJAB + 2*NMAX
kusano 2b45e8
                              END IF
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 140
kusano 2b45e8
   70                      CONTINUE
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
  130 CONTINUE
kusano 2b45e8
*
kusano 2b45e8
*     Report result.
kusano 2b45e8
*
kusano 2b45e8
      IF( ERRMAX.LT.THRESH )THEN
kusano 2b45e8
         IF ( IORDER.EQ.0) WRITE( NOUT, FMT = 10000 )SNAME, NC
kusano 2b45e8
         IF ( IORDER.EQ.1) WRITE( NOUT, FMT = 10001 )SNAME, NC
kusano 2b45e8
      ELSE
kusano 2b45e8
         IF ( IORDER.EQ.0) WRITE( NOUT, FMT = 10002 )SNAME, NC, ERRMAX
kusano 2b45e8
         IF ( IORDER.EQ.1) WRITE( NOUT, FMT = 10003 )SNAME, NC, ERRMAX
kusano 2b45e8
      END IF
kusano 2b45e8
      GO TO 160
kusano 2b45e8
*
kusano 2b45e8
  140 CONTINUE
kusano 2b45e8
      IF( N.GT.1 )
kusano 2b45e8
     $   WRITE( NOUT, FMT = 9995 )J
kusano 2b45e8
*
kusano 2b45e8
  150 CONTINUE
kusano 2b45e8
      WRITE( NOUT, FMT = 9996 )SNAME
kusano 2b45e8
      IF( CONJ )THEN
kusano 2b45e8
         CALL CPRCN7( NOUT, NC, SNAME, IORDER, UPLO, TRANS, N, K,
kusano 2b45e8
     $      ALPHA, LDA, LDB, RBETA, LDC)
kusano 2b45e8
      ELSE
kusano 2b45e8
         CALL CPRCN5( NOUT, NC, SNAME, IORDER, UPLO, TRANS, N, K,
kusano 2b45e8
     $      ALPHA, LDA, LDB, BETA, LDC)
kusano 2b45e8
      END IF
kusano 2b45e8
*
kusano 2b45e8
  160 CONTINUE
kusano 2b45e8
      RETURN
kusano 2b45e8
*
kusano 2b45e8
10003 FORMAT( ' ', A12,' COMPLETED THE ROW-MAJOR    COMPUTATIONAL ',
kusano 2b45e8
     $ 'TESTS (', I6, ' CALLS)', /' ******* BUT WITH MAXIMUM TEST ',
kusano 2b45e8
     $ 'RATIO ', F8.2, ' - SUSPECT *******' )
kusano 2b45e8
10002 FORMAT( ' ', A12,' COMPLETED THE COLUMN-MAJOR COMPUTATIONAL ',
kusano 2b45e8
     $ 'TESTS (', I6, ' CALLS)', /' ******* BUT WITH MAXIMUM TEST ',
kusano 2b45e8
     $ 'RATIO ', F8.2, ' - SUSPECT *******' )
kusano 2b45e8
10001 FORMAT( ' ', A12,' PASSED THE ROW-MAJOR    COMPUTATIONAL TESTS',
kusano 2b45e8
     $ ' (', I6, ' CALL', 'S)' )
kusano 2b45e8
10000 FORMAT( ' ', A12,' PASSED THE COLUMN-MAJOR COMPUTATIONAL TESTS',
kusano 2b45e8
     $ ' (', I6, ' CALL', 'S)' )
kusano 2b45e8
 9998 FORMAT(' ******* FATAL ERROR - PARAMETER NUMBER ', I2, ' WAS CH',
kusano 2b45e8
     $      'ANGED INCORRECTLY *******' )
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( '''', A1, ''',' ), 2( I3, ',' ),
kusano 2b45e8
     $      '(', F4.1, ',', F4.1, '), A,', I3, ', B,', I3, ',', F4.1,
kusano 2b45e8
     $      ', C,', I3, ')           .' )
kusano 2b45e8
 9993 FORMAT(1X, I6, ': ', A12,'(', 2( '''', A1, ''',' ), 2( I3, ',' ),
kusano 2b45e8
     $      '(', F4.1, ',', F4.1, '), A,', I3, ', B,', I3, ',(', F4.1,
kusano 2b45e8
     $      ',', F4.1, '), C,', 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
*
kusano 2b45e8
      SUBROUTINE CPRCN5(NOUT, NC, SNAME, IORDER, UPLO, TRANSA,
kusano 2b45e8
     $                 N, K, ALPHA, LDA, LDB, BETA, LDC)
kusano 2b45e8
      INTEGER          NOUT, NC, IORDER, N, K, LDA, LDB, LDC
kusano 2b45e8
      COMPLEX          ALPHA, BETA
kusano 2b45e8
      CHARACTER*1      UPLO, TRANSA
kusano 2b45e8
      CHARACTER*12     SNAME
kusano 2b45e8
      CHARACTER*14     CRC, CU, CA
kusano 2b45e8
      
kusano 2b45e8
      IF (UPLO.EQ.'U')THEN
kusano 2b45e8
         CU =  '    CblasUpper'
kusano 2b45e8
      ELSE 
kusano 2b45e8
         CU =  '    CblasLower'
kusano 2b45e8
      END IF
kusano 2b45e8
      IF (TRANSA.EQ.'N')THEN
kusano 2b45e8
         CA =  '  CblasNoTrans'
kusano 2b45e8
      ELSE IF (TRANSA.EQ.'T')THEN
kusano 2b45e8
         CA =  '    CblasTrans'
kusano 2b45e8
      ELSE 
kusano 2b45e8
         CA =  'CblasConjTrans'
kusano 2b45e8
      END IF
kusano 2b45e8
      IF (IORDER.EQ.1)THEN
kusano 2b45e8
         CRC = ' CblasRowMajor'
kusano 2b45e8
      ELSE 
kusano 2b45e8
         CRC = ' CblasColMajor'
kusano 2b45e8
      END IF
kusano 2b45e8
      WRITE(NOUT, FMT = 9995)NC, SNAME, CRC, CU, CA
kusano 2b45e8
      WRITE(NOUT, FMT = 9994)N, K, ALPHA, LDA, LDB, BETA, LDC
kusano 2b45e8
kusano 2b45e8
 9995 FORMAT( 1X, I6, ': ', A12,'(', 3( A14, ',') )
kusano 2b45e8
 9994 FORMAT( 10X, 2( I3, ',' ), ' (', F4.1, ',', F4.1, '), A,',
kusano 2b45e8
     $  I3, ', B', I3, ', (', F4.1, ',', F4.1, '), C,', I3, ').' )
kusano 2b45e8
      END
kusano 2b45e8
*
kusano 2b45e8
*
kusano 2b45e8
      SUBROUTINE CPRCN7(NOUT, NC, SNAME, IORDER, UPLO, TRANSA,
kusano 2b45e8
     $                 N, K, ALPHA, LDA, LDB, BETA, LDC)
kusano 2b45e8
      INTEGER          NOUT, NC, IORDER, N, K, LDA, LDB, LDC
kusano 2b45e8
      COMPLEX          ALPHA
kusano 2b45e8
      REAL             BETA
kusano 2b45e8
      CHARACTER*1      UPLO, TRANSA
kusano 2b45e8
      CHARACTER*12     SNAME
kusano 2b45e8
      CHARACTER*14     CRC, CU, CA
kusano 2b45e8
      
kusano 2b45e8
      IF (UPLO.EQ.'U')THEN
kusano 2b45e8
         CU =  '    CblasUpper'
kusano 2b45e8
      ELSE 
kusano 2b45e8
         CU =  '    CblasLower'
kusano 2b45e8
      END IF
kusano 2b45e8
      IF (TRANSA.EQ.'N')THEN
kusano 2b45e8
         CA =  '  CblasNoTrans'
kusano 2b45e8
      ELSE IF (TRANSA.EQ.'T')THEN
kusano 2b45e8
         CA =  '    CblasTrans'
kusano 2b45e8
      ELSE 
kusano 2b45e8
         CA =  'CblasConjTrans'
kusano 2b45e8
      END IF
kusano 2b45e8
      IF (IORDER.EQ.1)THEN
kusano 2b45e8
         CRC = ' CblasRowMajor'
kusano 2b45e8
      ELSE 
kusano 2b45e8
         CRC = ' CblasColMajor'
kusano 2b45e8
      END IF
kusano 2b45e8
      WRITE(NOUT, FMT = 9995)NC, SNAME, CRC, CU, CA
kusano 2b45e8
      WRITE(NOUT, FMT = 9994)N, K, ALPHA, LDA, LDB, BETA, LDC
kusano 2b45e8
kusano 2b45e8
 9995 FORMAT( 1X, I6, ': ', A12,'(', 3( A14, ',') )
kusano 2b45e8
 9994 FORMAT( 10X, 2( I3, ',' ), ' (', F4.1, ',', F4.1, '), A,',
kusano 2b45e8
     $      I3, ', B', I3, ',', F4.1, ', C,', I3, ').' )
kusano 2b45e8
      END
kusano 2b45e8
*
kusano 2b45e8
      SUBROUTINE CMAKE(TYPE, UPLO, DIAG, M, N, A, NMAX, AA, LDA, RESET,
kusano 2b45e8
     $                  TRANSL )
kusano 2b45e8
*
kusano 2b45e8
*  Generates values for an M by N matrix A.
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', 'he', 'sy' or 'tr'.
kusano 2b45e8
*
kusano 2b45e8
*  Auxiliary routine for test program for Level 3 Blas.
kusano 2b45e8
*
kusano 2b45e8
*  -- Written on 8-February-1989.
kusano 2b45e8
*     Jack Dongarra, Argonne National Laboratory.
kusano 2b45e8
*     Iain Duff, AERE Harwell.
kusano 2b45e8
*     Jeremy Du Croz, Numerical Algorithms Group Ltd.
kusano 2b45e8
*     Sven Hammarling, Numerical Algorithms Group Ltd.
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            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, IBEG, IEND, J, JJ
kusano 2b45e8
      LOGICAL            GEN, HER, 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, REAL
kusano 2b45e8
*     .. Executable Statements ..
kusano 2b45e8
      GEN = TYPE.EQ.'ge'
kusano 2b45e8
      HER = TYPE.EQ.'he'
kusano 2b45e8
      SYM = TYPE.EQ.'sy'
kusano 2b45e8
      TRI = TYPE.EQ.'tr'
kusano 2b45e8
      UPPER = ( HER.OR.SYM.OR.TRI ).AND.UPLO.EQ.'U'
kusano 2b45e8
      LOWER = ( HER.OR.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
               A( I, J ) = CBEG( RESET ) + TRANSL
kusano 2b45e8
               IF( I.NE.J )THEN
kusano 2b45e8
*                 Set some elements to zero
kusano 2b45e8
                  IF( N.GT.3.AND.J.EQ.N/2 )
kusano 2b45e8
     $               A( I, J ) = ZERO
kusano 2b45e8
                  IF( HER )THEN
kusano 2b45e8
                     A( J, I ) = CONJG( A( I, J ) )
kusano 2b45e8
                  ELSE IF( SYM )THEN
kusano 2b45e8
                     A( J, I ) = 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( HER )
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.'he'.OR.TYPE.EQ.'sy'.OR.TYPE.EQ.'tr' )THEN
kusano 2b45e8
         DO 90 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 60 I = 1, IBEG - 1
kusano 2b45e8
               AA( I + ( J - 1 )*LDA ) = ROGUE
kusano 2b45e8
   60       CONTINUE
kusano 2b45e8
            DO 70 I = IBEG, IEND
kusano 2b45e8
               AA( I + ( J - 1 )*LDA ) = A( I, J )
kusano 2b45e8
   70       CONTINUE
kusano 2b45e8
            DO 80 I = IEND + 1, LDA
kusano 2b45e8
               AA( I + ( J - 1 )*LDA ) = ROGUE
kusano 2b45e8
   80       CONTINUE
kusano 2b45e8
            IF( HER )THEN
kusano 2b45e8
               JJ = J + ( J - 1 )*LDA
kusano 2b45e8
               AA( JJ ) = CMPLX( REAL( AA( JJ ) ), RROGUE )
kusano 2b45e8
            END IF
kusano 2b45e8
   90    CONTINUE
kusano 2b45e8
      END IF
kusano 2b45e8
      RETURN
kusano 2b45e8
*
kusano 2b45e8
*     End of CMAKE.
kusano 2b45e8
*
kusano 2b45e8
      END
kusano 2b45e8
      SUBROUTINE CMMCH(TRANSA, TRANSB, M, N, KK, ALPHA, A, LDA, B, LDB,
kusano 2b45e8
     $                  BETA, C, LDC, CT, G, CC, LDCC, EPS, ERR, FATAL,
kusano 2b45e8
     $                  NOUT, MV )
kusano 2b45e8
*
kusano 2b45e8
*  Checks the results of the computational tests.
kusano 2b45e8
*
kusano 2b45e8
*  Auxiliary routine for test program for Level 3 Blas.
kusano 2b45e8
*
kusano 2b45e8
*  -- Written on 8-February-1989.
kusano 2b45e8
*     Jack Dongarra, Argonne National Laboratory.
kusano 2b45e8
*     Iain Duff, AERE Harwell.
kusano 2b45e8
*     Jeremy Du Croz, Numerical Algorithms Group Ltd.
kusano 2b45e8
*     Sven Hammarling, Numerical Algorithms Group Ltd.
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            KK, LDA, LDB, LDC, LDCC, M, N, NOUT
kusano 2b45e8
      LOGICAL            FATAL, MV
kusano 2b45e8
      CHARACTER*1        TRANSA, TRANSB
kusano 2b45e8
*     .. Array Arguments ..
kusano 2b45e8
      COMPLEX            A( LDA, * ), B( LDB, * ), C( LDC, * ),
kusano 2b45e8
     $                   CC( LDCC, * ), CT( * )
kusano 2b45e8
      REAL               G( * )
kusano 2b45e8
*     .. Local Scalars ..
kusano 2b45e8
      COMPLEX            CL
kusano 2b45e8
      REAL               ERRI
kusano 2b45e8
      INTEGER            I, J, K
kusano 2b45e8
      LOGICAL            CTRANA, CTRANB, TRANA, TRANB
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( CL ) = ABS( REAL( CL ) ) + ABS( AIMAG( CL ) )
kusano 2b45e8
*     .. Executable Statements ..
kusano 2b45e8
      TRANA = TRANSA.EQ.'T'.OR.TRANSA.EQ.'C'
kusano 2b45e8
      TRANB = TRANSB.EQ.'T'.OR.TRANSB.EQ.'C'
kusano 2b45e8
      CTRANA = TRANSA.EQ.'C'
kusano 2b45e8
      CTRANB = TRANSB.EQ.'C'
kusano 2b45e8
*
kusano 2b45e8
*     Compute expected result, one column at a time, in CT using data
kusano 2b45e8
*     in A, B and C.
kusano 2b45e8
*     Compute gauges in G.
kusano 2b45e8
*
kusano 2b45e8
      DO 220 J = 1, N
kusano 2b45e8
*
kusano 2b45e8
         DO 10 I = 1, M
kusano 2b45e8
            CT( I ) = ZERO
kusano 2b45e8
            G( I ) = RZERO
kusano 2b45e8
   10    CONTINUE
kusano 2b45e8
         IF( .NOT.TRANA.AND..NOT.TRANB )THEN
kusano 2b45e8
            DO 30 K = 1, KK
kusano 2b45e8
               DO 20 I = 1, M
kusano 2b45e8
                  CT( I ) = CT( I ) + A( I, K )*B( K, J )
kusano 2b45e8
                  G( I ) = G( I ) + ABS1( A( I, K ) )*ABS1( B( K, J ) )
kusano 2b45e8
   20          CONTINUE
kusano 2b45e8
   30       CONTINUE
kusano 2b45e8
         ELSE IF( TRANA.AND..NOT.TRANB )THEN
kusano 2b45e8
            IF( CTRANA )THEN
kusano 2b45e8
               DO 50 K = 1, KK
kusano 2b45e8
                  DO 40 I = 1, M
kusano 2b45e8
                     CT( I ) = CT( I ) + CONJG( A( K, I ) )*B( K, J )
kusano 2b45e8
                     G( I ) = G( I ) + ABS1( A( K, I ) )*
kusano 2b45e8
     $                        ABS1( B( K, J ) )
kusano 2b45e8
   40             CONTINUE
kusano 2b45e8
   50          CONTINUE
kusano 2b45e8
            ELSE
kusano 2b45e8
               DO 70 K = 1, KK
kusano 2b45e8
                  DO 60 I = 1, M
kusano 2b45e8
                     CT( I ) = CT( I ) + A( K, I )*B( K, J )
kusano 2b45e8
                     G( I ) = G( I ) + ABS1( A( K, I ) )*
kusano 2b45e8
     $                        ABS1( B( K, J ) )
kusano 2b45e8
   60             CONTINUE
kusano 2b45e8
   70          CONTINUE
kusano 2b45e8
            END IF
kusano 2b45e8
         ELSE IF( .NOT.TRANA.AND.TRANB )THEN
kusano 2b45e8
            IF( CTRANB )THEN
kusano 2b45e8
               DO 90 K = 1, KK
kusano 2b45e8
                  DO 80 I = 1, M
kusano 2b45e8
                     CT( I ) = CT( I ) + A( I, K )*CONJG( B( J, K ) )
kusano 2b45e8
                     G( I ) = G( I ) + ABS1( A( I, K ) )*
kusano 2b45e8
     $                        ABS1( B( J, K ) )
kusano 2b45e8
   80             CONTINUE
kusano 2b45e8
   90          CONTINUE
kusano 2b45e8
            ELSE
kusano 2b45e8
               DO 110 K = 1, KK
kusano 2b45e8
                  DO 100 I = 1, M
kusano 2b45e8
                     CT( I ) = CT( I ) + A( I, K )*B( J, K )
kusano 2b45e8
                     G( I ) = G( I ) + ABS1( A( I, K ) )*
kusano 2b45e8
     $                        ABS1( B( J, K ) )
kusano 2b45e8
  100             CONTINUE
kusano 2b45e8
  110          CONTINUE
kusano 2b45e8
            END IF
kusano 2b45e8
         ELSE IF( TRANA.AND.TRANB )THEN
kusano 2b45e8
            IF( CTRANA )THEN
kusano 2b45e8
               IF( CTRANB )THEN
kusano 2b45e8
                  DO 130 K = 1, KK
kusano 2b45e8
                     DO 120 I = 1, M
kusano 2b45e8
                        CT( I ) = CT( I ) + CONJG( A( K, I ) )*
kusano 2b45e8
     $                            CONJG( B( J, K ) )
kusano 2b45e8
                        G( I ) = G( I ) + ABS1( A( K, I ) )*
kusano 2b45e8
     $                           ABS1( B( J, K ) )
kusano 2b45e8
  120                CONTINUE
kusano 2b45e8
  130             CONTINUE
kusano 2b45e8
               ELSE
kusano 2b45e8
                  DO 150 K = 1, KK
kusano 2b45e8
                     DO 140 I = 1, M
kusano 2b45e8
                       CT( I ) = CT( I ) + CONJG( A( K, I ) )*B( J, K )
kusano 2b45e8
                       G( I ) = G( I ) + ABS1( A( K, I ) )*
kusano 2b45e8
     $                           ABS1( B( J, K ) )
kusano 2b45e8
  140                CONTINUE
kusano 2b45e8
  150             CONTINUE
kusano 2b45e8
               END IF
kusano 2b45e8
            ELSE
kusano 2b45e8
               IF( CTRANB )THEN
kusano 2b45e8
                  DO 170 K = 1, KK
kusano 2b45e8
                     DO 160 I = 1, M
kusano 2b45e8
                       CT( I ) = CT( I ) + A( K, I )*CONJG( B( J, K ) )
kusano 2b45e8
                       G( I ) = G( I ) + ABS1( A( K, I ) )*
kusano 2b45e8
     $                           ABS1( B( J, K ) )
kusano 2b45e8
  160                CONTINUE
kusano 2b45e8
  170             CONTINUE
kusano 2b45e8
               ELSE
kusano 2b45e8
                  DO 190 K = 1, KK
kusano 2b45e8
                     DO 180 I = 1, M
kusano 2b45e8
                        CT( I ) = CT( I ) + A( K, I )*B( J, K )
kusano 2b45e8
                        G( I ) = G( I ) + ABS1( A( K, I ) )*
kusano 2b45e8
     $                           ABS1( B( J, K ) )
kusano 2b45e8
  180                CONTINUE
kusano 2b45e8
  190             CONTINUE
kusano 2b45e8
               END IF
kusano 2b45e8
            END IF
kusano 2b45e8
         END IF
kusano 2b45e8
         DO 200 I = 1, M
kusano 2b45e8
            CT( I ) = ALPHA*CT( I ) + BETA*C( I, J )
kusano 2b45e8
            G( I ) = ABS1( ALPHA )*G( I ) +
kusano 2b45e8
     $               ABS1( BETA )*ABS1( C( I, J ) )
kusano 2b45e8
  200    CONTINUE
kusano 2b45e8
*
kusano 2b45e8
*        Compute the error ratio for this result.
kusano 2b45e8
*
kusano 2b45e8
         ERR = ZERO
kusano 2b45e8
         DO 210 I = 1, M
kusano 2b45e8
            ERRI = ABS1( CT( I ) - CC( I, J ) )/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 230
kusano 2b45e8
  210    CONTINUE
kusano 2b45e8
*
kusano 2b45e8
  220 CONTINUE
kusano 2b45e8
*
kusano 2b45e8
*     If the loop completes, all results are at least half accurate.
kusano 2b45e8
      GO TO 250
kusano 2b45e8
*
kusano 2b45e8
*     Report fatal error.
kusano 2b45e8
*
kusano 2b45e8
  230 FATAL = .TRUE.
kusano 2b45e8
      WRITE( NOUT, FMT = 9999 )
kusano 2b45e8
      DO 240 I = 1, M
kusano 2b45e8
         IF( MV )THEN
kusano 2b45e8
            WRITE( NOUT, FMT = 9998 )I, CT( I ), CC( I, J )
kusano 2b45e8
         ELSE
kusano 2b45e8
            WRITE( NOUT, FMT = 9998 )I, CC( I, J ), CT( I )
kusano 2b45e8
         END IF
kusano 2b45e8
  240 CONTINUE
kusano 2b45e8
      IF( N.GT.1 )
kusano 2b45e8
     $   WRITE( NOUT, FMT = 9997 )J
kusano 2b45e8
*
kusano 2b45e8
  250 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
 9997 FORMAT( '      THESE ARE THE RESULTS FOR COLUMN ', I3 )
kusano 2b45e8
*
kusano 2b45e8
*     End of CMMCH.
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 3 Blas.
kusano 2b45e8
*
kusano 2b45e8
*  -- Written on 8-February-1989.
kusano 2b45e8
*     Jack Dongarra, Argonne National Laboratory.
kusano 2b45e8
*     Iain Duff, AERE Harwell.
kusano 2b45e8
*     Jeremy Du Croz, Numerical Algorithms Group Ltd.
kusano 2b45e8
*     Sven Hammarling, Numerical Algorithms Group Ltd.
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' or 'he' or 'sy'.
kusano 2b45e8
*
kusano 2b45e8
*  Auxiliary routine for test program for Level 3 Blas.
kusano 2b45e8
*
kusano 2b45e8
*  -- Written on 8-February-1989.
kusano 2b45e8
*     Jack Dongarra, Argonne National Laboratory.
kusano 2b45e8
*     Iain Duff, AERE Harwell.
kusano 2b45e8
*     Jeremy Du Croz, Numerical Algorithms Group Ltd.
kusano 2b45e8
*     Sven Hammarling, Numerical Algorithms Group Ltd.
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'.OR.TYPE.EQ.'sy' )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 3 Blas.
kusano 2b45e8
*
kusano 2b45e8
*  -- Written on 8-February-1989.
kusano 2b45e8
*     Jack Dongarra, Argonne National Laboratory.
kusano 2b45e8
*     Iain Duff, AERE Harwell.
kusano 2b45e8
*     Jeremy Du Croz, Numerical Algorithms Group Ltd.
kusano 2b45e8
*     Sven Hammarling, Numerical Algorithms Group Ltd.
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 3 Blas.
kusano 2b45e8
*
kusano 2b45e8
*  -- Written on 8-February-1989.
kusano 2b45e8
*     Jack Dongarra, Argonne National Laboratory.
kusano 2b45e8
*     Iain Duff, AERE Harwell.
kusano 2b45e8
*     Jeremy Du Croz, Numerical Algorithms Group Ltd.
kusano 2b45e8
*     Sven Hammarling, Numerical Algorithms Group Ltd.
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