dchkq3.c
Go to the documentation of this file.
00001 /* dchkq3.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, iounit;
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 doublereal c_b11 = 0.;
00034 static doublereal c_b16 = 1.;
00035 static integer c__1 = 1;
00036 static integer c__3 = 3;
00037 
00038 /* Subroutine */ int dchkq3_(logical *dotype, integer *nm, integer *mval, 
00039         integer *nn, integer *nval, integer *nnb, integer *nbval, integer *
00040         nxval, doublereal *thresh, doublereal *a, doublereal *copya, 
00041         doublereal *s, doublereal *copys, doublereal *tau, doublereal *work, 
00042         integer *iwork, integer *nout)
00043 {
00044     /* Initialized data */
00045 
00046     static integer iseedy[4] = { 1988,1989,1990,1991 };
00047 
00048     /* Format strings */
00049     static char fmt_9999[] = "(1x,a,\002 M =\002,i5,\002, N =\002,i5,\002, N"
00050             "B =\002,i4,\002, type \002,i2,\002, test \002,i2,\002, ratio "
00051             "=\002,g12.5)";
00052 
00053     /* System generated locals */
00054     integer i__1, i__2, i__3, i__4, i__5;
00055     doublereal d__1;
00056 
00057     /* Builtin functions */
00058     /* Subroutine */ int s_copy(char *, char *, ftnlen, ftnlen);
00059     integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void);
00060 
00061     /* Local variables */
00062     integer i__, k, m, n, nb, im, in, lw, nx, lda, inb;
00063     doublereal eps;
00064     integer mode, info;
00065     char path[3];
00066     integer ilow, nrun;
00067     extern /* Subroutine */ int alahd_(integer *, char *);
00068     integer ihigh, nfail, iseed[4], imode;
00069     extern doublereal dqpt01_(integer *, integer *, integer *, doublereal *, 
00070             doublereal *, integer *, doublereal *, integer *, doublereal *, 
00071             integer *), dqrt11_(integer *, integer *, doublereal *, integer *, 
00072              doublereal *, doublereal *, integer *), dqrt12_(integer *, 
00073             integer *, doublereal *, integer *, doublereal *, doublereal *, 
00074             integer *);
00075     integer mnmin;
00076     extern /* Subroutine */ int icopy_(integer *, integer *, integer *, 
00077             integer *, integer *);
00078     integer istep, nerrs, lwork;
00079     extern /* Subroutine */ int dgeqp3_(integer *, integer *, doublereal *, 
00080             integer *, integer *, doublereal *, doublereal *, integer *, 
00081             integer *);
00082     extern doublereal dlamch_(char *);
00083     extern /* Subroutine */ int dlaord_(char *, integer *, doublereal *, 
00084             integer *), dlacpy_(char *, integer *, integer *, 
00085             doublereal *, integer *, doublereal *, integer *), 
00086             dlaset_(char *, integer *, integer *, doublereal *, doublereal *, 
00087             doublereal *, integer *), alasum_(char *, integer *, 
00088             integer *, integer *, integer *), dlatms_(integer *, 
00089             integer *, char *, integer *, char *, doublereal *, integer *, 
00090             doublereal *, doublereal *, integer *, integer *, char *, 
00091             doublereal *, integer *, doublereal *, integer *), xlaenv_(integer *, integer *);
00092     doublereal result[3];
00093 
00094     /* Fortran I/O blocks */
00095     static cilist io___28 = { 0, 0, 0, fmt_9999, 0 };
00096 
00097 
00098 
00099 /*  -- LAPACK test routine (version 3.1.1) -- */
00100 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00101 /*     January 2007 */
00102 
00103 /*     .. Scalar Arguments .. */
00104 /*     .. */
00105 /*     .. Array Arguments .. */
00106 /*     .. */
00107 
00108 /*  Purpose */
00109 /*  ======= */
00110 
00111 /*  DCHKQ3 tests DGEQP3. */
00112 
00113 /*  Arguments */
00114 /*  ========= */
00115 
00116 /*  DOTYPE  (input) LOGICAL array, dimension (NTYPES) */
00117 /*          The matrix types to be used for testing.  Matrices of type j */
00118 /*          (for 1 <= j <= NTYPES) are used for testing if DOTYPE(j) = */
00119 /*          .TRUE.; if DOTYPE(j) = .FALSE., then type j is not used. */
00120 
00121 /*  NM      (input) INTEGER */
00122 /*          The number of values of M contained in the vector MVAL. */
00123 
00124 /*  MVAL    (input) INTEGER array, dimension (NM) */
00125 /*          The values of the matrix row dimension M. */
00126 
00127 /*  NN      (input) INTEGER */
00128 /*          The number of values of N contained in the vector NVAL. */
00129 
00130 /*  NVAL    (input) INTEGER array, dimension (NN) */
00131 /*          The values of the matrix column dimension N. */
00132 
00133 /*  NNB     (input) INTEGER */
00134 /*          The number of values of NB and NX contained in the */
00135 /*          vectors NBVAL and NXVAL.  The blocking parameters are used */
00136 /*          in pairs (NB,NX). */
00137 
00138 /*  NBVAL   (input) INTEGER array, dimension (NNB) */
00139 /*          The values of the blocksize NB. */
00140 
00141 /*  NXVAL   (input) INTEGER array, dimension (NNB) */
00142 /*          The values of the crossover point NX. */
00143 
00144 /*  THRESH  (input) DOUBLE PRECISION */
00145 /*          The threshold value for the test ratios.  A result is */
00146 /*          included in the output file if RESULT >= THRESH.  To have */
00147 /*          every test ratio printed, use THRESH = 0. */
00148 
00149 /*  A       (workspace) DOUBLE PRECISION array, dimension (MMAX*NMAX) */
00150 /*          where MMAX is the maximum value of M in MVAL and NMAX is the */
00151 /*          maximum value of N in NVAL. */
00152 
00153 /*  COPYA   (workspace) DOUBLE PRECISION array, dimension (MMAX*NMAX) */
00154 
00155 /*  S       (workspace) DOUBLE PRECISION array, dimension */
00156 /*                      (min(MMAX,NMAX)) */
00157 
00158 /*  COPYS   (workspace) DOUBLE PRECISION array, dimension */
00159 /*                      (min(MMAX,NMAX)) */
00160 
00161 /*  TAU     (workspace) DOUBLE PRECISION array, dimension (MMAX) */
00162 
00163 /*  WORK    (workspace) DOUBLE PRECISION array, dimension */
00164 /*                      (MMAX*NMAX + 4*NMAX + MMAX) */
00165 
00166 /*  IWORK   (workspace) INTEGER array, dimension (2*NMAX) */
00167 
00168 /*  NOUT    (input) INTEGER */
00169 /*          The unit number for output. */
00170 
00171 /*  ===================================================================== */
00172 
00173 /*     .. Parameters .. */
00174 /*     .. */
00175 /*     .. Local Scalars .. */
00176 /*     .. */
00177 /*     .. Local Arrays .. */
00178 /*     .. */
00179 /*     .. External Functions .. */
00180 /*     .. */
00181 /*     .. External Subroutines .. */
00182 /*     .. */
00183 /*     .. Intrinsic Functions .. */
00184 /*     .. */
00185 /*     .. Scalars in Common .. */
00186 /*     .. */
00187 /*     .. Common blocks .. */
00188 /*     .. */
00189 /*     .. Data statements .. */
00190     /* Parameter adjustments */
00191     --iwork;
00192     --work;
00193     --tau;
00194     --copys;
00195     --s;
00196     --copya;
00197     --a;
00198     --nxval;
00199     --nbval;
00200     --nval;
00201     --mval;
00202     --dotype;
00203 
00204     /* Function Body */
00205 /*     .. */
00206 /*     .. Executable Statements .. */
00207 
00208 /*     Initialize constants and the random number seed. */
00209 
00210     s_copy(path, "Double precision", (ftnlen)1, (ftnlen)16);
00211     s_copy(path + 1, "Q3", (ftnlen)2, (ftnlen)2);
00212     nrun = 0;
00213     nfail = 0;
00214     nerrs = 0;
00215     for (i__ = 1; i__ <= 4; ++i__) {
00216         iseed[i__ - 1] = iseedy[i__ - 1];
00217 /* L10: */
00218     }
00219     eps = dlamch_("Epsilon");
00220     infoc_1.infot = 0;
00221 
00222     i__1 = *nm;
00223     for (im = 1; im <= i__1; ++im) {
00224 
00225 /*        Do for each value of M in MVAL. */
00226 
00227         m = mval[im];
00228         lda = max(1,m);
00229 
00230         i__2 = *nn;
00231         for (in = 1; in <= i__2; ++in) {
00232 
00233 /*           Do for each value of N in NVAL. */
00234 
00235             n = nval[in];
00236             mnmin = min(m,n);
00237 /* Computing MAX */
00238             i__3 = 1, i__4 = m * max(m,n) + (mnmin << 2) + max(m,n), i__3 = 
00239                     max(i__3,i__4), i__4 = m * n + (mnmin << 1) + (n << 2);
00240             lwork = max(i__3,i__4);
00241 
00242             for (imode = 1; imode <= 6; ++imode) {
00243                 if (! dotype[imode]) {
00244                     goto L70;
00245                 }
00246 
00247 /*              Do for each type of matrix */
00248 /*                 1:  zero matrix */
00249 /*                 2:  one small singular value */
00250 /*                 3:  geometric distribution of singular values */
00251 /*                 4:  first n/2 columns fixed */
00252 /*                 5:  last n/2 columns fixed */
00253 /*                 6:  every second column fixed */
00254 
00255                 mode = imode;
00256                 if (imode > 3) {
00257                     mode = 1;
00258                 }
00259 
00260 /*              Generate test matrix of size m by n using */
00261 /*              singular value distribution indicated by `mode'. */
00262 
00263                 i__3 = n;
00264                 for (i__ = 1; i__ <= i__3; ++i__) {
00265                     iwork[i__] = 0;
00266 /* L20: */
00267                 }
00268                 if (imode == 1) {
00269                     dlaset_("Full", &m, &n, &c_b11, &c_b11, &copya[1], &lda);
00270                     i__3 = mnmin;
00271                     for (i__ = 1; i__ <= i__3; ++i__) {
00272                         copys[i__] = 0.;
00273 /* L30: */
00274                     }
00275                 } else {
00276                     d__1 = 1. / eps;
00277                     dlatms_(&m, &n, "Uniform", iseed, "Nonsymm", &copys[1], &
00278                             mode, &d__1, &c_b16, &m, &n, "No packing", &copya[
00279                             1], &lda, &work[1], &info);
00280                     if (imode >= 4) {
00281                         if (imode == 4) {
00282                             ilow = 1;
00283                             istep = 1;
00284 /* Computing MAX */
00285                             i__3 = 1, i__4 = n / 2;
00286                             ihigh = max(i__3,i__4);
00287                         } else if (imode == 5) {
00288 /* Computing MAX */
00289                             i__3 = 1, i__4 = n / 2;
00290                             ilow = max(i__3,i__4);
00291                             istep = 1;
00292                             ihigh = n;
00293                         } else if (imode == 6) {
00294                             ilow = 1;
00295                             istep = 2;
00296                             ihigh = n;
00297                         }
00298                         i__3 = ihigh;
00299                         i__4 = istep;
00300                         for (i__ = ilow; i__4 < 0 ? i__ >= i__3 : i__ <= i__3;
00301                                  i__ += i__4) {
00302                             iwork[i__] = 1;
00303 /* L40: */
00304                         }
00305                     }
00306                     dlaord_("Decreasing", &mnmin, &copys[1], &c__1);
00307                 }
00308 
00309                 i__4 = *nnb;
00310                 for (inb = 1; inb <= i__4; ++inb) {
00311 
00312 /*                 Do for each pair of values (NB,NX) in NBVAL and NXVAL. */
00313 
00314                     nb = nbval[inb];
00315                     xlaenv_(&c__1, &nb);
00316                     nx = nxval[inb];
00317                     xlaenv_(&c__3, &nx);
00318 
00319 /*                 Get a working copy of COPYA into A and a copy of */
00320 /*                 vector IWORK. */
00321 
00322                     dlacpy_("All", &m, &n, &copya[1], &lda, &a[1], &lda);
00323                     icopy_(&n, &iwork[1], &c__1, &iwork[n + 1], &c__1);
00324 
00325 /*                 Compute the QR factorization with pivoting of A */
00326 
00327 /* Computing MAX */
00328                     i__3 = 1, i__5 = (n << 1) + nb * (n + 1);
00329                     lw = max(i__3,i__5);
00330 
00331 /*                 Compute the QP3 factorization of A */
00332 
00333                     s_copy(srnamc_1.srnamt, "DGEQP3", (ftnlen)32, (ftnlen)6);
00334                     dgeqp3_(&m, &n, &a[1], &lda, &iwork[n + 1], &tau[1], &
00335                             work[1], &lw, &info);
00336 
00337 /*                 Compute norm(svd(a) - svd(r)) */
00338 
00339                     result[0] = dqrt12_(&m, &n, &a[1], &lda, &copys[1], &work[
00340                             1], &lwork);
00341 
00342 /*                 Compute norm( A*P - Q*R ) */
00343 
00344                     result[1] = dqpt01_(&m, &n, &mnmin, &copya[1], &a[1], &
00345                             lda, &tau[1], &iwork[n + 1], &work[1], &lwork);
00346 
00347 /*                 Compute Q'*Q */
00348 
00349                     result[2] = dqrt11_(&m, &mnmin, &a[1], &lda, &tau[1], &
00350                             work[1], &lwork);
00351 
00352 /*                 Print information about the tests that did not pass */
00353 /*                 the threshold. */
00354 
00355                     for (k = 1; k <= 3; ++k) {
00356                         if (result[k - 1] >= *thresh) {
00357                             if (nfail == 0 && nerrs == 0) {
00358                                 alahd_(nout, path);
00359                             }
00360                             io___28.ciunit = *nout;
00361                             s_wsfe(&io___28);
00362                             do_fio(&c__1, "DGEQP3", (ftnlen)6);
00363                             do_fio(&c__1, (char *)&m, (ftnlen)sizeof(integer))
00364                                     ;
00365                             do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer))
00366                                     ;
00367                             do_fio(&c__1, (char *)&nb, (ftnlen)sizeof(integer)
00368                                     );
00369                             do_fio(&c__1, (char *)&imode, (ftnlen)sizeof(
00370                                     integer));
00371                             do_fio(&c__1, (char *)&k, (ftnlen)sizeof(integer))
00372                                     ;
00373                             do_fio(&c__1, (char *)&result[k - 1], (ftnlen)
00374                                     sizeof(doublereal));
00375                             e_wsfe();
00376                             ++nfail;
00377                         }
00378 /* L50: */
00379                     }
00380                     nrun += 3;
00381 
00382 /* L60: */
00383                 }
00384 L70:
00385                 ;
00386             }
00387 /* L80: */
00388         }
00389 /* L90: */
00390     }
00391 
00392 /*     Print a summary of the results. */
00393 
00394     alasum_(path, nout, &nfail, &nrun, &nerrs);
00395 
00396 
00397 /*     End of DCHKQ3 */
00398 
00399     return 0;
00400 } /* dchkq3_ */


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