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


swiftnav
Author(s):
autogenerated on Sat Jun 8 2019 18:56:19