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


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