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


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