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


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