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


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