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


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