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


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