dchktz.c
Go to the documentation of this file.
00001 /* dchktz.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_b10 = 0.;
00034 static doublereal c_b15 = 1.;
00035 static integer c__1 = 1;
00036 
00037 /* Subroutine */ int dchktz_(logical *dotype, integer *nm, integer *mval, 
00038         integer *nn, integer *nval, doublereal *thresh, logical *tsterr, 
00039         doublereal *a, doublereal *copya, doublereal *s, doublereal *copys, 
00040         doublereal *tau, doublereal *work, integer *nout)
00041 {
00042     /* Initialized data */
00043 
00044     static integer iseedy[4] = { 1988,1989,1990,1991 };
00045 
00046     /* Format strings */
00047     static char fmt_9999[] = "(\002 M =\002,i5,\002, N =\002,i5,\002, type"
00048             " \002,i2,\002, test \002,i2,\002, ratio =\002,g12.5)";
00049 
00050     /* System generated locals */
00051     integer i__1, i__2, i__3, i__4;
00052     doublereal d__1;
00053 
00054     /* Builtin functions */
00055     /* Subroutine */ int s_copy(char *, char *, ftnlen, ftnlen);
00056     integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void);
00057 
00058     /* Local variables */
00059     integer i__, k, m, n, im, in, lda;
00060     doublereal eps;
00061     integer mode, info;
00062     char path[3];
00063     integer nrun;
00064     extern /* Subroutine */ int alahd_(integer *, char *);
00065     integer nfail, iseed[4], imode;
00066     extern doublereal dqrt12_(integer *, integer *, doublereal *, integer *, 
00067             doublereal *, doublereal *, integer *);
00068     integer mnmin;
00069     extern doublereal drzt01_(integer *, integer *, doublereal *, doublereal *
00070 , integer *, doublereal *, doublereal *, integer *), drzt02_(
00071             integer *, integer *, doublereal *, integer *, doublereal *, 
00072             doublereal *, integer *), dtzt01_(integer *, integer *, 
00073             doublereal *, doublereal *, integer *, doublereal *, doublereal *, 
00074              integer *), dtzt02_(integer *, integer *, doublereal *, integer *
00075 , doublereal *, doublereal *, integer *);
00076     integer nerrs, lwork;
00077     extern /* Subroutine */ int dgeqr2_(integer *, integer *, doublereal *, 
00078             integer *, doublereal *, doublereal *, integer *);
00079     extern doublereal dlamch_(char *);
00080     extern /* Subroutine */ int dlaord_(char *, integer *, doublereal *, 
00081             integer *), dlacpy_(char *, integer *, integer *, 
00082             doublereal *, integer *, doublereal *, integer *), 
00083             dlaset_(char *, integer *, integer *, doublereal *, doublereal *, 
00084             doublereal *, integer *), alasum_(char *, integer *, 
00085             integer *, integer *, integer *), dlatms_(integer *, 
00086             integer *, char *, integer *, char *, doublereal *, integer *, 
00087             doublereal *, doublereal *, integer *, integer *, char *, 
00088             doublereal *, integer *, doublereal *, integer *), derrtz_(char *, integer *), dtzrqf_(integer *, 
00089             integer *, doublereal *, integer *, doublereal *, integer *);
00090     doublereal result[6];
00091     extern /* Subroutine */ int dtzrzf_(integer *, integer *, doublereal *, 
00092             integer *, doublereal *, doublereal *, integer *, integer *);
00093 
00094     /* Fortran I/O blocks */
00095     static cilist io___21 = { 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 /*  DCHKTZ tests DTZRQF and STZRZF. */
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 /*  THRESH  (input) DOUBLE PRECISION */
00134 /*          The threshold value for the test ratios.  A result is */
00135 /*          included in the output file if RESULT >= THRESH.  To have */
00136 /*          every test ratio printed, use THRESH = 0. */
00137 
00138 /*  TSTERR  (input) LOGICAL */
00139 /*          Flag that indicates whether error exits are to be tested. */
00140 
00141 /*  A       (workspace) DOUBLE PRECISION array, dimension (MMAX*NMAX) */
00142 /*          where MMAX is the maximum value of M in MVAL and NMAX is the */
00143 /*          maximum value of N in NVAL. */
00144 
00145 /*  COPYA   (workspace) DOUBLE PRECISION array, dimension (MMAX*NMAX) */
00146 
00147 /*  S       (workspace) DOUBLE PRECISION array, dimension */
00148 /*                      (min(MMAX,NMAX)) */
00149 
00150 /*  COPYS   (workspace) DOUBLE PRECISION array, dimension */
00151 /*                      (min(MMAX,NMAX)) */
00152 
00153 /*  TAU     (workspace) DOUBLE PRECISION array, dimension (MMAX) */
00154 
00155 /*  WORK    (workspace) DOUBLE PRECISION array, dimension */
00156 /*                      (MMAX*NMAX + 4*NMAX + MMAX) */
00157 
00158 /*  NOUT    (input) INTEGER */
00159 /*          The unit number for output. */
00160 
00161 /*  ===================================================================== */
00162 
00163 /*     .. Parameters .. */
00164 /*     .. */
00165 /*     .. Local Scalars .. */
00166 /*     .. */
00167 /*     .. Local Arrays .. */
00168 /*     .. */
00169 /*     .. External Functions .. */
00170 /*     .. */
00171 /*     .. External Subroutines .. */
00172 /*     .. */
00173 /*     .. Intrinsic Functions .. */
00174 /*     .. */
00175 /*     .. Scalars in Common .. */
00176 /*     .. */
00177 /*     .. Common blocks .. */
00178 /*     .. */
00179 /*     .. Data statements .. */
00180     /* Parameter adjustments */
00181     --work;
00182     --tau;
00183     --copys;
00184     --s;
00185     --copya;
00186     --a;
00187     --nval;
00188     --mval;
00189     --dotype;
00190 
00191     /* Function Body */
00192 /*     .. */
00193 /*     .. Executable Statements .. */
00194 
00195 /*     Initialize constants and the random number seed. */
00196 
00197     s_copy(path, "Double precision", (ftnlen)1, (ftnlen)16);
00198     s_copy(path + 1, "TZ", (ftnlen)2, (ftnlen)2);
00199     nrun = 0;
00200     nfail = 0;
00201     nerrs = 0;
00202     for (i__ = 1; i__ <= 4; ++i__) {
00203         iseed[i__ - 1] = iseedy[i__ - 1];
00204 /* L10: */
00205     }
00206     eps = dlamch_("Epsilon");
00207 
00208 /*     Test the error exits */
00209 
00210     if (*tsterr) {
00211         derrtz_(path, nout);
00212     }
00213     infoc_1.infot = 0;
00214 
00215     i__1 = *nm;
00216     for (im = 1; im <= i__1; ++im) {
00217 
00218 /*        Do for each value of M in MVAL. */
00219 
00220         m = mval[im];
00221         lda = max(1,m);
00222 
00223         i__2 = *nn;
00224         for (in = 1; in <= i__2; ++in) {
00225 
00226 /*           Do for each value of N in NVAL for which M .LE. N. */
00227 
00228             n = nval[in];
00229             mnmin = min(m,n);
00230 /* Computing MAX */
00231             i__3 = 1, i__4 = n * n + (m << 2) + n, i__3 = max(i__3,i__4), 
00232                     i__4 = m * n + (mnmin << 1) + (n << 2);
00233             lwork = max(i__3,i__4);
00234 
00235             if (m <= n) {
00236                 for (imode = 1; imode <= 3; ++imode) {
00237                     if (! dotype[imode]) {
00238                         goto L50;
00239                     }
00240 
00241 /*                 Do for each type of singular value distribution. */
00242 /*                    0:  zero matrix */
00243 /*                    1:  one small singular value */
00244 /*                    2:  exponential distribution */
00245 
00246                     mode = imode - 1;
00247 
00248 /*                 Test DTZRQF */
00249 
00250 /*                 Generate test matrix of size m by n using */
00251 /*                 singular value distribution indicated by `mode'. */
00252 
00253                     if (mode == 0) {
00254                         dlaset_("Full", &m, &n, &c_b10, &c_b10, &a[1], &lda);
00255                         i__3 = mnmin;
00256                         for (i__ = 1; i__ <= i__3; ++i__) {
00257                             copys[i__] = 0.;
00258 /* L20: */
00259                         }
00260                     } else {
00261                         d__1 = 1. / eps;
00262                         dlatms_(&m, &n, "Uniform", iseed, "Nonsymmetric", &
00263                                 copys[1], &imode, &d__1, &c_b15, &m, &n, 
00264                                 "No packing", &a[1], &lda, &work[1], &info);
00265                         dgeqr2_(&m, &n, &a[1], &lda, &work[1], &work[mnmin + 
00266                                 1], &info);
00267                         i__3 = m - 1;
00268                         dlaset_("Lower", &i__3, &n, &c_b10, &c_b10, &a[2], &
00269                                 lda);
00270                         dlaord_("Decreasing", &mnmin, &copys[1], &c__1);
00271                     }
00272 
00273 /*                 Save A and its singular values */
00274 
00275                     dlacpy_("All", &m, &n, &a[1], &lda, &copya[1], &lda);
00276 
00277 /*                 Call DTZRQF to reduce the upper trapezoidal matrix to */
00278 /*                 upper triangular form. */
00279 
00280                     s_copy(srnamc_1.srnamt, "DTZRQF", (ftnlen)32, (ftnlen)6);
00281                     dtzrqf_(&m, &n, &a[1], &lda, &tau[1], &info);
00282 
00283 /*                 Compute norm(svd(a) - svd(r)) */
00284 
00285                     result[0] = dqrt12_(&m, &m, &a[1], &lda, &copys[1], &work[
00286                             1], &lwork);
00287 
00288 /*                 Compute norm( A - R*Q ) */
00289 
00290                     result[1] = dtzt01_(&m, &n, &copya[1], &a[1], &lda, &tau[
00291                             1], &work[1], &lwork);
00292 
00293 /*                 Compute norm(Q'*Q - I). */
00294 
00295                     result[2] = dtzt02_(&m, &n, &a[1], &lda, &tau[1], &work[1]
00296 , &lwork);
00297 
00298 /*                 Test DTZRZF */
00299 
00300 /*                 Generate test matrix of size m by n using */
00301 /*                 singular value distribution indicated by `mode'. */
00302 
00303                     if (mode == 0) {
00304                         dlaset_("Full", &m, &n, &c_b10, &c_b10, &a[1], &lda);
00305                         i__3 = mnmin;
00306                         for (i__ = 1; i__ <= i__3; ++i__) {
00307                             copys[i__] = 0.;
00308 /* L30: */
00309                         }
00310                     } else {
00311                         d__1 = 1. / eps;
00312                         dlatms_(&m, &n, "Uniform", iseed, "Nonsymmetric", &
00313                                 copys[1], &imode, &d__1, &c_b15, &m, &n, 
00314                                 "No packing", &a[1], &lda, &work[1], &info);
00315                         dgeqr2_(&m, &n, &a[1], &lda, &work[1], &work[mnmin + 
00316                                 1], &info);
00317                         i__3 = m - 1;
00318                         dlaset_("Lower", &i__3, &n, &c_b10, &c_b10, &a[2], &
00319                                 lda);
00320                         dlaord_("Decreasing", &mnmin, &copys[1], &c__1);
00321                     }
00322 
00323 /*                 Save A and its singular values */
00324 
00325                     dlacpy_("All", &m, &n, &a[1], &lda, &copya[1], &lda);
00326 
00327 /*                 Call DTZRZF to reduce the upper trapezoidal matrix to */
00328 /*                 upper triangular form. */
00329 
00330                     s_copy(srnamc_1.srnamt, "DTZRZF", (ftnlen)32, (ftnlen)6);
00331                     dtzrzf_(&m, &n, &a[1], &lda, &tau[1], &work[1], &lwork, &
00332                             info);
00333 
00334 /*                 Compute norm(svd(a) - svd(r)) */
00335 
00336                     result[3] = dqrt12_(&m, &m, &a[1], &lda, &copys[1], &work[
00337                             1], &lwork);
00338 
00339 /*                 Compute norm( A - R*Q ) */
00340 
00341                     result[4] = drzt01_(&m, &n, &copya[1], &a[1], &lda, &tau[
00342                             1], &work[1], &lwork);
00343 
00344 /*                 Compute norm(Q'*Q - I). */
00345 
00346                     result[5] = drzt02_(&m, &n, &a[1], &lda, &tau[1], &work[1]
00347 , &lwork);
00348 
00349 /*                 Print information about the tests that did not pass */
00350 /*                 the threshold. */
00351 
00352                     for (k = 1; k <= 6; ++k) {
00353                         if (result[k - 1] >= *thresh) {
00354                             if (nfail == 0 && nerrs == 0) {
00355                                 alahd_(nout, path);
00356                             }
00357                             io___21.ciunit = *nout;
00358                             s_wsfe(&io___21);
00359                             do_fio(&c__1, (char *)&m, (ftnlen)sizeof(integer))
00360                                     ;
00361                             do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer))
00362                                     ;
00363                             do_fio(&c__1, (char *)&imode, (ftnlen)sizeof(
00364                                     integer));
00365                             do_fio(&c__1, (char *)&k, (ftnlen)sizeof(integer))
00366                                     ;
00367                             do_fio(&c__1, (char *)&result[k - 1], (ftnlen)
00368                                     sizeof(doublereal));
00369                             e_wsfe();
00370                             ++nfail;
00371                         }
00372 /* L40: */
00373                     }
00374                     nrun += 6;
00375 L50:
00376                     ;
00377                 }
00378             }
00379 /* L60: */
00380         }
00381 /* L70: */
00382     }
00383 
00384 /*     Print a summary of the results. */
00385 
00386     alasum_(path, nout, &nfail, &nrun, &nerrs);
00387 
00388 
00389 /*     End if DCHKTZ */
00390 
00391     return 0;
00392 } /* dchktz_ */


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