LAPACK 3.3.0

scklse.f

Go to the documentation of this file.
00001       SUBROUTINE SCKLSE( NN, MVAL, PVAL, NVAL, NMATS, ISEED, THRESH,
00002      $                   NMAX, A, AF, B, BF, X, WORK, RWORK, NIN, NOUT,
00003      $                   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, NMATS, NMAX, NN, NOUT
00011       REAL               THRESH
00012 *     ..
00013 *     .. Array Arguments ..
00014       INTEGER            ISEED( 4 ), MVAL( * ), NVAL( * ), PVAL( * )
00015       REAL               A( * ), AF( * ), B( * ), BF( * ), RWORK( * ),
00016      $                   WORK( * ), X( * )
00017 *     ..
00018 *
00019 *  Purpose
00020 *  =======
00021 *
00022 *  SCKLSE tests SGGLSE - a subroutine for solving linear equality
00023 *  constrained least square problem (LSE).
00024 *
00025 *  Arguments
00026 *  =========
00027 *
00028 *  NN      (input) INTEGER
00029 *          The number of values of (M,P,N) contained in the vectors
00030 *          (MVAL, PVAL, NVAL).
00031 *
00032 *  MVAL    (input) INTEGER array, dimension (NN)
00033 *          The values of the matrix row(column) dimension M.
00034 *
00035 *  PVAL    (input) INTEGER array, dimension (NN)
00036 *          The values of the matrix row(column) dimension P.
00037 *
00038 *  NVAL    (input) INTEGER array, dimension (NN)
00039 *          The values of the matrix column(row) dimension N.
00040 *
00041 *  NMATS   (input) INTEGER
00042 *          The number of matrix types to be tested for each combination
00043 *          of matrix dimensions.  If NMATS >= NTYPES (the maximum
00044 *          number of matrix types), then all the different types are
00045 *          generated for testing.  If NMATS < NTYPES, another input line
00046 *          is read to get the numbers of the matrix types to be used.
00047 *
00048 *  ISEED   (input/output) INTEGER array, dimension (4)
00049 *          On entry, the seed of the random number generator.  The array
00050 *          elements should be between 0 and 4095, otherwise they will be
00051 *          reduced mod 4096, and ISEED(4) must be odd.
00052 *          On exit, the next seed in the random number sequence after
00053 *          all the test matrices have been generated.
00054 *
00055 *  THRESH  (input) REAL
00056 *          The threshold value for the test ratios.  A result is
00057 *          included in the output file if RESULT >= THRESH.  To have
00058 *          every test ratio printed, use THRESH = 0.
00059 *
00060 *  NMAX    (input) INTEGER
00061 *          The maximum value permitted for M or N, used in dimensioning
00062 *          the work arrays.
00063 *
00064 *  A       (workspace) REAL array, dimension (NMAX*NMAX)
00065 *
00066 *  AF      (workspace) REAL array, dimension (NMAX*NMAX)
00067 *
00068 *  B       (workspace) REAL array, dimension (NMAX*NMAX)
00069 *
00070 *  BF      (workspace) REAL array, dimension (NMAX*NMAX)
00071 *
00072 *  X       (workspace) REAL array, dimension (5*NMAX)
00073 *
00074 *  WORK    (workspace) REAL array, dimension (NMAX*NMAX)
00075 *
00076 *  RWORK   (workspace) REAL array, dimension (NMAX)
00077 *
00078 *  NIN     (input) INTEGER
00079 *          The unit number for input.
00080 *
00081 *  NOUT    (input) INTEGER
00082 *          The unit number for output.
00083 *
00084 *  INFO    (output) INTEGER
00085 *          = 0 :  successful exit
00086 *          > 0 :  If SLATMS returns an error code, the absolute value
00087 *                 of it is returned.
00088 *
00089 *  =====================================================================
00090 *
00091 *     .. Parameters ..
00092       INTEGER            NTESTS
00093       PARAMETER          ( NTESTS = 7 )
00094       INTEGER            NTYPES
00095       PARAMETER          ( NTYPES = 8 )
00096 *     ..
00097 *     .. Local Scalars ..
00098       LOGICAL            FIRSTT
00099       CHARACTER          DISTA, DISTB, TYPE
00100       CHARACTER*3        PATH
00101       INTEGER            I, IINFO, IK, IMAT, KLA, KLB, KUA, KUB, LDA,
00102      $                   LDB, LWORK, M, MODEA, MODEB, N, NFAIL, NRUN,
00103      $                   NT, P
00104       REAL               ANORM, BNORM, CNDNMA, CNDNMB
00105 *     ..
00106 *     .. Local Arrays ..
00107       LOGICAL            DOTYPE( NTYPES )
00108       REAL               RESULT( NTESTS )
00109 *     ..
00110 *     .. External Subroutines ..
00111       EXTERNAL           ALAHDG, ALAREQ, ALASUM, SLARHS, SLATB9, SLATMS,
00112      $                   SLSETS
00113 *     ..
00114 *     .. Intrinsic Functions ..
00115       INTRINSIC          ABS, MAX
00116 *     ..
00117 *     .. Executable Statements ..
00118 *
00119 *     Initialize constants and the random number seed.
00120 *
00121       PATH( 1: 3 ) = 'LSE'
00122       INFO = 0
00123       NRUN = 0
00124       NFAIL = 0
00125       FIRSTT = .TRUE.
00126       CALL ALAREQ( PATH, NMATS, DOTYPE, NTYPES, NIN, NOUT )
00127       LDA = NMAX
00128       LDB = NMAX
00129       LWORK = NMAX*NMAX
00130 *
00131 *     Check for valid input values.
00132 *
00133       DO 10 IK = 1, NN
00134          M = MVAL( IK )
00135          P = PVAL( IK )
00136          N = NVAL( IK )
00137          IF( P.GT.N .OR. N.GT.M+P ) THEN
00138             IF( FIRSTT ) THEN
00139                WRITE( NOUT, FMT = * )
00140                FIRSTT = .FALSE.
00141             END IF
00142             WRITE( NOUT, FMT = 9997 )M, P, N
00143          END IF
00144    10 CONTINUE
00145       FIRSTT = .TRUE.
00146 *
00147 *     Do for each value of M in MVAL.
00148 *
00149       DO 40 IK = 1, NN
00150          M = MVAL( IK )
00151          P = PVAL( IK )
00152          N = NVAL( IK )
00153          IF( P.GT.N .OR. N.GT.M+P )
00154      $      GO TO 40
00155 *
00156          DO 30 IMAT = 1, NTYPES
00157 *
00158 *           Do the tests only if DOTYPE( IMAT ) is true.
00159 *
00160             IF( .NOT.DOTYPE( IMAT ) )
00161      $         GO TO 30
00162 *
00163 *           Set up parameters with SLATB9 and generate test
00164 *           matrices A and B with SLATMS.
00165 *
00166             CALL SLATB9( PATH, IMAT, M, P, N, TYPE, KLA, KUA, KLB, KUB,
00167      $                   ANORM, BNORM, MODEA, MODEB, CNDNMA, CNDNMB,
00168      $                   DISTA, DISTB )
00169 *
00170             CALL SLATMS( M, N, DISTA, ISEED, TYPE, RWORK, MODEA, CNDNMA,
00171      $                   ANORM, KLA, KUA, 'No packing', A, LDA, WORK,
00172      $                   IINFO )
00173             IF( IINFO.NE.0 ) THEN
00174                WRITE( NOUT, FMT = 9999 )IINFO
00175                INFO = ABS( IINFO )
00176                GO TO 30
00177             END IF
00178 *
00179             CALL SLATMS( P, N, DISTB, ISEED, TYPE, RWORK, MODEB, CNDNMB,
00180      $                   BNORM, KLB, KUB, 'No packing', B, LDB, WORK,
00181      $                   IINFO )
00182             IF( IINFO.NE.0 ) THEN
00183                WRITE( NOUT, FMT = 9999 )IINFO
00184                INFO = ABS( IINFO )
00185                GO TO 30
00186             END IF
00187 *
00188 *           Generate the right-hand sides C and D for the LSE.
00189 *
00190             CALL SLARHS( 'SGE', 'New solution', 'Upper', 'N', M, N,
00191      $                   MAX( M-1, 0 ), MAX( N-1, 0 ), 1, A, LDA,
00192      $                   X( 4*NMAX+1 ), MAX( N, 1 ), X, MAX( M, 1 ),
00193      $                   ISEED, IINFO )
00194 *
00195             CALL SLARHS( 'SGE', 'Computed', 'Upper', 'N', P, N,
00196      $                   MAX( P-1, 0 ), MAX( N-1, 0 ), 1, B, LDB,
00197      $                   X( 4*NMAX+1 ), MAX( N, 1 ), X( 2*NMAX+1 ),
00198      $                   MAX( P, 1 ), ISEED, IINFO )
00199 *
00200             NT = 2
00201 *
00202             CALL SLSETS( M, P, N, A, AF, LDA, B, BF, LDB, X,
00203      $                   X( NMAX+1 ), X( 2*NMAX+1 ), X( 3*NMAX+1 ),
00204      $                   X( 4*NMAX+1 ), WORK, LWORK, RWORK,
00205      $                   RESULT( 1 ) )
00206 *
00207 *           Print information about the tests that did not
00208 *           pass the threshold.
00209 *
00210             DO 20 I = 1, NT
00211                IF( RESULT( I ).GE.THRESH ) THEN
00212                   IF( NFAIL.EQ.0 .AND. FIRSTT ) THEN
00213                      FIRSTT = .FALSE.
00214                      CALL ALAHDG( NOUT, PATH )
00215                   END IF
00216                   WRITE( NOUT, FMT = 9998 )M, P, N, IMAT, I,
00217      $               RESULT( I )
00218                   NFAIL = NFAIL + 1
00219                END IF
00220    20       CONTINUE
00221             NRUN = NRUN + NT
00222 *
00223    30    CONTINUE
00224    40 CONTINUE
00225 *
00226 *     Print a summary of the results.
00227 *
00228       CALL ALASUM( PATH, NOUT, NFAIL, NRUN, 0 )
00229 *
00230  9999 FORMAT( ' SLATMS in SCKLSE   INFO = ', I5 )
00231  9998 FORMAT( ' M=', I4, ' P=', I4, ', N=', I4, ', type ', I2,
00232      $      ', test ', I2, ', ratio=', G13.6 )
00233  9997 FORMAT( ' *** Invalid input  for LSE:  M = ', I6, ', P = ', I6,
00234      $      ', N = ', I6, ';', / '     must satisfy P <= N <= P+M  ',
00235      $      '(this set of values will be skipped)' )
00236       RETURN
00237 *
00238 *     End of SCKLSE
00239 *
00240       END
 All Files Functions