LAPACK 3.3.1 Linear Algebra PACKage

# sckgqr.f

Go to the documentation of this file.
00001       SUBROUTINE SCKGQR( NM, MVAL, NP, PVAL, NN, NVAL, NMATS, ISEED,
00002      \$                   THRESH, NMAX, A, AF, AQ, AR, TAUA, B, BF, BZ,
00003      \$                   BT, BWK, TAUB, WORK, RWORK, NIN, NOUT, INFO )
00004 *
00005 *  -- LAPACK test routine (version 3.1) --
00006 *     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
00007 *     November 2006
00008 *
00009 *     .. Scalar Arguments ..
00010       INTEGER            INFO, NIN, NM, NMATS, NMAX, NN, NOUT, NP
00011       REAL               THRESH
00012 *     ..
00013 *     .. Array Arguments ..
00014       INTEGER            ISEED( 4 ), MVAL( * ), NVAL( * ), PVAL( * )
00015       REAL               A( * ), AF( * ), AQ( * ), AR( * ), B( * ),
00016      \$                   BF( * ), BT( * ), BWK( * ), BZ( * ),
00017      \$                   RWORK( * ), TAUA( * ), TAUB( * ), WORK( * )
00018 *     ..
00019 *
00020 *  Purpose
00021 *  =======
00022 *
00023 *  SCKGQR tests
00024 *  SGGQRF: GQR factorization for N-by-M matrix A and N-by-P matrix B,
00025 *  SGGRQF: GRQ factorization for M-by-N matrix A and P-by-N matrix B.
00026 *
00027 *  Arguments
00028 *  =========
00029 *
00030 *  NM      (input) INTEGER
00031 *          The number of values of M contained in the vector MVAL.
00032 *
00033 *  MVAL    (input) INTEGER array, dimension (NM)
00034 *          The values of the matrix row(column) dimension M.
00035 *
00036 *  NP      (input) INTEGER
00037 *          The number of values of P contained in the vector PVAL.
00038 *
00039 *  PVAL    (input) INTEGER array, dimension (NP)
00040 *          The values of the matrix row(column) dimension P.
00041 *
00042 *  NN      (input) INTEGER
00043 *          The number of values of N contained in the vector NVAL.
00044 *
00045 *  NVAL    (input) INTEGER array, dimension (NN)
00046 *          The values of the matrix column(row) dimension N.
00047 *
00048 *  NMATS   (input) INTEGER
00049 *          The number of matrix types to be tested for each combination
00050 *          of matrix dimensions.  If NMATS >= NTYPES (the maximum
00051 *          number of matrix types), then all the different types are
00052 *          generated for testing.  If NMATS < NTYPES, another input line
00053 *          is read to get the numbers of the matrix types to be used.
00054 *
00055 *  ISEED   (input/output) INTEGER array, dimension (4)
00056 *          On entry, the seed of the random number generator.  The array
00057 *          elements should be between 0 and 4095, otherwise they will be
00058 *          reduced mod 4096, and ISEED(4) must be odd.
00059 *          On exit, the next seed in the random number sequence after
00060 *          all the test matrices have been generated.
00061 *
00062 *  THRESH  (input) REAL
00063 *          The threshold value for the test ratios.  A result is
00064 *          included in the output file if RESULT >= THRESH.  To have
00065 *          every test ratio printed, use THRESH = 0.
00066 *
00067 *  NMAX    (input) INTEGER
00068 *          The maximum value permitted for M or N, used in dimensioning
00069 *          the work arrays.
00070 *
00071 *  A       (workspace) REAL array, dimension (NMAX*NMAX)
00072 *
00073 *  AF      (workspace) REAL array, dimension (NMAX*NMAX)
00074 *
00075 *  AQ      (workspace) REAL array, dimension (NMAX*NMAX)
00076 *
00077 *  AR      (workspace) REAL array, dimension (NMAX*NMAX)
00078 *
00079 *  TAUA    (workspace) REAL array, dimension (NMAX)
00080 *
00081 *  B       (workspace) REAL array, dimension (NMAX*NMAX)
00082 *
00083 *  BF      (workspace) REAL array, dimension (NMAX*NMAX)
00084 *
00085 *  BZ      (workspace) REAL array, dimension (NMAX*NMAX)
00086 *
00087 *  BT      (workspace) REAL array, dimension (NMAX*NMAX)
00088 *
00089 *  BWK     (workspace) REAL array, dimension (NMAX*NMAX)
00090 *
00091 *  TAUB    (workspace) REAL array, dimension (NMAX)
00092 *
00093 *  WORK    (workspace) REAL array, dimension (NMAX*NMAX)
00094 *
00095 *  RWORK   (workspace) REAL array, dimension (NMAX)
00096 *
00097 *  NIN     (input) INTEGER
00098 *          The unit number for input.
00099 *
00100 *  NOUT    (input) INTEGER
00101 *          The unit number for output.
00102 *
00103 *  INFO    (output) INTEGER
00104 *          = 0 :  successful exit
00105 *          > 0 :  If SLATMS returns an error code, the absolute value
00106 *                 of it is returned.
00107 *
00108 *  =====================================================================
00109 *
00110 *     .. Parameters ..
00111       INTEGER            NTESTS
00112       PARAMETER          ( NTESTS = 7 )
00113       INTEGER            NTYPES
00114       PARAMETER          ( NTYPES = 8 )
00115 *     ..
00116 *     .. Local Scalars ..
00117       LOGICAL            FIRSTT
00118       CHARACTER          DISTA, DISTB, TYPE
00119       CHARACTER*3        PATH
00120       INTEGER            I, IINFO, IM, IMAT, IN, IP, KLA, KLB, KUA, KUB,
00121      \$                   LDA, LDB, LWORK, M, MODEA, MODEB, N, NFAIL,
00122      \$                   NRUN, NT, P
00123       REAL               ANORM, BNORM, CNDNMA, CNDNMB
00124 *     ..
00125 *     .. Local Arrays ..
00126       LOGICAL            DOTYPE( NTYPES )
00127       REAL               RESULT( NTESTS )
00128 *     ..
00129 *     .. External Subroutines ..
00130       EXTERNAL           ALAHDG, ALAREQ, ALASUM, SGQRTS, SGRQTS, SLATB9,
00131      \$                   SLATMS
00132 *     ..
00133 *     .. Intrinsic Functions ..
00134       INTRINSIC          ABS
00135 *     ..
00136 *     .. Executable Statements ..
00137 *
00138 *     Initialize constants.
00139 *
00140       PATH( 1: 3 ) = 'GQR'
00141       INFO = 0
00142       NRUN = 0
00143       NFAIL = 0
00144       FIRSTT = .TRUE.
00145       CALL ALAREQ( PATH, NMATS, DOTYPE, NTYPES, NIN, NOUT )
00146       LDA = NMAX
00147       LDB = NMAX
00148       LWORK = NMAX*NMAX
00149 *
00150 *     Do for each value of M in MVAL.
00151 *
00152       DO 60 IM = 1, NM
00153          M = MVAL( IM )
00154 *
00155 *        Do for each value of P in PVAL.
00156 *
00157          DO 50 IP = 1, NP
00158             P = PVAL( IP )
00159 *
00160 *           Do for each value of N in NVAL.
00161 *
00162             DO 40 IN = 1, NN
00163                N = NVAL( IN )
00164 *
00165                DO 30 IMAT = 1, NTYPES
00166 *
00167 *                 Do the tests only if DOTYPE( IMAT ) is true.
00168 *
00169                   IF( .NOT.DOTYPE( IMAT ) )
00170      \$               GO TO 30
00171 *
00172 *                 Test SGGRQF
00173 *
00174 *                 Set up parameters with SLATB9 and generate test
00175 *                 matrices A and B with SLATMS.
00176 *
00177                   CALL SLATB9( 'GRQ', IMAT, M, P, N, TYPE, KLA, KUA,
00178      \$                         KLB, KUB, ANORM, BNORM, MODEA, MODEB,
00179      \$                         CNDNMA, CNDNMB, DISTA, DISTB )
00180 *
00181 *                 Generate M by N matrix A
00182 *
00183                   CALL SLATMS( M, N, DISTA, ISEED, TYPE, RWORK, MODEA,
00184      \$                         CNDNMA, ANORM, KLA, KUA, 'No packing', A,
00185      \$                         LDA, WORK, IINFO )
00186                   IF( IINFO.NE.0 ) THEN
00187                      WRITE( NOUT, FMT = 9999 )IINFO
00188                      INFO = ABS( IINFO )
00189                      GO TO 30
00190                   END IF
00191 *
00192 *                 Generate P by N matrix B
00193 *
00194                   CALL SLATMS( P, N, DISTB, ISEED, TYPE, RWORK, MODEB,
00195      \$                         CNDNMB, BNORM, KLB, KUB, 'No packing', B,
00196      \$                         LDB, WORK, IINFO )
00197                   IF( IINFO.NE.0 ) THEN
00198                      WRITE( NOUT, FMT = 9999 )IINFO
00199                      INFO = ABS( IINFO )
00200                      GO TO 30
00201                   END IF
00202 *
00203                   NT = 4
00204 *
00205                   CALL SGRQTS( M, P, N, A, AF, AQ, AR, LDA, TAUA, B, BF,
00206      \$                         BZ, BT, BWK, LDB, TAUB, WORK, LWORK,
00207      \$                         RWORK, RESULT )
00208 *
00209 *                 Print information about the tests that did not
00210 *                 pass the threshold.
00211 *
00212                   DO 10 I = 1, NT
00213                      IF( RESULT( I ).GE.THRESH ) THEN
00214                         IF( NFAIL.EQ.0 .AND. FIRSTT ) THEN
00215                            FIRSTT = .FALSE.
00216                            CALL ALAHDG( NOUT, 'GRQ' )
00217                         END IF
00218                         WRITE( NOUT, FMT = 9998 )M, P, N, IMAT, I,
00219      \$                     RESULT( I )
00220                         NFAIL = NFAIL + 1
00221                      END IF
00222    10             CONTINUE
00223                   NRUN = NRUN + NT
00224 *
00225 *                 Test SGGQRF
00226 *
00227 *                 Set up parameters with SLATB9 and generate test
00228 *                 matrices A and B with SLATMS.
00229 *
00230                   CALL SLATB9( 'GQR', IMAT, M, P, N, TYPE, KLA, KUA,
00231      \$                         KLB, KUB, ANORM, BNORM, MODEA, MODEB,
00232      \$                         CNDNMA, CNDNMB, DISTA, DISTB )
00233 *
00234 *                 Generate N-by-M matrix  A
00235 *
00236                   CALL SLATMS( N, M, DISTA, ISEED, TYPE, RWORK, MODEA,
00237      \$                         CNDNMA, ANORM, KLA, KUA, 'No packing', A,
00238      \$                         LDA, WORK, IINFO )
00239                   IF( IINFO.NE.0 ) THEN
00240                      WRITE( NOUT, FMT = 9999 )IINFO
00241                      INFO = ABS( IINFO )
00242                      GO TO 30
00243                   END IF
00244 *
00245 *                 Generate N-by-P matrix  B
00246 *
00247                   CALL SLATMS( N, P, DISTB, ISEED, TYPE, RWORK, MODEA,
00248      \$                         CNDNMA, BNORM, KLB, KUB, 'No packing', B,
00249      \$                         LDB, WORK, IINFO )
00250                   IF( IINFO.NE.0 ) THEN
00251                      WRITE( NOUT, FMT = 9999 )IINFO
00252                      INFO = ABS( IINFO )
00253                      GO TO 30
00254                   END IF
00255 *
00256                   NT = 4
00257 *
00258                   CALL SGQRTS( N, M, P, A, AF, AQ, AR, LDA, TAUA, B, BF,
00259      \$                         BZ, BT, BWK, LDB, TAUB, WORK, LWORK,
00260      \$                         RWORK, RESULT )
00261 *
00262 *                 Print information about the tests that did not
00263 *                 pass the threshold.
00264 *
00265                   DO 20 I = 1, NT
00266                      IF( RESULT( I ).GE.THRESH ) THEN
00267                         IF( NFAIL.EQ.0 .AND. FIRSTT ) THEN
00268                            FIRSTT = .FALSE.
00269                            CALL ALAHDG( NOUT, PATH )
00270                         END IF
00271                         WRITE( NOUT, FMT = 9997 )N, M, P, IMAT, I,
00272      \$                     RESULT( I )
00273                         NFAIL = NFAIL + 1
00274                      END IF
00275    20             CONTINUE
00276                   NRUN = NRUN + NT
00277 *
00278    30          CONTINUE
00279    40       CONTINUE
00280    50    CONTINUE
00281    60 CONTINUE
00282 *
00283 *     Print a summary of the results.
00284 *
00285       CALL ALASUM( PATH, NOUT, NFAIL, NRUN, 0 )
00286 *
00287  9999 FORMAT( ' SLATMS in SCKGQR:    INFO = ', I5 )
00288  9998 FORMAT( ' M=', I4, ' P=', I4, ', N=', I4, ', type ', I2,
00289      \$      ', test ', I2, ', ratio=', G13.6 )
00290  9997 FORMAT( ' N=', I4, ' M=', I4, ', P=', I4, ', type ', I2,
00291      \$      ', test ', I2, ', ratio=', G13.6 )
00292       RETURN
00293 *
00294 *     End of SCKGQR
00295 *
00296       END