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