sckglm.c
Go to the documentation of this file.
00001 /* sckglm.f -- translated by f2c (version 20061008).
00002    You must link the resulting object file with libf2c:
00003         on Microsoft Windows system, link with libf2c.lib;
00004         on Linux or Unix systems, link with .../path/to/libf2c.a -lm
00005         or, if you install libf2c.a in a standard place, with -lf2c -lm
00006         -- in that order, at the end of the command line, as in
00007                 cc *.o -lf2c -lm
00008         Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,
00009 
00010                 http://www.netlib.org/f2c/libf2c.zip
00011 */
00012 
00013 #include "f2c.h"
00014 #include "blaswrap.h"
00015 
00016 /* Table of constant values */
00017 
00018 static integer c__8 = 8;
00019 static integer c__1 = 1;
00020 static integer c__2 = 2;
00021 static integer c__0 = 0;
00022 
00023 /* Subroutine */ int sckglm_(integer *nn, integer *mval, integer *pval, 
00024         integer *nval, integer *nmats, integer *iseed, real *thresh, integer *
00025         nmax, real *a, real *af, real *b, real *bf, real *x, real *work, real 
00026         *rwork, integer *nin, integer *nout, integer *info)
00027 {
00028     /* Format strings */
00029     static char fmt_9997[] = "(\002 *** Invalid input  for GLM:  M = \002,"
00030             "i6,\002, P = \002,i6,\002, N = \002,i6,\002;\002,/\002     must "
00031             "satisfy M <= N <= M+P  \002,\002(this set of values will be skip"
00032             "ped)\002)";
00033     static char fmt_9999[] = "(\002 SLATMS in SCKGLM INFO = \002,i5)";
00034     static char fmt_9998[] = "(\002 N=\002,i4,\002 M=\002,i4,\002, P=\002,"
00035             "i4,\002, type \002,i2,\002, test \002,i2,\002, ratio=\002,g13.6)";
00036 
00037     /* System generated locals */
00038     integer i__1, i__2;
00039 
00040     /* Builtin functions */
00041     /* Subroutine */ int s_copy(char *, char *, ftnlen, ftnlen);
00042     integer s_wsle(cilist *), e_wsle(void), s_wsfe(cilist *), do_fio(integer *
00043             , char *, ftnlen), e_wsfe(void);
00044 
00045     /* Local variables */
00046     integer i__, m, n, p, ik, lda, ldb, kla, klb, kua, kub, imat;
00047     char path[3], type__[1];
00048     integer nrun, modea, modeb, nfail;
00049     char dista[1], distb[1];
00050     integer iinfo;
00051     real resid, anorm, bnorm;
00052     integer lwork;
00053     extern /* Subroutine */ int slatb9_(char *, integer *, integer *, integer 
00054             *, integer *, char *, integer *, integer *, integer *, integer *, 
00055             real *, real *, integer *, integer *, real *, real *, char *, 
00056             char *), alahdg_(integer *, char *
00057 );
00058     real cndnma, cndnmb;
00059     extern /* Subroutine */ int alareq_(char *, integer *, logical *, integer 
00060             *, integer *, integer *), alasum_(char *, integer *, 
00061             integer *, integer *, integer *);
00062     extern doublereal slarnd_(integer *, integer *);
00063     extern /* Subroutine */ int slatms_(integer *, integer *, char *, integer 
00064             *, char *, real *, integer *, real *, real *, integer *, integer *
00065 , char *, real *, integer *, real *, integer *);
00066     logical dotype[8];
00067     extern /* Subroutine */ int sglmts_(integer *, integer *, integer *, real 
00068             *, real *, integer *, real *, real *, integer *, real *, real *, 
00069             real *, real *, real *, integer *, real *, real *);
00070     logical firstt;
00071 
00072     /* Fortran I/O blocks */
00073     static cilist io___13 = { 0, 0, 0, 0, 0 };
00074     static cilist io___14 = { 0, 0, 0, fmt_9997, 0 };
00075     static cilist io___30 = { 0, 0, 0, fmt_9999, 0 };
00076     static cilist io___31 = { 0, 0, 0, fmt_9999, 0 };
00077     static cilist io___34 = { 0, 0, 0, fmt_9998, 0 };
00078 
00079 
00080 
00081 /*  -- LAPACK test routine (version 3.1) -- */
00082 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00083 /*     November 2006 */
00084 
00085 /*     .. Scalar Arguments .. */
00086 /*     .. */
00087 /*     .. Array Arguments .. */
00088 /*     .. */
00089 
00090 /*  Purpose */
00091 /*  ======= */
00092 
00093 /*  SCKGLM tests SGGGLM - subroutine for solving generalized linear */
00094 /*                        model problem. */
00095 
00096 /*  Arguments */
00097 /*  ========= */
00098 
00099 /*  NN      (input) INTEGER */
00100 /*          The number of values of N, M and P contained in the vectors */
00101 /*          NVAL, MVAL and PVAL. */
00102 
00103 /*  MVAL    (input) INTEGER array, dimension (NN) */
00104 /*          The values of the matrix column dimension M. */
00105 
00106 /*  PVAL    (input) INTEGER array, dimension (NN) */
00107 /*          The values of the matrix column dimension P. */
00108 
00109 /*  NVAL    (input) INTEGER array, dimension (NN) */
00110 /*          The values of the matrix row dimension N. */
00111 
00112 /*  NMATS   (input) INTEGER */
00113 /*          The number of matrix types to be tested for each combination */
00114 /*          of matrix dimensions.  If NMATS >= NTYPES (the maximum */
00115 /*          number of matrix types), then all the different types are */
00116 /*          generated for testing.  If NMATS < NTYPES, another input line */
00117 /*          is read to get the numbers of the matrix types to be used. */
00118 
00119 /*  ISEED   (input/output) INTEGER array, dimension (4) */
00120 /*          On entry, the seed of the random number generator.  The array */
00121 /*          elements should be between 0 and 4095, otherwise they will be */
00122 /*          reduced mod 4096, and ISEED(4) must be odd. */
00123 /*          On exit, the next seed in the random number sequence after */
00124 /*          all the test matrices have been generated. */
00125 
00126 /*  THRESH  (input) REAL */
00127 /*          The threshold value for the test ratios.  A result is */
00128 /*          included in the output file if RESID >= THRESH.  To have */
00129 /*          every test ratio printed, use THRESH = 0. */
00130 
00131 /*  NMAX    (input) INTEGER */
00132 /*          The maximum value permitted for M or N, used in dimensioning */
00133 /*          the work arrays. */
00134 
00135 /*  A       (workspace) REAL array, dimension (NMAX*NMAX) */
00136 
00137 /*  AF      (workspace) REAL array, dimension (NMAX*NMAX) */
00138 
00139 /*  B       (workspace) REAL array, dimension (NMAX*NMAX) */
00140 
00141 /*  BF      (workspace) REAL array, dimension (NMAX*NMAX) */
00142 
00143 /*  X       (workspace) REAL array, dimension (4*NMAX) */
00144 
00145 /*  RWORK   (workspace) REAL array, dimension (NMAX) */
00146 
00147 /*  WORK    (workspace) REAL array, dimension (NMAX*NMAX) */
00148 
00149 /*  NIN     (input) INTEGER */
00150 /*          The unit number for input. */
00151 
00152 /*  NOUT    (input) INTEGER */
00153 /*          The unit number for output. */
00154 
00155 /*  INFO    (output) INTEGER */
00156 /*          = 0 :  successful exit */
00157 /*          > 0 :  If SLATMS returns an error code, the absolute value */
00158 /*                 of it is returned. */
00159 
00160 /*  ===================================================================== */
00161 
00162 /*     .. Parameters .. */
00163 /*     .. */
00164 /*     .. Local Scalars .. */
00165 /*     .. */
00166 /*     .. Local Arrays .. */
00167 /*     .. */
00168 /*     .. External Functions .. */
00169 /*     .. */
00170 /*     .. External Subroutines .. */
00171 /*     .. */
00172 /*     .. Intrinsic Functions .. */
00173 /*     .. */
00174 /*     .. Executable Statements .. */
00175 
00176 /*     Initialize constants. */
00177 
00178     /* Parameter adjustments */
00179     --rwork;
00180     --work;
00181     --x;
00182     --bf;
00183     --b;
00184     --af;
00185     --a;
00186     --iseed;
00187     --nval;
00188     --pval;
00189     --mval;
00190 
00191     /* Function Body */
00192     s_copy(path, "GLM", (ftnlen)3, (ftnlen)3);
00193     *info = 0;
00194     nrun = 0;
00195     nfail = 0;
00196     firstt = TRUE_;
00197     alareq_(path, nmats, dotype, &c__8, nin, nout);
00198     lda = *nmax;
00199     ldb = *nmax;
00200     lwork = *nmax * *nmax;
00201 
00202 /*     Check for valid input values. */
00203 
00204     i__1 = *nn;
00205     for (ik = 1; ik <= i__1; ++ik) {
00206         m = mval[ik];
00207         p = pval[ik];
00208         n = nval[ik];
00209         if (m > n || n > m + p) {
00210             if (firstt) {
00211                 io___13.ciunit = *nout;
00212                 s_wsle(&io___13);
00213                 e_wsle();
00214                 firstt = FALSE_;
00215             }
00216             io___14.ciunit = *nout;
00217             s_wsfe(&io___14);
00218             do_fio(&c__1, (char *)&m, (ftnlen)sizeof(integer));
00219             do_fio(&c__1, (char *)&p, (ftnlen)sizeof(integer));
00220             do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00221             e_wsfe();
00222         }
00223 /* L10: */
00224     }
00225     firstt = TRUE_;
00226 
00227 /*     Do for each value of M in MVAL. */
00228 
00229     i__1 = *nn;
00230     for (ik = 1; ik <= i__1; ++ik) {
00231         m = mval[ik];
00232         p = pval[ik];
00233         n = nval[ik];
00234         if (m > n || n > m + p) {
00235             goto L40;
00236         }
00237 
00238         for (imat = 1; imat <= 8; ++imat) {
00239 
00240 /*           Do the tests only if DOTYPE( IMAT ) is true. */
00241 
00242             if (! dotype[imat - 1]) {
00243                 goto L30;
00244             }
00245 
00246 /*           Set up parameters with SLATB9 and generate test */
00247 /*           matrices A and B with SLATMS. */
00248 
00249             slatb9_(path, &imat, &m, &p, &n, type__, &kla, &kua, &klb, &kub, &
00250                     anorm, &bnorm, &modea, &modeb, &cndnma, &cndnmb, dista, 
00251                     distb);
00252 
00253             slatms_(&n, &m, dista, &iseed[1], type__, &rwork[1], &modea, &
00254                     cndnma, &anorm, &kla, &kua, "No packing", &a[1], &lda, &
00255                     work[1], &iinfo);
00256             if (iinfo != 0) {
00257                 io___30.ciunit = *nout;
00258                 s_wsfe(&io___30);
00259                 do_fio(&c__1, (char *)&iinfo, (ftnlen)sizeof(integer));
00260                 e_wsfe();
00261                 *info = abs(iinfo);
00262                 goto L30;
00263             }
00264 
00265             slatms_(&n, &p, distb, &iseed[1], type__, &rwork[1], &modeb, &
00266                     cndnmb, &bnorm, &klb, &kub, "No packing", &b[1], &ldb, &
00267                     work[1], &iinfo);
00268             if (iinfo != 0) {
00269                 io___31.ciunit = *nout;
00270                 s_wsfe(&io___31);
00271                 do_fio(&c__1, (char *)&iinfo, (ftnlen)sizeof(integer));
00272                 e_wsfe();
00273                 *info = abs(iinfo);
00274                 goto L30;
00275             }
00276 
00277 /*           Generate random left hand side vector of GLM */
00278 
00279             i__2 = n;
00280             for (i__ = 1; i__ <= i__2; ++i__) {
00281                 x[i__] = slarnd_(&c__2, &iseed[1]);
00282 /* L20: */
00283             }
00284 
00285             sglmts_(&n, &m, &p, &a[1], &af[1], &lda, &b[1], &bf[1], &ldb, &x[
00286                     1], &x[*nmax + 1], &x[(*nmax << 1) + 1], &x[*nmax * 3 + 1]
00287 , &work[1], &lwork, &rwork[1], &resid);
00288 
00289 /*           Print information about the tests that did not */
00290 /*           pass the threshold. */
00291 
00292             if (resid >= *thresh) {
00293                 if (nfail == 0 && firstt) {
00294                     firstt = FALSE_;
00295                     alahdg_(nout, path);
00296                 }
00297                 io___34.ciunit = *nout;
00298                 s_wsfe(&io___34);
00299                 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00300                 do_fio(&c__1, (char *)&m, (ftnlen)sizeof(integer));
00301                 do_fio(&c__1, (char *)&p, (ftnlen)sizeof(integer));
00302                 do_fio(&c__1, (char *)&imat, (ftnlen)sizeof(integer));
00303                 do_fio(&c__1, (char *)&c__1, (ftnlen)sizeof(integer));
00304                 do_fio(&c__1, (char *)&resid, (ftnlen)sizeof(real));
00305                 e_wsfe();
00306                 ++nfail;
00307             }
00308             ++nrun;
00309 
00310 L30:
00311             ;
00312         }
00313 L40:
00314         ;
00315     }
00316 
00317 /*     Print a summary of the results. */
00318 
00319     alasum_(path, nout, &nfail, &nrun, &c__0);
00320 
00321     return 0;
00322 
00323 /*     End of SCKGLM */
00324 
00325 } /* sckglm_ */


swiftnav
Author(s):
autogenerated on Sat Jun 8 2019 18:55:59