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


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