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


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