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


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