zchkps.c
Go to the documentation of this file.
00001 /* zchkps.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__0 = 0;
00034 static integer c_n1 = -1;
00035 static integer c__1 = 1;
00036 
00037 /* Subroutine */ int zchkps_(logical *dotype, integer *nn, integer *nval, 
00038         integer *nnb, integer *nbval, integer *nrank, integer *rankval, 
00039         doublereal *thresh, logical *tsterr, integer *nmax, doublecomplex *a, 
00040         doublecomplex *afac, doublecomplex *perm, integer *piv, doublecomplex 
00041         *work, doublereal *rwork, integer *nout)
00042 {
00043     /* Initialized data */
00044 
00045     static integer iseedy[4] = { 1988,1989,1990,1991 };
00046     static char uplos[1*2] = "U" "L";
00047 
00048     /* Format strings */
00049     static char fmt_9999[] = "(\002 UPLO = '\002,a1,\002', N =\002,i5,\002, "
00050             "RANK =\002,i3,\002, Diff =\002,i5,\002, NB =\002,i4,\002, type"
00051             " \002,i2,\002, Ratio =\002,g12.5)";
00052 
00053     /* System generated locals */
00054     integer i__1, i__2, i__3, i__4;
00055     doublereal d__1;
00056 
00057     /* Builtin functions */
00058     /* Subroutine */ int s_copy(char *, char *, ftnlen, ftnlen);
00059     integer i_dceiling(doublereal *), s_wsfe(cilist *), do_fio(integer *, 
00060             char *, ftnlen), e_wsfe(void);
00061 
00062     /* Local variables */
00063     integer rankdiff, comprank, i__, n, nb, in, kl, ku, lda, inb;
00064     doublereal tol;
00065     integer mode, imat, info, rank;
00066     char path[3], dist[1], uplo[1], type__[1];
00067     integer nrun;
00068     extern /* Subroutine */ int alahd_(integer *, char *);
00069     integer nfail, iseed[4], irank, nimat;
00070     doublereal anorm;
00071     integer iuplo, izero, nerrs;
00072     extern /* Subroutine */ int zpst01_(char *, integer *, doublecomplex *, 
00073             integer *, doublecomplex *, integer *, doublecomplex *, integer *, 
00074              integer *, doublereal *, doublereal *, integer *), 
00075             zlatb5_(char *, integer *, integer *, char *, integer *, integer *
00076 , doublereal *, integer *, doublereal *, char *), alaerh_(char *, char *, integer *, integer *, char *, 
00077             integer *, integer *, integer *, integer *, integer *, integer *, 
00078             integer *, integer *, integer *), alasum_(
00079             char *, integer *, integer *, integer *, integer *);
00080     doublereal cndnum;
00081     extern /* Subroutine */ int xlaenv_(integer *, integer *), zlacpy_(char *, 
00082              integer *, integer *, doublecomplex *, integer *, doublecomplex *
00083 , integer *), zlatmt_(integer *, integer *, char *, 
00084             integer *, char *, doublereal *, integer *, doublereal *, 
00085             doublereal *, integer *, integer *, integer *, char *, 
00086             doublecomplex *, integer *, doublecomplex *, integer *);
00087     doublereal result;
00088     extern /* Subroutine */ int zerrps_(char *, integer *), zpstrf_(
00089             char *, integer *, doublecomplex *, integer *, integer *, integer 
00090             *, doublereal *, doublereal *, integer *);
00091 
00092     /* Fortran I/O blocks */
00093     static cilist io___33 = { 0, 0, 0, fmt_9999, 0 };
00094 
00095 
00096 
00097 /*  -- LAPACK test routine (version 3.1) -- */
00098 /*     Craig Lucas, University of Manchester / NAG Ltd. */
00099 /*     October, 2008 */
00100 
00101 /*     .. Scalar Arguments .. */
00102 /*     .. */
00103 /*     .. Array Arguments .. */
00104 /*     .. */
00105 
00106 /*  Purpose */
00107 /*  ======= */
00108 
00109 /*  ZCHKPS tests ZPSTRF. */
00110 
00111 /*  Arguments */
00112 /*  ========= */
00113 
00114 /*  DOTYPE  (input) LOGICAL array, dimension (NTYPES) */
00115 /*          The matrix types to be used for testing.  Matrices of type j */
00116 /*          (for 1 <= j <= NTYPES) are used for testing if DOTYPE(j) = */
00117 /*          .TRUE.; if DOTYPE(j) = .FALSE., then type j is not used. */
00118 
00119 /*  NN      (input) INTEGER */
00120 /*          The number of values of N contained in the vector NVAL. */
00121 
00122 /*  NVAL    (input) INTEGER array, dimension (NN) */
00123 /*          The values of the matrix dimension N. */
00124 
00125 /*  NNB     (input) INTEGER */
00126 /*          The number of values of NB contained in the vector NBVAL. */
00127 
00128 /*  NBVAL   (input) INTEGER array, dimension (NBVAL) */
00129 /*          The values of the block size NB. */
00130 
00131 /*  NRANK   (input) INTEGER */
00132 /*          The number of values of RANK contained in the vector RANKVAL. */
00133 
00134 /*  RANKVAL (input) INTEGER array, dimension (NBVAL) */
00135 /*          The values of the block size NB. */
00136 
00137 /*  THRESH  (input) DOUBLE PRECISION */
00138 /*          The threshold value for the test ratios.  A result is */
00139 /*          included in the output file if RESULT >= THRESH.  To have */
00140 /*          every test ratio printed, use THRESH = 0. */
00141 
00142 /*  TSTERR  (input) LOGICAL */
00143 /*          Flag that indicates whether error exits are to be tested. */
00144 
00145 /*  NMAX    (input) INTEGER */
00146 /*          The maximum value permitted for N, used in dimensioning the */
00147 /*          work arrays. */
00148 
00149 /*  A       (workspace) COMPLEX*16 array, dimension (NMAX*NMAX) */
00150 
00151 /*  AFAC    (workspace) COMPLEX*16 array, dimension (NMAX*NMAX) */
00152 
00153 /*  PERM    (workspace) COMPLEX*16 array, dimension (NMAX*NMAX) */
00154 
00155 /*  PIV     (workspace) INTEGER array, dimension (NMAX) */
00156 
00157 /*  WORK    (workspace) COMPLEX*16 array, dimension (NMAX*3) */
00158 
00159 /*  RWORK   (workspace) DOUBLE PRECISION array, dimension (NMAX) */
00160 
00161 /*  NOUT    (input) INTEGER */
00162 /*          The unit number for output. */
00163 
00164 /*  ===================================================================== */
00165 
00166 /*     .. Parameters .. */
00167 /*     .. */
00168 /*     .. Local Scalars .. */
00169 /*     .. */
00170 /*     .. Local Arrays .. */
00171 /*     .. */
00172 /*     .. External Subroutines .. */
00173 /*     .. */
00174 /*     .. Scalars in Common .. */
00175 /*     .. */
00176 /*     .. Common blocks .. */
00177 /*     .. */
00178 /*     .. Intrinsic Functions .. */
00179 /*     .. */
00180 /*     .. Data statements .. */
00181     /* Parameter adjustments */
00182     --rwork;
00183     --work;
00184     --piv;
00185     --perm;
00186     --afac;
00187     --a;
00188     --rankval;
00189     --nbval;
00190     --nval;
00191     --dotype;
00192 
00193     /* Function Body */
00194 /*     .. */
00195 /*     .. Executable Statements .. */
00196 
00197 /*     Initialize constants and the random number seed. */
00198 
00199     s_copy(path, "Zomplex Precision", (ftnlen)1, (ftnlen)17);
00200     s_copy(path + 1, "PS", (ftnlen)2, (ftnlen)2);
00201     nrun = 0;
00202     nfail = 0;
00203     nerrs = 0;
00204     for (i__ = 1; i__ <= 4; ++i__) {
00205         iseed[i__ - 1] = iseedy[i__ - 1];
00206 /* L100: */
00207     }
00208 
00209 /*     Test the error exits */
00210 
00211     if (*tsterr) {
00212         zerrps_(path, nout);
00213     }
00214     infoc_1.infot = 0;
00215 
00216 /*     Do for each value of N in NVAL */
00217 
00218     i__1 = *nn;
00219     for (in = 1; in <= i__1; ++in) {
00220         n = nval[in];
00221         lda = max(n,1);
00222         nimat = 9;
00223         if (n <= 0) {
00224             nimat = 1;
00225         }
00226 
00227         izero = 0;
00228         i__2 = nimat;
00229         for (imat = 1; imat <= i__2; ++imat) {
00230 
00231 /*           Do the tests only if DOTYPE( IMAT ) is true. */
00232 
00233             if (! dotype[imat]) {
00234                 goto L140;
00235             }
00236 
00237 /*              Do for each value of RANK in RANKVAL */
00238 
00239             i__3 = *nrank;
00240             for (irank = 1; irank <= i__3; ++irank) {
00241 
00242 /*              Only repeat test 3 to 5 for different ranks */
00243 /*              Other tests use full rank */
00244 
00245                 if ((imat < 3 || imat > 5) && irank > 1) {
00246                     goto L130;
00247                 }
00248 
00249                 d__1 = n * (doublereal) rankval[irank] / 100.f;
00250                 rank = i_dceiling(&d__1);
00251 
00252 
00253 /*           Do first for UPLO = 'U', then for UPLO = 'L' */
00254 
00255                 for (iuplo = 1; iuplo <= 2; ++iuplo) {
00256                     *(unsigned char *)uplo = *(unsigned char *)&uplos[iuplo - 
00257                             1];
00258 
00259 /*              Set up parameters with ZLATB5 and generate a test matrix */
00260 /*              with ZLATMT. */
00261 
00262                     zlatb5_(path, &imat, &n, type__, &kl, &ku, &anorm, &mode, 
00263                             &cndnum, dist);
00264 
00265                     s_copy(srnamc_1.srnamt, "ZLATMT", (ftnlen)32, (ftnlen)6);
00266                     zlatmt_(&n, &n, dist, iseed, type__, &rwork[1], &mode, &
00267                             cndnum, &anorm, &rank, &kl, &ku, uplo, &a[1], &
00268                             lda, &work[1], &info);
00269 
00270 /*              Check error code from ZLATMT. */
00271 
00272                     if (info != 0) {
00273                         alaerh_(path, "ZLATMT", &info, &c__0, uplo, &n, &n, &
00274                                 c_n1, &c_n1, &c_n1, &imat, &nfail, &nerrs, 
00275                                 nout);
00276                         goto L120;
00277                     }
00278 
00279 /*              Do for each value of NB in NBVAL */
00280 
00281                     i__4 = *nnb;
00282                     for (inb = 1; inb <= i__4; ++inb) {
00283                         nb = nbval[inb];
00284                         xlaenv_(&c__1, &nb);
00285 
00286 /*                 Compute the pivoted L*L' or U'*U factorization */
00287 /*                 of the matrix. */
00288 
00289                         zlacpy_(uplo, &n, &n, &a[1], &lda, &afac[1], &lda);
00290                         s_copy(srnamc_1.srnamt, "ZPSTRF", (ftnlen)32, (ftnlen)
00291                                 6);
00292 
00293 /*                 Use default tolerance */
00294 
00295                         tol = -1.;
00296                         zpstrf_(uplo, &n, &afac[1], &lda, &piv[1], &comprank, 
00297                                 &tol, &rwork[1], &info);
00298 
00299 /*                 Check error code from ZPSTRF. */
00300 
00301                         if (info < izero || info != izero && rank == n || 
00302                                 info <= izero && rank < n) {
00303                             alaerh_(path, "ZPSTRF", &info, &izero, uplo, &n, &
00304                                     n, &c_n1, &c_n1, &nb, &imat, &nfail, &
00305                                     nerrs, nout);
00306                             goto L110;
00307                         }
00308 
00309 /*                 Skip the test if INFO is not 0. */
00310 
00311                         if (info != 0) {
00312                             goto L110;
00313                         }
00314 
00315 /*                 Reconstruct matrix from factors and compute residual. */
00316 
00317 /*                 PERM holds permuted L*L^T or U^T*U */
00318 
00319                         zpst01_(uplo, &n, &a[1], &lda, &afac[1], &lda, &perm[
00320                                 1], &lda, &piv[1], &rwork[1], &result, &
00321                                 comprank);
00322 
00323 /*                 Print information about the tests that did not pass */
00324 /*                 the threshold or where computed rank was not RANK. */
00325 
00326                         if (n == 0) {
00327                             comprank = 0;
00328                         }
00329                         rankdiff = rank - comprank;
00330                         if (result >= *thresh) {
00331                             if (nfail == 0 && nerrs == 0) {
00332                                 alahd_(nout, path);
00333                             }
00334                             io___33.ciunit = *nout;
00335                             s_wsfe(&io___33);
00336                             do_fio(&c__1, uplo, (ftnlen)1);
00337                             do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer))
00338                                     ;
00339                             do_fio(&c__1, (char *)&rank, (ftnlen)sizeof(
00340                                     integer));
00341                             do_fio(&c__1, (char *)&rankdiff, (ftnlen)sizeof(
00342                                     integer));
00343                             do_fio(&c__1, (char *)&nb, (ftnlen)sizeof(integer)
00344                                     );
00345                             do_fio(&c__1, (char *)&imat, (ftnlen)sizeof(
00346                                     integer));
00347                             do_fio(&c__1, (char *)&result, (ftnlen)sizeof(
00348                                     doublereal));
00349                             e_wsfe();
00350                             ++nfail;
00351                         }
00352                         ++nrun;
00353 L110:
00354                         ;
00355                     }
00356 
00357 L120:
00358                     ;
00359                 }
00360 L130:
00361                 ;
00362             }
00363 L140:
00364             ;
00365         }
00366 /* L150: */
00367     }
00368 
00369 /*     Print a summary of the results. */
00370 
00371     alasum_(path, nout, &nfail, &nrun, &nerrs);
00372 
00373     return 0;
00374 
00375 /*     End of ZCHKPS */
00376 
00377 } /* zchkps_ */


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