cchktz.c
Go to the documentation of this file.
00001 /* cchktz.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 complex c_b10 = {0.f,0.f};
00034 static real c_b15 = 1.f;
00035 static integer c__1 = 1;
00036 
00037 /* Subroutine */ int cchktz_(logical *dotype, integer *nm, integer *mval, 
00038         integer *nn, integer *nval, real *thresh, logical *tsterr, complex *a, 
00039          complex *copya, real *s, real *copys, complex *tau, complex *work, 
00040         real *rwork, 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     real r__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     real 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 cqrt12_(integer *, integer *, complex *, integer *, 
00067             real *, complex *, integer *, real *);
00068     integer mnmin;
00069     extern doublereal crzt01_(integer *, integer *, complex *, complex *, 
00070             integer *, complex *, complex *, integer *), crzt02_(integer *, 
00071             integer *, complex *, integer *, complex *, complex *, integer *),
00072              ctzt01_(integer *, integer *, complex *, complex *, integer *, 
00073             complex *, complex *, integer *), ctzt02_(integer *, integer *, 
00074             complex *, integer *, complex *, complex *, integer *);
00075     integer nerrs, lwork;
00076     extern /* Subroutine */ int cgeqr2_(integer *, integer *, complex *, 
00077             integer *, complex *, complex *, integer *);
00078     extern doublereal slamch_(char *);
00079     extern /* Subroutine */ int clacpy_(char *, integer *, integer *, complex 
00080             *, integer *, complex *, integer *), claset_(char *, 
00081             integer *, integer *, complex *, complex *, complex *, integer *), alasum_(char *, integer *, integer *, integer *, integer 
00082             *), clatms_(integer *, integer *, char *, integer *, char 
00083             *, real *, integer *, real *, real *, integer *, integer *, char *
00084 , complex *, integer *, complex *, integer *), slaord_(char *, integer *, real *, integer *), 
00085             cerrtz_(char *, integer *), ctzrqf_(integer *, integer *, 
00086             complex *, integer *, complex *, integer *);
00087     real result[6];
00088     extern /* Subroutine */ int ctzrzf_(integer *, integer *, complex *, 
00089             integer *, complex *, complex *, integer *, integer *);
00090 
00091     /* Fortran I/O blocks */
00092     static cilist io___21 = { 0, 0, 0, fmt_9999, 0 };
00093 
00094 
00095 
00096 /*  -- LAPACK test routine (version 3.1) -- */
00097 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00098 /*     November 2006 */
00099 
00100 /*     .. Scalar Arguments .. */
00101 /*     .. */
00102 /*     .. Array Arguments .. */
00103 /*     .. */
00104 
00105 /*  Purpose */
00106 /*  ======= */
00107 
00108 /*  CCHKTZ tests CTZRQF and CTZRZF. */
00109 
00110 /*  Arguments */
00111 /*  ========= */
00112 
00113 /*  DOTYPE  (input) LOGICAL array, dimension (NTYPES) */
00114 /*          The matrix types to be used for testing.  Matrices of type j */
00115 /*          (for 1 <= j <= NTYPES) are used for testing if DOTYPE(j) = */
00116 /*          .TRUE.; if DOTYPE(j) = .FALSE., then type j is not used. */
00117 
00118 /*  NM      (input) INTEGER */
00119 /*          The number of values of M contained in the vector MVAL. */
00120 
00121 /*  MVAL    (input) INTEGER array, dimension (NM) */
00122 /*          The values of the matrix row dimension M. */
00123 
00124 /*  NN      (input) INTEGER */
00125 /*          The number of values of N contained in the vector NVAL. */
00126 
00127 /*  NVAL    (input) INTEGER array, dimension (NN) */
00128 /*          The values of the matrix column dimension N. */
00129 
00130 /*  THRESH  (input) REAL */
00131 /*          The threshold value for the test ratios.  A result is */
00132 /*          included in the output file if RESULT >= THRESH.  To have */
00133 /*          every test ratio printed, use THRESH = 0. */
00134 
00135 /*  TSTERR  (input) LOGICAL */
00136 /*          Flag that indicates whether error exits are to be tested. */
00137 
00138 /*  A       (workspace) COMPLEX array, dimension (MMAX*NMAX) */
00139 /*          where MMAX is the maximum value of M in MVAL and NMAX is the */
00140 /*          maximum value of N in NVAL. */
00141 
00142 /*  COPYA   (workspace) COMPLEX array, dimension (MMAX*NMAX) */
00143 
00144 /*  S       (workspace) REAL array, dimension */
00145 /*                      (min(MMAX,NMAX)) */
00146 
00147 /*  COPYS   (workspace) REAL array, dimension */
00148 /*                      (min(MMAX,NMAX)) */
00149 
00150 /*  TAU     (workspace) COMPLEX array, dimension (MMAX) */
00151 
00152 /*  WORK    (workspace) COMPLEX array, dimension */
00153 /*                      (MMAX*NMAX + 4*NMAX + MMAX) */
00154 
00155 /*  RWORK   (workspace) REAL array, dimension (2*NMAX) */
00156 
00157 /*  NOUT    (input) INTEGER */
00158 /*          The unit number for output. */
00159 
00160 /*  ===================================================================== */
00161 
00162 /*     .. Parameters .. */
00163 /*     .. */
00164 /*     .. Local Scalars .. */
00165 /*     .. */
00166 /*     .. Local Arrays .. */
00167 /*     .. */
00168 /*     .. External Functions .. */
00169 /*     .. */
00170 /*     .. External Subroutines .. */
00171 /*     .. */
00172 /*     .. Intrinsic Functions .. */
00173 /*     .. */
00174 /*     .. Scalars in Common .. */
00175 /*     .. */
00176 /*     .. Common blocks .. */
00177 /*     .. */
00178 /*     .. Data statements .. */
00179     /* Parameter adjustments */
00180     --rwork;
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, "Complex precision", (ftnlen)1, (ftnlen)17);
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 = slamch_("Epsilon");
00207 
00208 /*     Test the error exits */
00209 
00210     if (*tsterr) {
00211         cerrtz_(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;
00232             lwork = max(i__3,i__4);
00233 
00234             if (m <= n) {
00235                 for (imode = 1; imode <= 3; ++imode) {
00236 
00237 /*                 Do for each type of singular value distribution. */
00238 /*                    0:  zero matrix */
00239 /*                    1:  one small singular value */
00240 /*                    2:  exponential distribution */
00241 
00242                     mode = imode - 1;
00243 
00244 /*                 Test CTZRQF */
00245 
00246 /*                 Generate test matrix of size m by n using */
00247 /*                 singular value distribution indicated by `mode'. */
00248 
00249                     if (mode == 0) {
00250                         claset_("Full", &m, &n, &c_b10, &c_b10, &a[1], &lda);
00251                         i__3 = mnmin;
00252                         for (i__ = 1; i__ <= i__3; ++i__) {
00253                             copys[i__] = 0.f;
00254 /* L20: */
00255                         }
00256                     } else {
00257                         r__1 = 1.f / eps;
00258                         clatms_(&m, &n, "Uniform", iseed, "Nonsymmetric", &
00259                                 copys[1], &imode, &r__1, &c_b15, &m, &n, 
00260                                 "No packing", &a[1], &lda, &work[1], &info);
00261                         cgeqr2_(&m, &n, &a[1], &lda, &work[1], &work[mnmin + 
00262                                 1], &info);
00263                         i__3 = m - 1;
00264                         claset_("Lower", &i__3, &n, &c_b10, &c_b10, &a[2], &
00265                                 lda);
00266                         slaord_("Decreasing", &mnmin, &copys[1], &c__1);
00267                     }
00268 
00269 /*                 Save A and its singular values */
00270 
00271                     clacpy_("All", &m, &n, &a[1], &lda, &copya[1], &lda);
00272 
00273 /*                 Call CTZRQF to reduce the upper trapezoidal matrix to */
00274 /*                 upper triangular form. */
00275 
00276                     s_copy(srnamc_1.srnamt, "CTZRQF", (ftnlen)32, (ftnlen)6);
00277                     ctzrqf_(&m, &n, &a[1], &lda, &tau[1], &info);
00278 
00279 /*                 Compute norm(svd(a) - svd(r)) */
00280 
00281                     result[0] = cqrt12_(&m, &m, &a[1], &lda, &copys[1], &work[
00282                             1], &lwork, &rwork[1]);
00283 
00284 /*                 Compute norm( A - R*Q ) */
00285 
00286                     result[1] = ctzt01_(&m, &n, &copya[1], &a[1], &lda, &tau[
00287                             1], &work[1], &lwork);
00288 
00289 /*                 Compute norm(Q'*Q - I). */
00290 
00291                     result[2] = ctzt02_(&m, &n, &a[1], &lda, &tau[1], &work[1]
00292 , &lwork);
00293 
00294 /*                 Test CTZRZF */
00295 
00296 /*                 Generate test matrix of size m by n using */
00297 /*                 singular value distribution indicated by `mode'. */
00298 
00299                     if (mode == 0) {
00300                         claset_("Full", &m, &n, &c_b10, &c_b10, &a[1], &lda);
00301                         i__3 = mnmin;
00302                         for (i__ = 1; i__ <= i__3; ++i__) {
00303                             copys[i__] = 0.f;
00304 /* L30: */
00305                         }
00306                     } else {
00307                         r__1 = 1.f / eps;
00308                         clatms_(&m, &n, "Uniform", iseed, "Nonsymmetric", &
00309                                 copys[1], &imode, &r__1, &c_b15, &m, &n, 
00310                                 "No packing", &a[1], &lda, &work[1], &info);
00311                         cgeqr2_(&m, &n, &a[1], &lda, &work[1], &work[mnmin + 
00312                                 1], &info);
00313                         i__3 = m - 1;
00314                         claset_("Lower", &i__3, &n, &c_b10, &c_b10, &a[2], &
00315                                 lda);
00316                         slaord_("Decreasing", &mnmin, &copys[1], &c__1);
00317                     }
00318 
00319 /*                 Save A and its singular values */
00320 
00321                     clacpy_("All", &m, &n, &a[1], &lda, &copya[1], &lda);
00322 
00323 /*                 Call CTZRZF to reduce the upper trapezoidal matrix to */
00324 /*                 upper triangular form. */
00325 
00326                     s_copy(srnamc_1.srnamt, "CTZRZF", (ftnlen)32, (ftnlen)6);
00327                     ctzrzf_(&m, &n, &a[1], &lda, &tau[1], &work[1], &lwork, &
00328                             info);
00329 
00330 /*                 Compute norm(svd(a) - svd(r)) */
00331 
00332                     result[3] = cqrt12_(&m, &m, &a[1], &lda, &copys[1], &work[
00333                             1], &lwork, &rwork[1]);
00334 
00335 /*                 Compute norm( A - R*Q ) */
00336 
00337                     result[4] = crzt01_(&m, &n, &copya[1], &a[1], &lda, &tau[
00338                             1], &work[1], &lwork);
00339 
00340 /*                 Compute norm(Q'*Q - I). */
00341 
00342                     result[5] = crzt02_(&m, &n, &a[1], &lda, &tau[1], &work[1]
00343 , &lwork);
00344 
00345 /*                 Print information about the tests that did not pass */
00346 /*                 the threshold. */
00347 
00348                     for (k = 1; k <= 6; ++k) {
00349                         if (result[k - 1] >= *thresh) {
00350                             if (nfail == 0 && nerrs == 0) {
00351                                 alahd_(nout, path);
00352                             }
00353                             io___21.ciunit = *nout;
00354                             s_wsfe(&io___21);
00355                             do_fio(&c__1, (char *)&m, (ftnlen)sizeof(integer))
00356                                     ;
00357                             do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer))
00358                                     ;
00359                             do_fio(&c__1, (char *)&imode, (ftnlen)sizeof(
00360                                     integer));
00361                             do_fio(&c__1, (char *)&k, (ftnlen)sizeof(integer))
00362                                     ;
00363                             do_fio(&c__1, (char *)&result[k - 1], (ftnlen)
00364                                     sizeof(real));
00365                             e_wsfe();
00366                             ++nfail;
00367                         }
00368 /* L40: */
00369                     }
00370                     nrun += 6;
00371 /* L50: */
00372                 }
00373             }
00374 /* L60: */
00375         }
00376 /* L70: */
00377     }
00378 
00379 /*     Print a summary of the results. */
00380 
00381     alasum_(path, nout, &nfail, &nrun, &nerrs);
00382 
00383 
00384 /*     End if CCHKTZ */
00385 
00386     return 0;
00387 } /* cchktz_ */


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