zdrvac.c
Go to the documentation of this file.
00001 /* zdrvac.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 zdrvac_(logical *dotype, integer *nm, integer *mval, 
00038         integer *nns, integer *nsval, doublereal *thresh, integer *nmax, 
00039         doublecomplex *a, doublecomplex *afac, doublecomplex *b, 
00040         doublecomplex *x, doublecomplex *work, doublereal *rwork, complex *
00041         swork, 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_9988[] = "(\002 *** \002,a6,\002 returned with INFO ="
00050             "\002,i5,\002 instead of \002,i5,/\002 ==> N =\002,i5,\002, type"
00051             " \002,i2)";
00052     static char fmt_9975[] = "(\002 *** Error code from \002,a6,\002=\002,"
00053             "i5,\002 for M=\002,i5,\002, type \002,i2)";
00054     static char fmt_8999[] = "(/1x,a3,\002:  positive definite dense matri"
00055             "ces\002)";
00056     static char fmt_8979[] = "(4x,\0021. Diagonal\002,24x,\0027. Last n/2 co"
00057             "lumns zero\002,/4x,\0022. Upper triangular\002,16x,\0028. Random"
00058             ", CNDNUM = sqrt(0.1/EPS)\002,/4x,\0023. Lower triangular\002,16x,"
00059             "\0029. Random, CNDNUM = 0.1/EPS\002,/4x,\0024. Random, CNDNUM = 2"
00060             "\002,13x,\00210. Scaled near underflow\002,/4x,\0025. First colu"
00061             "mn zero\002,14x,\00211. Scaled near overflow\002,/4x,\0026. Last"
00062             " column zero\002)";
00063     static char fmt_8960[] = "(3x,i2,\002: norm_1( B - A * X )  / \002,\002("
00064             " norm_1(A) * norm_1(X) * EPS * SQRT(N) ) > 1 if ITERREF\002,/4x"
00065             ",\002or norm_1( B - A * X )  / \002,\002( norm_1(A) * norm_1(X) "
00066             "* EPS ) > THRES if ZPOTRF\002)";
00067     static char fmt_9998[] = "(\002 UPLO='\002,a1,\002', N =\002,i5,\002, NR"
00068             "HS=\002,i3,\002, type \002,i2,\002, test(\002,i2,\002) =\002,g12"
00069             ".5)";
00070     static char fmt_9996[] = "(1x,a6,\002: \002,i6,\002 out of \002,i6,\002 "
00071             "tests failed to pass the threshold\002)";
00072     static char fmt_9995[] = "(/1x,\002All tests for \002,a6,\002 routines p"
00073             "assed the threshold (\002,i6,\002 tests run)\002)";
00074     static char fmt_9994[] = "(6x,i6,\002 error messages recorded\002)";
00075 
00076     /* System generated locals */
00077     integer i__1, i__2, i__3, i__4;
00078     cilist ci__1;
00079 
00080     /* Builtin functions */
00081     /* Subroutine */ int s_copy(char *, char *, ftnlen, ftnlen);
00082     integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void);
00083     double sqrt(doublereal);
00084 
00085     /* Local variables */
00086     integer i__, n, im, kl, ku, lda, ioff, mode, kase, imat, info;
00087     char path[3], dist[1];
00088     integer irhs, iter, nrhs;
00089     char uplo[1], type__[1];
00090     integer nrun;
00091     extern /* Subroutine */ int alahd_(integer *, char *);
00092     integer nfail, iseed[4], nimat;
00093     doublereal anorm;
00094     integer iuplo, izero, nerrs;
00095     logical zerot;
00096     extern /* Subroutine */ int zpot06_(char *, integer *, integer *, 
00097             doublecomplex *, integer *, doublecomplex *, integer *, 
00098             doublecomplex *, integer *, doublereal *, doublereal *);
00099     char xtype[1];
00100     extern /* Subroutine */ int zlatb4_(char *, integer *, integer *, integer 
00101             *, char *, integer *, integer *, doublereal *, integer *, 
00102             doublereal *, char *), alaerh_(char *, 
00103             char *, integer *, integer *, char *, integer *, integer *, 
00104             integer *, integer *, integer *, integer *, integer *, integer *, 
00105             integer *), zlaipd_(integer *, 
00106             doublecomplex *, integer *, integer *);
00107     doublereal cndnum;
00108     extern /* Subroutine */ int zlacpy_(char *, integer *, integer *, 
00109             doublecomplex *, integer *, doublecomplex *, integer *), 
00110             zlarhs_(char *, char *, char *, char *, integer *, integer *, 
00111             integer *, integer *, integer *, doublecomplex *, integer *, 
00112             doublecomplex *, integer *, doublecomplex *, integer *, integer *, 
00113              integer *), zlatms_(integer *, 
00114             integer *, char *, integer *, char *, doublereal *, integer *, 
00115             doublereal *, doublereal *, integer *, integer *, char *, 
00116             doublecomplex *, integer *, doublecomplex *, integer *);
00117     doublereal result[1];
00118     extern /* Subroutine */ int zcposv_(char *, integer *, integer *, 
00119             doublecomplex *, integer *, doublecomplex *, integer *, 
00120             doublecomplex *, integer *, doublecomplex *, complex *, 
00121             doublereal *, integer *, integer *);
00122 
00123     /* Fortran I/O blocks */
00124     static cilist io___32 = { 0, 0, 0, fmt_9988, 0 };
00125     static cilist io___33 = { 0, 0, 0, fmt_9975, 0 };
00126     static cilist io___35 = { 0, 0, 0, fmt_8999, 0 };
00127     static cilist io___36 = { 0, 0, 0, fmt_8979, 0 };
00128     static cilist io___37 = { 0, 0, 0, fmt_8960, 0 };
00129     static cilist io___38 = { 0, 0, 0, fmt_9998, 0 };
00130     static cilist io___39 = { 0, 0, 0, fmt_9996, 0 };
00131     static cilist io___40 = { 0, 0, 0, fmt_9995, 0 };
00132     static cilist io___41 = { 0, 0, 0, fmt_9994, 0 };
00133 
00134 
00135 
00136 /*  -- LAPACK test routine (version 3.1.2) -- */
00137 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00138 /*     May 2007 */
00139 
00140 /*     .. Scalar Arguments .. */
00141 /*     .. */
00142 /*     .. Array Arguments .. */
00143 /*     .. */
00144 
00145 /*  Purpose */
00146 /*  ======= */
00147 
00148 /*  ZDRVAC tests ZCPOSV. */
00149 
00150 /*  Arguments */
00151 /*  ========= */
00152 
00153 /*  DOTYPE  (input) LOGICAL array, dimension (NTYPES) */
00154 /*          The matrix types to be used for testing.  Matrices of type j */
00155 /*          (for 1 <= j <= NTYPES) are used for testing if DOTYPE(j) = */
00156 /*          .TRUE.; if DOTYPE(j) = .FALSE., then type j is not used. */
00157 
00158 /*  NM      (input) INTEGER */
00159 /*          The number of values of N contained in the vector MVAL. */
00160 
00161 /*  MVAL    (input) INTEGER array, dimension (NM) */
00162 /*          The values of the matrix dimension N. */
00163 
00164 /*  NNS    (input) INTEGER */
00165 /*          The number of values of NRHS contained in the vector NSVAL. */
00166 
00167 /*  NSVAL   (input) INTEGER array, dimension (NNS) */
00168 /*          The values of the number of right hand sides NRHS. */
00169 
00170 /*  THRESH  (input) DOUBLE PRECISION */
00171 /*          The threshold value for the test ratios.  A result is */
00172 /*          included in the output file if RESULT >= THRESH.  To have */
00173 /*          every test ratio printed, use THRESH = 0. */
00174 
00175 /*  NMAX    (input) INTEGER */
00176 /*          The maximum value permitted for N, used in dimensioning the */
00177 /*          work arrays. */
00178 
00179 /*  A       (workspace) COMPLEX*16 array, dimension (NMAX*NMAX) */
00180 
00181 /*  AFAC    (workspace) COMPLEX*16 array, dimension (NMAX*NMAX) */
00182 
00183 /*  B       (workspace) COMPLEX*16 array, dimension (NMAX*NSMAX) */
00184 
00185 /*  X       (workspace) COMPLEX*16 array, dimension (NMAX*NSMAX) */
00186 
00187 /*  WORK    (workspace) COMPLEX*16 array, dimension */
00188 /*                      (NMAX*max(3,NSMAX)) */
00189 
00190 /*  RWORK   (workspace) DOUBLE PRECISION array, dimension */
00191 /*                      (max(2*NMAX,2*NSMAX+NWORK)) */
00192 
00193 /*  SWORK   (workspace) COMPLEX array, dimension */
00194 /*                      (NMAX*(NSMAX+NMAX)) */
00195 
00196 /*  NOUT    (input) INTEGER */
00197 /*          The unit number for output. */
00198 
00199 /*  ===================================================================== */
00200 
00201 /*     .. Parameters .. */
00202 /*     .. */
00203 /*     .. Local Scalars .. */
00204 /*     .. */
00205 /*     .. Local Arrays .. */
00206 /*     .. */
00207 /*     .. Local Variables .. */
00208 /*     .. */
00209 /*     .. External Functions .. */
00210 /*     .. */
00211 /*     .. External Subroutines .. */
00212 /*     .. */
00213 /*     .. Intrinsic Functions .. */
00214 /*     .. */
00215 /*     .. Scalars in Common .. */
00216 /*     .. */
00217 /*     .. Common blocks .. */
00218 /*     .. */
00219 /*     .. Data statements .. */
00220     /* Parameter adjustments */
00221     --swork;
00222     --rwork;
00223     --work;
00224     --x;
00225     --b;
00226     --afac;
00227     --a;
00228     --nsval;
00229     --mval;
00230     --dotype;
00231 
00232     /* Function Body */
00233 /*     .. */
00234 /*     .. Executable Statements .. */
00235 
00236 /*     Initialize constants and the random number seed. */
00237 
00238     kase = 0;
00239     s_copy(path, "Zomplex precision", (ftnlen)1, (ftnlen)17);
00240     s_copy(path + 1, "PO", (ftnlen)2, (ftnlen)2);
00241     nrun = 0;
00242     nfail = 0;
00243     nerrs = 0;
00244     for (i__ = 1; i__ <= 4; ++i__) {
00245         iseed[i__ - 1] = iseedy[i__ - 1];
00246 /* L10: */
00247     }
00248 
00249     infoc_1.infot = 0;
00250 
00251 /*     Do for each value of N in MVAL */
00252 
00253     i__1 = *nm;
00254     for (im = 1; im <= i__1; ++im) {
00255         n = mval[im];
00256         lda = max(n,1);
00257         nimat = 9;
00258         if (n <= 0) {
00259             nimat = 1;
00260         }
00261 
00262         i__2 = nimat;
00263         for (imat = 1; imat <= i__2; ++imat) {
00264 
00265 /*           Do the tests only if DOTYPE( IMAT ) is true. */
00266 
00267             if (! dotype[imat]) {
00268                 goto L110;
00269             }
00270 
00271 /*           Skip types 3, 4, or 5 if the matrix size is too small. */
00272 
00273             zerot = imat >= 3 && imat <= 5;
00274             if (zerot && n < imat - 2) {
00275                 goto L110;
00276             }
00277 
00278 /*           Do first for UPLO = 'U', then for UPLO = 'L' */
00279 
00280             for (iuplo = 1; iuplo <= 2; ++iuplo) {
00281                 *(unsigned char *)uplo = *(unsigned char *)&uplos[iuplo - 1];
00282 
00283 /*              Set up parameters with ZLATB4 and generate a test matrix */
00284 /*              with ZLATMS. */
00285 
00286                 zlatb4_(path, &imat, &n, &n, type__, &kl, &ku, &anorm, &mode, 
00287                         &cndnum, dist);
00288 
00289                 s_copy(srnamc_1.srnamt, "ZLATMS", (ftnlen)32, (ftnlen)6);
00290                 zlatms_(&n, &n, dist, iseed, type__, &rwork[1], &mode, &
00291                         cndnum, &anorm, &kl, &ku, uplo, &a[1], &lda, &work[1], 
00292                          &info);
00293 
00294 /*              Check error code from ZLATMS. */
00295 
00296                 if (info != 0) {
00297                     alaerh_(path, "ZLATMS", &info, &c__0, uplo, &n, &n, &c_n1, 
00298                              &c_n1, &c_n1, &imat, &nfail, &nerrs, nout);
00299                     goto L100;
00300                 }
00301 
00302 /*              For types 3-5, zero one row and column of the matrix to */
00303 /*              test that INFO is returned correctly. */
00304 
00305                 if (zerot) {
00306                     if (imat == 3) {
00307                         izero = 1;
00308                     } else if (imat == 4) {
00309                         izero = n;
00310                     } else {
00311                         izero = n / 2 + 1;
00312                     }
00313                     ioff = (izero - 1) * lda;
00314 
00315 /*                 Set row and column IZERO of A to 0. */
00316 
00317                     if (iuplo == 1) {
00318                         i__3 = izero - 1;
00319                         for (i__ = 1; i__ <= i__3; ++i__) {
00320                             i__4 = ioff + i__;
00321                             a[i__4].r = 0., a[i__4].i = 0.;
00322 /* L20: */
00323                         }
00324                         ioff += izero;
00325                         i__3 = n;
00326                         for (i__ = izero; i__ <= i__3; ++i__) {
00327                             i__4 = ioff;
00328                             a[i__4].r = 0., a[i__4].i = 0.;
00329                             ioff += lda;
00330 /* L30: */
00331                         }
00332                     } else {
00333                         ioff = izero;
00334                         i__3 = izero - 1;
00335                         for (i__ = 1; i__ <= i__3; ++i__) {
00336                             i__4 = ioff;
00337                             a[i__4].r = 0., a[i__4].i = 0.;
00338                             ioff += lda;
00339 /* L40: */
00340                         }
00341                         ioff -= izero;
00342                         i__3 = n;
00343                         for (i__ = izero; i__ <= i__3; ++i__) {
00344                             i__4 = ioff + i__;
00345                             a[i__4].r = 0., a[i__4].i = 0.;
00346 /* L50: */
00347                         }
00348                     }
00349                 } else {
00350                     izero = 0;
00351                 }
00352 
00353 /*              Set the imaginary part of the diagonals. */
00354 
00355                 i__3 = lda + 1;
00356                 zlaipd_(&n, &a[1], &i__3, &c__0);
00357 
00358                 i__3 = *nns;
00359                 for (irhs = 1; irhs <= i__3; ++irhs) {
00360                     nrhs = nsval[irhs];
00361                     *(unsigned char *)xtype = 'N';
00362 
00363 /*                 Form an exact solution and set the right hand side. */
00364 
00365                     s_copy(srnamc_1.srnamt, "ZLARHS", (ftnlen)32, (ftnlen)6);
00366                     zlarhs_(path, xtype, uplo, " ", &n, &n, &kl, &ku, &nrhs, &
00367                             a[1], &lda, &x[1], &lda, &b[1], &lda, iseed, &
00368                             info);
00369 
00370 /*                 Compute the L*L' or U'*U factorization of the */
00371 /*                 matrix and solve the system. */
00372 
00373                     s_copy(srnamc_1.srnamt, "ZCPOSV ", (ftnlen)32, (ftnlen)7);
00374                     ++kase;
00375 
00376                     zlacpy_("All", &n, &n, &a[1], &lda, &afac[1], &lda);
00377 
00378                     zcposv_(uplo, &n, &nrhs, &afac[1], &lda, &b[1], &lda, &x[
00379                             1], &lda, &work[1], &swork[1], &rwork[1], &iter, &
00380                             info);
00381 
00382                     if (iter < 0) {
00383                         zlacpy_("All", &n, &n, &a[1], &lda, &afac[1], &lda);
00384                     }
00385 
00386 /*                 Check error code from ZCPOSV . */
00387 
00388                     if (info != izero) {
00389 
00390                         if (nfail == 0 && nerrs == 0) {
00391                             alahd_(nout, path);
00392                         }
00393                         ++nerrs;
00394 
00395                         if (info != izero && izero != 0) {
00396                             io___32.ciunit = *nout;
00397                             s_wsfe(&io___32);
00398                             do_fio(&c__1, "ZCPOSV", (ftnlen)6);
00399                             do_fio(&c__1, (char *)&info, (ftnlen)sizeof(
00400                                     integer));
00401                             do_fio(&c__1, (char *)&izero, (ftnlen)sizeof(
00402                                     integer));
00403                             do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer))
00404                                     ;
00405                             do_fio(&c__1, (char *)&imat, (ftnlen)sizeof(
00406                                     integer));
00407                             e_wsfe();
00408                         } else {
00409                             io___33.ciunit = *nout;
00410                             s_wsfe(&io___33);
00411                             do_fio(&c__1, "ZCPOSV", (ftnlen)6);
00412                             do_fio(&c__1, (char *)&info, (ftnlen)sizeof(
00413                                     integer));
00414                             do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer))
00415                                     ;
00416                             do_fio(&c__1, (char *)&imat, (ftnlen)sizeof(
00417                                     integer));
00418                             e_wsfe();
00419                         }
00420                     }
00421 
00422 /*                 Skip the remaining test if the matrix is singular. */
00423 
00424                     if (info != 0) {
00425                         goto L110;
00426                     }
00427 
00428 /*                 Check the quality of the solution */
00429 
00430                     zlacpy_("All", &n, &nrhs, &b[1], &lda, &work[1], &lda);
00431 
00432                     zpot06_(uplo, &n, &nrhs, &a[1], &lda, &x[1], &lda, &work[
00433                             1], &lda, &rwork[1], result);
00434 
00435 /*                 Check if the test passes the tesing. */
00436 /*                 Print information about the tests that did not */
00437 /*                 pass the testing. */
00438 
00439 /*                 If iterative refinement has been used and claimed to */
00440 /*                 be successful (ITER>0), we want */
00441 /*                 NORM1(B - A*X)/(NORM1(A)*NORM1(X)*EPS*SRQT(N)) < 1 */
00442 
00443 /*                 If double precision has been used (ITER<0), we want */
00444 /*                 NORM1(B - A*X)/(NORM1(A)*NORM1(X)*EPS) < THRES */
00445 /*                 (Cf. the linear solver testing routines) */
00446 
00447                     if (*thresh <= 0.f || iter >= 0 && n > 0 && result[0] >= 
00448                             sqrt((doublereal) n) || iter < 0 && result[0] >= *
00449                             thresh) {
00450 
00451                         if (nfail == 0 && nerrs == 0) {
00452                             io___35.ciunit = *nout;
00453                             s_wsfe(&io___35);
00454                             do_fio(&c__1, "ZPO", (ftnlen)3);
00455                             e_wsfe();
00456                             ci__1.cierr = 0;
00457                             ci__1.ciunit = *nout;
00458                             ci__1.cifmt = "( ' Matrix types:' )";
00459                             s_wsfe(&ci__1);
00460                             e_wsfe();
00461                             io___36.ciunit = *nout;
00462                             s_wsfe(&io___36);
00463                             e_wsfe();
00464                             ci__1.cierr = 0;
00465                             ci__1.ciunit = *nout;
00466                             ci__1.cifmt = "( ' Test ratios:' )";
00467                             s_wsfe(&ci__1);
00468                             e_wsfe();
00469                             io___37.ciunit = *nout;
00470                             s_wsfe(&io___37);
00471                             do_fio(&c__1, (char *)&c__1, (ftnlen)sizeof(
00472                                     integer));
00473                             e_wsfe();
00474                             ci__1.cierr = 0;
00475                             ci__1.ciunit = *nout;
00476                             ci__1.cifmt = "( ' Messages:' )";
00477                             s_wsfe(&ci__1);
00478                             e_wsfe();
00479                         }
00480 
00481                         io___38.ciunit = *nout;
00482                         s_wsfe(&io___38);
00483                         do_fio(&c__1, uplo, (ftnlen)1);
00484                         do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00485                         do_fio(&c__1, (char *)&nrhs, (ftnlen)sizeof(integer));
00486                         do_fio(&c__1, (char *)&imat, (ftnlen)sizeof(integer));
00487                         do_fio(&c__1, (char *)&c__1, (ftnlen)sizeof(integer));
00488                         do_fio(&c__1, (char *)&result[0], (ftnlen)sizeof(
00489                                 doublereal));
00490                         e_wsfe();
00491 
00492                         ++nfail;
00493 
00494                     }
00495 
00496                     ++nrun;
00497 
00498 /* L60: */
00499                 }
00500 L100:
00501                 ;
00502             }
00503 L110:
00504             ;
00505         }
00506 /* L120: */
00507     }
00508 
00509 /* L130: */
00510 
00511 /*     Print a summary of the results. */
00512 
00513     if (nfail > 0) {
00514         io___39.ciunit = *nout;
00515         s_wsfe(&io___39);
00516         do_fio(&c__1, "ZCPOSV", (ftnlen)6);
00517         do_fio(&c__1, (char *)&nfail, (ftnlen)sizeof(integer));
00518         do_fio(&c__1, (char *)&nrun, (ftnlen)sizeof(integer));
00519         e_wsfe();
00520     } else {
00521         io___40.ciunit = *nout;
00522         s_wsfe(&io___40);
00523         do_fio(&c__1, "ZCPOSV", (ftnlen)6);
00524         do_fio(&c__1, (char *)&nrun, (ftnlen)sizeof(integer));
00525         e_wsfe();
00526     }
00527     if (nerrs > 0) {
00528         io___41.ciunit = *nout;
00529         s_wsfe(&io___41);
00530         do_fio(&c__1, (char *)&nerrs, (ftnlen)sizeof(integer));
00531         e_wsfe();
00532     }
00533 
00534 
00535 /*     SUBNAM, INFO, INFOE, N, IMAT */
00536 
00537 
00538 /*     SUBNAM, INFO, N, IMAT */
00539 
00540     return 0;
00541 
00542 /*     End of ZDRVAC */
00543 
00544 } /* zdrvac_ */


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