schkql.c
Go to the documentation of this file.
00001 /* schkql.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 /* Common Block Declarations */
00017 
00018 struct {
00019     integer infot, nunit;
00020     logical ok, lerr;
00021 } infoc_;
00022 
00023 #define infoc_1 infoc_
00024 
00025 struct {
00026     char srnamt[32];
00027 } srnamc_;
00028 
00029 #define srnamc_1 srnamc_
00030 
00031 /* Table of constant values */
00032 
00033 static integer c__2 = 2;
00034 static integer c__0 = 0;
00035 static integer c_n1 = -1;
00036 static integer c__1 = 1;
00037 static integer c__3 = 3;
00038 
00039 /* Subroutine */ int schkql_(logical *dotype, integer *nm, integer *mval, 
00040         integer *nn, integer *nval, integer *nnb, integer *nbval, integer *
00041         nxval, integer *nrhs, real *thresh, logical *tsterr, integer *nmax, 
00042         real *a, real *af, real *aq, real *al, real *ac, real *b, real *x, 
00043         real *xact, real *tau, real *work, real *rwork, integer *iwork, 
00044         integer *nout)
00045 {
00046     /* Initialized data */
00047 
00048     static integer iseedy[4] = { 1988,1989,1990,1991 };
00049 
00050     /* Format strings */
00051     static char fmt_9999[] = "(\002 M=\002,i5,\002, N=\002,i5,\002, K=\002,i"
00052             "5,\002, NB=\002,i4,\002, NX=\002,i5,\002, type \002,i2,\002, tes"
00053             "t(\002,i2,\002)=\002,g12.5)";
00054 
00055     /* System generated locals */
00056     integer i__1, i__2, i__3, i__4, i__5;
00057 
00058     /* Builtin functions */
00059     /* Subroutine */ int s_copy(char *, char *, ftnlen, ftnlen);
00060     integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void);
00061 
00062     /* Local variables */
00063     integer i__, k, m, n, nb, ik, im, in, kl, nk, ku, nt, nx, lda, inb, mode, 
00064             imat, info;
00065     char path[3];
00066     integer kval[4];
00067     char dist[1], type__[1];
00068     integer nrun;
00069     extern /* Subroutine */ int alahd_(integer *, char *);
00070     integer nfail, iseed[4];
00071     extern /* Subroutine */ int sget02_(char *, integer *, integer *, integer 
00072             *, real *, integer *, real *, integer *, real *, integer *, real *
00073 , real *);
00074     real anorm;
00075     integer minmn;
00076     extern /* Subroutine */ int sqlt01_(integer *, integer *, real *, real *, 
00077             real *, real *, integer *, real *, real *, integer *, real *, 
00078             real *), sqlt02_(integer *, integer *, integer *, real *, real *, 
00079             real *, real *, integer *, real *, real *, integer *, real *, 
00080             real *), sqlt03_(integer *, integer *, integer *, real *, real *, 
00081             real *, real *, integer *, real *, real *, integer *, real *, 
00082             real *);
00083     integer nerrs, lwork;
00084     extern /* Subroutine */ int slatb4_(char *, integer *, integer *, integer 
00085             *, char *, integer *, integer *, real *, integer *, real *, char *
00086 ), alaerh_(char *, char *, integer *, 
00087             integer *, char *, integer *, integer *, integer *, integer *, 
00088             integer *, integer *, integer *, integer *, integer *);
00089     extern logical sgennd_(integer *, integer *, real *, integer *);
00090     extern /* Subroutine */ int alasum_(char *, integer *, integer *, integer 
00091             *, integer *);
00092     real cndnum;
00093     extern /* Subroutine */ int slacpy_(char *, integer *, integer *, real *, 
00094             integer *, real *, integer *), slarhs_(char *, char *, 
00095             char *, char *, integer *, integer *, integer *, integer *, 
00096             integer *, real *, integer *, real *, integer *, real *, integer *
00097 , integer *, integer *), sgeqls_(
00098             integer *, integer *, integer *, real *, integer *, real *, real *
00099 , integer *, real *, integer *, integer *), xlaenv_(integer *, 
00100             integer *), slatms_(integer *, integer *, char *, integer *, char 
00101             *, real *, integer *, real *, real *, integer *, integer *, char *
00102 , real *, integer *, real *, integer *), 
00103             serrql_(char *, integer *);
00104     real result[8];
00105 
00106     /* Fortran I/O blocks */
00107     static cilist io___33 = { 0, 0, 0, fmt_9999, 0 };
00108 
00109 
00110 
00111 /*  -- LAPACK test routine (version 3.1) -- */
00112 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00113 /*     November 2006 */
00114 
00115 /*     .. Scalar Arguments .. */
00116 /*     .. */
00117 /*     .. Array Arguments .. */
00118 /*     .. */
00119 
00120 /*  Purpose */
00121 /*  ======= */
00122 
00123 /*  SCHKQL tests SGEQLF, SORGQL and SORMQL. */
00124 
00125 /*  Arguments */
00126 /*  ========= */
00127 
00128 /*  DOTYPE  (input) LOGICAL array, dimension (NTYPES) */
00129 /*          The matrix types to be used for testing.  Matrices of type j */
00130 /*          (for 1 <= j <= NTYPES) are used for testing if DOTYPE(j) = */
00131 /*          .TRUE.; if DOTYPE(j) = .FALSE., then type j is not used. */
00132 
00133 /*  NM      (input) INTEGER */
00134 /*          The number of values of M contained in the vector MVAL. */
00135 
00136 /*  MVAL    (input) INTEGER array, dimension (NM) */
00137 /*          The values of the matrix row dimension M. */
00138 
00139 /*  NN      (input) INTEGER */
00140 /*          The number of values of N contained in the vector NVAL. */
00141 
00142 /*  NVAL    (input) INTEGER array, dimension (NN) */
00143 /*          The values of the matrix column dimension N. */
00144 
00145 /*  NNB     (input) INTEGER */
00146 /*          The number of values of NB and NX contained in the */
00147 /*          vectors NBVAL and NXVAL.  The blocking parameters are used */
00148 /*          in pairs (NB,NX). */
00149 
00150 /*  NBVAL   (input) INTEGER array, dimension (NNB) */
00151 /*          The values of the blocksize NB. */
00152 
00153 /*  NXVAL   (input) INTEGER array, dimension (NNB) */
00154 /*          The values of the crossover point NX. */
00155 
00156 /*  NRHS    (input) INTEGER */
00157 /*          The number of right hand side vectors to be generated for */
00158 /*          each linear system. */
00159 
00160 /*  THRESH  (input) REAL */
00161 /*          The threshold value for the test ratios.  A result is */
00162 /*          included in the output file if RESULT >= THRESH.  To have */
00163 /*          every test ratio printed, use THRESH = 0. */
00164 
00165 /*  TSTERR  (input) LOGICAL */
00166 /*          Flag that indicates whether error exits are to be tested. */
00167 
00168 /*  NMAX    (input) INTEGER */
00169 /*          The maximum value permitted for M or N, used in dimensioning */
00170 /*          the work arrays. */
00171 
00172 /*  A       (workspace) REAL array, dimension (NMAX*NMAX) */
00173 
00174 /*  AF      (workspace) REAL array, dimension (NMAX*NMAX) */
00175 
00176 /*  AQ      (workspace) REAL array, dimension (NMAX*NMAX) */
00177 
00178 /*  AL      (workspace) REAL array, dimension (NMAX*NMAX) */
00179 
00180 /*  AC      (workspace) REAL array, dimension (NMAX*NMAX) */
00181 
00182 /*  B       (workspace) REAL array, dimension (NMAX*NRHS) */
00183 
00184 /*  X       (workspace) REAL array, dimension (NMAX*NRHS) */
00185 
00186 /*  XACT    (workspace) REAL array, dimension (NMAX*NRHS) */
00187 
00188 /*  TAU     (workspace) REAL array, dimension (NMAX) */
00189 
00190 /*  WORK    (workspace) REAL array, dimension (NMAX*NMAX) */
00191 
00192 /*  RWORK   (workspace) REAL array, dimension (NMAX) */
00193 
00194 /*  IWORK   (workspace) INTEGER array, dimension (NMAX) */
00195 
00196 /*  NOUT    (input) INTEGER */
00197 /*          The unit number for output. */
00198 
00199 /*  ===================================================================== */
00200 
00201 /*     .. Parameters .. */
00202 /*     .. */
00203 /*     .. Local Scalars .. */
00204 /*     .. */
00205 /*     .. Local Arrays .. */
00206 /*     .. */
00207 /*     .. External Functions .. */
00208 /*     .. */
00209 /*     .. External Subroutines .. */
00210 /*     .. */
00211 /*     .. Intrinsic Functions .. */
00212 /*     .. */
00213 /*     .. Scalars in Common .. */
00214 /*     .. */
00215 /*     .. Common blocks .. */
00216 /*     .. */
00217 /*     .. Data statements .. */
00218     /* Parameter adjustments */
00219     --iwork;
00220     --rwork;
00221     --work;
00222     --tau;
00223     --xact;
00224     --x;
00225     --b;
00226     --ac;
00227     --al;
00228     --aq;
00229     --af;
00230     --a;
00231     --nxval;
00232     --nbval;
00233     --nval;
00234     --mval;
00235     --dotype;
00236 
00237     /* Function Body */
00238 /*     .. */
00239 /*     .. Executable Statements .. */
00240 
00241 /*     Initialize constants and the random number seed. */
00242 
00243     s_copy(path, "Single precision", (ftnlen)1, (ftnlen)16);
00244     s_copy(path + 1, "QL", (ftnlen)2, (ftnlen)2);
00245     nrun = 0;
00246     nfail = 0;
00247     nerrs = 0;
00248     for (i__ = 1; i__ <= 4; ++i__) {
00249         iseed[i__ - 1] = iseedy[i__ - 1];
00250 /* L10: */
00251     }
00252 
00253 /*     Test the error exits */
00254 
00255     if (*tsterr) {
00256         serrql_(path, nout);
00257     }
00258     infoc_1.infot = 0;
00259     xlaenv_(&c__2, &c__2);
00260 
00261     lda = *nmax;
00262     lwork = *nmax * max(*nmax,*nrhs);
00263 
00264 /*     Do for each value of M in MVAL. */
00265 
00266     i__1 = *nm;
00267     for (im = 1; im <= i__1; ++im) {
00268         m = mval[im];
00269 
00270 /*        Do for each value of N in NVAL. */
00271 
00272         i__2 = *nn;
00273         for (in = 1; in <= i__2; ++in) {
00274             n = nval[in];
00275             minmn = min(m,n);
00276             for (imat = 1; imat <= 8; ++imat) {
00277 
00278 /*              Do the tests only if DOTYPE( IMAT ) is true. */
00279 
00280                 if (! dotype[imat]) {
00281                     goto L50;
00282                 }
00283 
00284 /*              Set up parameters with SLATB4 and generate a test matrix */
00285 /*              with SLATMS. */
00286 
00287                 slatb4_(path, &imat, &m, &n, type__, &kl, &ku, &anorm, &mode, 
00288                         &cndnum, dist);
00289 
00290                 s_copy(srnamc_1.srnamt, "SLATMS", (ftnlen)32, (ftnlen)6);
00291                 slatms_(&m, &n, dist, iseed, type__, &rwork[1], &mode, &
00292                         cndnum, &anorm, &kl, &ku, "No packing", &a[1], &lda, &
00293                         work[1], &info);
00294 
00295 /*              Check error code from SLATMS. */
00296 
00297                 if (info != 0) {
00298                     alaerh_(path, "SLATMS", &info, &c__0, " ", &m, &n, &c_n1, 
00299                             &c_n1, &c_n1, &imat, &nfail, &nerrs, nout);
00300                     goto L50;
00301                 }
00302 
00303 /*              Set some values for K: the first value must be MINMN, */
00304 /*              corresponding to the call of SQLT01; other values are */
00305 /*              used in the calls of SQLT02, and must not exceed MINMN. */
00306 
00307                 kval[0] = minmn;
00308                 kval[1] = 0;
00309                 kval[2] = 1;
00310                 kval[3] = minmn / 2;
00311                 if (minmn == 0) {
00312                     nk = 1;
00313                 } else if (minmn == 1) {
00314                     nk = 2;
00315                 } else if (minmn <= 3) {
00316                     nk = 3;
00317                 } else {
00318                     nk = 4;
00319                 }
00320 
00321 /*              Do for each value of K in KVAL */
00322 
00323                 i__3 = nk;
00324                 for (ik = 1; ik <= i__3; ++ik) {
00325                     k = kval[ik - 1];
00326 
00327 /*                 Do for each pair of values (NB,NX) in NBVAL and NXVAL. */
00328 
00329                     i__4 = *nnb;
00330                     for (inb = 1; inb <= i__4; ++inb) {
00331                         nb = nbval[inb];
00332                         xlaenv_(&c__1, &nb);
00333                         nx = nxval[inb];
00334                         xlaenv_(&c__3, &nx);
00335                         for (i__ = 1; i__ <= 8; ++i__) {
00336                             result[i__ - 1] = 0.f;
00337                         }
00338                         nt = 2;
00339                         if (ik == 1) {
00340 
00341 /*                       Test SGEQLF */
00342 
00343                             sqlt01_(&m, &n, &a[1], &af[1], &aq[1], &al[1], &
00344                                     lda, &tau[1], &work[1], &lwork, &rwork[1], 
00345                                      result);
00346                             if (m >= n) {
00347 /*                          Check the lower-left n-by-n corner */
00348                                 if (! sgennd_(&n, &n, &af[m - n + 1], &lda)) {
00349                                     result[7] = *thresh * 2;
00350                                 }
00351                             } else {
00352 /*                          Check the (n-m)th superdiagonal */
00353                                 if (! sgennd_(&m, &m, &af[(n - m) * lda + 1], 
00354                                         &lda)) {
00355                                     result[7] = *thresh * 2;
00356                                 }
00357                             }
00358                             ++nt;
00359                         } else if (m >= n) {
00360 
00361 /*                       Test SORGQL, using factorization */
00362 /*                       returned by SQLT01 */
00363 
00364                             sqlt02_(&m, &n, &k, &a[1], &af[1], &aq[1], &al[1], 
00365                                      &lda, &tau[1], &work[1], &lwork, &rwork[
00366                                     1], result);
00367                         }
00368                         if (m >= k) {
00369 
00370 /*                       Test SORMQL, using factorization returned */
00371 /*                       by SQLT01 */
00372 
00373                             sqlt03_(&m, &n, &k, &af[1], &ac[1], &al[1], &aq[1]
00374 , &lda, &tau[1], &work[1], &lwork, &rwork[
00375                                     1], &result[2]);
00376                             nt += 4;
00377 
00378 /*                       If M>=N and K=N, call SGEQLS to solve a system */
00379 /*                       with NRHS right hand sides and compute the */
00380 /*                       residual. */
00381 
00382                             if (k == n && inb == 1) {
00383 
00384 /*                          Generate a solution and set the right */
00385 /*                          hand side. */
00386 
00387                                 s_copy(srnamc_1.srnamt, "SLARHS", (ftnlen)32, 
00388                                         (ftnlen)6);
00389                                 slarhs_(path, "New", "Full", "No transpose", &
00390                                         m, &n, &c__0, &c__0, nrhs, &a[1], &
00391                                         lda, &xact[1], &lda, &b[1], &lda, 
00392                                         iseed, &info);
00393 
00394                                 slacpy_("Full", &m, nrhs, &b[1], &lda, &x[1], 
00395                                         &lda);
00396                                 s_copy(srnamc_1.srnamt, "SGEQLS", (ftnlen)32, 
00397                                         (ftnlen)6);
00398                                 sgeqls_(&m, &n, nrhs, &af[1], &lda, &tau[1], &
00399                                         x[1], &lda, &work[1], &lwork, &info);
00400 
00401 /*                          Check error code from SGEQLS. */
00402 
00403                                 if (info != 0) {
00404                                     alaerh_(path, "SGEQLS", &info, &c__0, 
00405                                             " ", &m, &n, nrhs, &c_n1, &nb, &
00406                                             imat, &nfail, &nerrs, nout);
00407                                 }
00408 
00409                                 sget02_("No transpose", &m, &n, nrhs, &a[1], &
00410                                         lda, &x[m - n + 1], &lda, &b[1], &lda, 
00411                                          &rwork[1], &result[6]);
00412                                 ++nt;
00413                             }
00414                         }
00415 
00416 /*                    Print information about the tests that did not */
00417 /*                    pass the threshold. */
00418 
00419                         i__5 = nt;
00420                         for (i__ = 1; i__ <= i__5; ++i__) {
00421                             if (result[i__ - 1] >= *thresh) {
00422                                 if (nfail == 0 && nerrs == 0) {
00423                                     alahd_(nout, path);
00424                                 }
00425                                 io___33.ciunit = *nout;
00426                                 s_wsfe(&io___33);
00427                                 do_fio(&c__1, (char *)&m, (ftnlen)sizeof(
00428                                         integer));
00429                                 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(
00430                                         integer));
00431                                 do_fio(&c__1, (char *)&k, (ftnlen)sizeof(
00432                                         integer));
00433                                 do_fio(&c__1, (char *)&nb, (ftnlen)sizeof(
00434                                         integer));
00435                                 do_fio(&c__1, (char *)&nx, (ftnlen)sizeof(
00436                                         integer));
00437                                 do_fio(&c__1, (char *)&imat, (ftnlen)sizeof(
00438                                         integer));
00439                                 do_fio(&c__1, (char *)&i__, (ftnlen)sizeof(
00440                                         integer));
00441                                 do_fio(&c__1, (char *)&result[i__ - 1], (
00442                                         ftnlen)sizeof(real));
00443                                 e_wsfe();
00444                                 ++nfail;
00445                             }
00446 /* L20: */
00447                         }
00448                         nrun += nt;
00449 /* L30: */
00450                     }
00451 /* L40: */
00452                 }
00453 L50:
00454                 ;
00455             }
00456 /* L60: */
00457         }
00458 /* L70: */
00459     }
00460 
00461 /*     Print a summary of the results. */
00462 
00463     alasum_(path, nout, &nfail, &nrun, &nerrs);
00464 
00465     return 0;
00466 
00467 /*     End of SCHKQL */
00468 
00469 } /* schkql_ */


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