ddrvab.c
Go to the documentation of this file.
00001 /* ddrvab.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 doublereal c_b17 = 0.;
00036 static integer c__1 = 1;
00037 
00038 /* Subroutine */ int ddrvab_(logical *dotype, integer *nm, integer *mval, 
00039         integer *nns, integer *nsval, doublereal *thresh, integer *nmax, 
00040         doublereal *a, doublereal *afac, doublereal *b, doublereal *x, 
00041         doublereal *work, doublereal *rwork, real *swork, integer *iwork, 
00042         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;
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];
00092     extern /* Subroutine */ int dget08_(char *, integer *, integer *, integer 
00093             *, doublereal *, integer *, doublereal *, integer *, doublereal *, 
00094              integer *, doublereal *, doublereal *);
00095     integer nimat;
00096     doublereal anorm;
00097     char trans[1];
00098     integer izero, nerrs;
00099     logical zerot;
00100     char xtype[1];
00101     extern /* Subroutine */ int dlatb4_(char *, integer *, integer *, integer 
00102             *, char *, integer *, integer *, doublereal *, integer *, 
00103             doublereal *, char *), alaerh_(char *, 
00104             char *, integer *, integer *, char *, integer *, integer *, 
00105             integer *, integer *, integer *, integer *, integer *, integer *, 
00106             integer *), dlacpy_(char *, integer *, 
00107             integer *, doublereal *, integer *, doublereal *, integer *), dlarhs_(char *, char *, char *, char *, integer *, 
00108             integer *, integer *, integer *, integer *, doublereal *, integer 
00109             *, doublereal *, integer *, doublereal *, integer *, integer *, 
00110             integer *), dlaset_(char *, 
00111             integer *, integer *, doublereal *, doublereal *, doublereal *, 
00112             integer *);
00113     doublereal cndnum;
00114     extern /* Subroutine */ int dlatms_(integer *, integer *, char *, integer 
00115             *, char *, doublereal *, integer *, doublereal *, doublereal *, 
00116             integer *, integer *, char *, doublereal *, integer *, doublereal 
00117             *, integer *), dsgesv_(integer *, integer 
00118             *, doublereal *, integer *, integer *, doublereal *, integer *, 
00119             doublereal *, integer *, doublereal *, real *, integer *, integer 
00120             *);
00121     doublereal result[1];
00122 
00123     /* Fortran I/O blocks */
00124     static cilist io___31 = { 0, 0, 0, fmt_9988, 0 };
00125     static cilist io___32 = { 0, 0, 0, fmt_9975, 0 };
00126     static cilist io___34 = { 0, 0, 0, fmt_8999, 0 };
00127     static cilist io___35 = { 0, 0, 0, fmt_8979, 0 };
00128     static cilist io___36 = { 0, 0, 0, fmt_8960, 0 };
00129     static cilist io___37 = { 0, 0, 0, fmt_9998, 0 };
00130     static cilist io___38 = { 0, 0, 0, fmt_9996, 0 };
00131     static cilist io___39 = { 0, 0, 0, fmt_9995, 0 };
00132     static cilist io___40 = { 0, 0, 0, fmt_9994, 0 };
00133 
00134 
00135 
00136 /*  -- LAPACK test routine (version 3.1) -- */
00137 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00138 /*     November 2006 */
00139 
00140 /*     .. Scalar Arguments .. */
00141 /*     .. */
00142 /*     .. Array Arguments .. */
00143 /*     .. */
00144 
00145 /*  Purpose */
00146 /*  ======= */
00147 
00148 /*  DDRVAB tests DSGESV */
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 M contained in the vector MVAL. */
00160 
00161 /*  MVAL    (input) INTEGER array, dimension (NM) */
00162 /*          The values of the matrix row dimension M. */
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 M or N, used in dimensioning */
00177 /*          the work arrays. */
00178 
00179 /*  A       (workspace) DOUBLE PRECISION array, dimension (NMAX*NMAX) */
00180 
00181 /*  AFAC    (workspace) DOUBLE PRECISION array, dimension (NMAX*NMAX) */
00182 
00183 /*  B       (workspace) DOUBLE PRECISION array, dimension (NMAX*NSMAX) */
00184 /*          where NSMAX is the largest entry in NSVAL. */
00185 
00186 /*  X       (workspace) DOUBLE PRECISION array, dimension (NMAX*NSMAX) */
00187 
00188 /*  WORK    (workspace) DOUBLE PRECISION array, dimension */
00189 /*                      (NMAX*max(3,NSMAX)) */
00190 
00191 /*  RWORK   (workspace) DOUBLE PRECISION array, dimension */
00192 /*                      (max(2*NMAX,2*NSMAX+NWORK)) */
00193 
00194 /*  SWORK   (workspace) REAL array, dimension */
00195 /*                      (NMAX*(NSMAX+NMAX)) */
00196 
00197 /*  IWORK   (workspace) INTEGER array, dimension */
00198 /*                      NMAX */
00199 
00200 /*  NOUT    (input) INTEGER */
00201 /*          The unit number for output. */
00202 
00203 /*  ===================================================================== */
00204 
00205 /*     .. Parameters .. */
00206 /*     .. */
00207 /*     .. Local Scalars .. */
00208 /*     .. */
00209 /*     .. Local Arrays .. */
00210 /*     .. */
00211 /*     .. Local Variables .. */
00212 /*     .. */
00213 /*     .. External Subroutines .. */
00214 /*     .. */
00215 /*     .. Intrinsic Functions .. */
00216 /*     .. */
00217 /*     .. Scalars in Common .. */
00218 /*     .. */
00219 /*     .. Common blocks .. */
00220 /*     .. */
00221 /*     .. Data statements .. */
00222     /* Parameter adjustments */
00223     --iwork;
00224     --swork;
00225     --rwork;
00226     --work;
00227     --x;
00228     --b;
00229     --afac;
00230     --a;
00231     --nsval;
00232     --mval;
00233     --dotype;
00234 
00235     /* Function Body */
00236 /*     .. */
00237 /*     .. Executable Statements .. */
00238 
00239 /*     Initialize constants and the random number seed. */
00240 
00241     kase = 0;
00242     s_copy(path, "Double precision", (ftnlen)1, (ftnlen)16);
00243     s_copy(path + 1, "GE", (ftnlen)2, (ftnlen)2);
00244     nrun = 0;
00245     nfail = 0;
00246     nerrs = 0;
00247     for (i__ = 1; i__ <= 4; ++i__) {
00248         iseed[i__ - 1] = iseedy[i__ - 1];
00249 /* L10: */
00250     }
00251 
00252     infoc_1.infot = 0;
00253 
00254 /*     Do for each value of M in MVAL */
00255 
00256     i__1 = *nm;
00257     for (im = 1; im <= i__1; ++im) {
00258         m = mval[im];
00259         lda = max(1,m);
00260 
00261         n = m;
00262         nimat = 11;
00263         if (m <= 0 || n <= 0) {
00264             nimat = 1;
00265         }
00266 
00267         i__2 = nimat;
00268         for (imat = 1; imat <= i__2; ++imat) {
00269 
00270 /*           Do the tests only if DOTYPE( IMAT ) is true. */
00271 
00272             if (! dotype[imat]) {
00273                 goto L100;
00274             }
00275 
00276 /*           Skip types 5, 6, or 7 if the matrix size is too small. */
00277 
00278             zerot = imat >= 5 && imat <= 7;
00279             if (zerot && n < imat - 4) {
00280                 goto L100;
00281             }
00282 
00283 /*           Set up parameters with DLATB4 and generate a test matrix */
00284 /*           with DLATMS. */
00285 
00286             dlatb4_(path, &imat, &m, &n, type__, &kl, &ku, &anorm, &mode, &
00287                     cndnum, dist);
00288 
00289             s_copy(srnamc_1.srnamt, "DLATMS", (ftnlen)32, (ftnlen)6);
00290             dlatms_(&m, &n, dist, iseed, type__, &rwork[1], &mode, &cndnum, &
00291                     anorm, &kl, &ku, "No packing", &a[1], &lda, &work[1], &
00292                     info);
00293 
00294 /*           Check error code from DLATMS. */
00295 
00296             if (info != 0) {
00297                 alaerh_(path, "DLATMS", &info, &c__0, " ", &m, &n, &c_n1, &
00298                         c_n1, &c_n1, &imat, &nfail, &nerrs, nout);
00299                 goto L100;
00300             }
00301 
00302 /*           For types 5-7, zero one or more columns of the matrix to */
00303 /*           test that INFO is returned correctly. */
00304 
00305             if (zerot) {
00306                 if (imat == 5) {
00307                     izero = 1;
00308                 } else if (imat == 6) {
00309                     izero = min(m,n);
00310                 } else {
00311                     izero = min(m,n) / 2 + 1;
00312                 }
00313                 ioff = (izero - 1) * lda;
00314                 if (imat < 7) {
00315                     i__3 = m;
00316                     for (i__ = 1; i__ <= i__3; ++i__) {
00317                         a[ioff + i__] = 0.;
00318 /* L20: */
00319                     }
00320                 } else {
00321                     i__3 = n - izero + 1;
00322                     dlaset_("Full", &m, &i__3, &c_b17, &c_b17, &a[ioff + 1], &
00323                             lda);
00324                 }
00325             } else {
00326                 izero = 0;
00327             }
00328 
00329             i__3 = *nns;
00330             for (irhs = 1; irhs <= i__3; ++irhs) {
00331                 nrhs = nsval[irhs];
00332                 *(unsigned char *)xtype = 'N';
00333                 *(unsigned char *)trans = 'N';
00334 
00335                 s_copy(srnamc_1.srnamt, "DLARHS", (ftnlen)32, (ftnlen)6);
00336                 dlarhs_(path, xtype, " ", trans, &n, &n, &kl, &ku, &nrhs, &a[
00337                         1], &lda, &x[1], &lda, &b[1], &lda, iseed, &info);
00338 
00339                 s_copy(srnamc_1.srnamt, "DSGESV", (ftnlen)32, (ftnlen)6);
00340 
00341                 ++kase;
00342 
00343                 dlacpy_("Full", &m, &n, &a[1], &lda, &afac[1], &lda);
00344 
00345                 dsgesv_(&n, &nrhs, &a[1], &lda, &iwork[1], &b[1], &lda, &x[1], 
00346                          &lda, &work[1], &swork[1], &iter, &info);
00347 
00348                 if (iter < 0) {
00349                     dlacpy_("Full", &m, &n, &afac[1], &lda, &a[1], &lda);
00350                 }
00351 
00352 /*              Check error code from DSGESV. This should be the same as */
00353 /*              the one of DGETRF. */
00354 
00355                 if (info != izero) {
00356 
00357                     if (nfail == 0 && nerrs == 0) {
00358                         alahd_(nout, path);
00359                     }
00360                     ++nerrs;
00361 
00362                     if (info != izero && izero != 0) {
00363                         io___31.ciunit = *nout;
00364                         s_wsfe(&io___31);
00365                         do_fio(&c__1, "DSGESV", (ftnlen)6);
00366                         do_fio(&c__1, (char *)&info, (ftnlen)sizeof(integer));
00367                         do_fio(&c__1, (char *)&izero, (ftnlen)sizeof(integer))
00368                                 ;
00369                         do_fio(&c__1, (char *)&m, (ftnlen)sizeof(integer));
00370                         do_fio(&c__1, (char *)&imat, (ftnlen)sizeof(integer));
00371                         e_wsfe();
00372                     } else {
00373                         io___32.ciunit = *nout;
00374                         s_wsfe(&io___32);
00375                         do_fio(&c__1, "DSGESV", (ftnlen)6);
00376                         do_fio(&c__1, (char *)&info, (ftnlen)sizeof(integer));
00377                         do_fio(&c__1, (char *)&m, (ftnlen)sizeof(integer));
00378                         do_fio(&c__1, (char *)&imat, (ftnlen)sizeof(integer));
00379                         e_wsfe();
00380                     }
00381                 }
00382 
00383 /*              Skip the remaining test if the matrix is singular. */
00384 
00385                 if (info != 0) {
00386                     goto L100;
00387                 }
00388 
00389 /*              Check the quality of the solution */
00390 
00391                 dlacpy_("Full", &n, &nrhs, &b[1], &lda, &work[1], &lda);
00392 
00393                 dget08_(trans, &n, &n, &nrhs, &a[1], &lda, &x[1], &lda, &work[
00394                         1], &lda, &rwork[1], result);
00395 
00396 /*              Check if the test passes the tesing. */
00397 /*              Print information about the tests that did not */
00398 /*              pass the testing. */
00399 
00400 /*              If iterative refinement has been used and claimed to */
00401 /*              be successful (ITER>0), we want */
00402 /*                NORM1(B - A*X)/(NORM1(A)*NORM1(X)*EPS*SRQT(N)) < 1 */
00403 
00404 /*              If double precision has been used (ITER<0), we want */
00405 /*                NORM1(B - A*X)/(NORM1(A)*NORM1(X)*EPS) < THRES */
00406 /*              (Cf. the linear solver testing routines) */
00407 
00408                 if (*thresh <= 0.f || iter >= 0 && n > 0 && result[0] >= sqrt(
00409                         (doublereal) n) || iter < 0 && result[0] >= *thresh) {
00410 
00411                     if (nfail == 0 && nerrs == 0) {
00412                         io___34.ciunit = *nout;
00413                         s_wsfe(&io___34);
00414                         do_fio(&c__1, "DGE", (ftnlen)3);
00415                         e_wsfe();
00416                         ci__1.cierr = 0;
00417                         ci__1.ciunit = *nout;
00418                         ci__1.cifmt = "( ' Matrix types:' )";
00419                         s_wsfe(&ci__1);
00420                         e_wsfe();
00421                         io___35.ciunit = *nout;
00422                         s_wsfe(&io___35);
00423                         e_wsfe();
00424                         ci__1.cierr = 0;
00425                         ci__1.ciunit = *nout;
00426                         ci__1.cifmt = "( ' Test ratios:' )";
00427                         s_wsfe(&ci__1);
00428                         e_wsfe();
00429                         io___36.ciunit = *nout;
00430                         s_wsfe(&io___36);
00431                         do_fio(&c__1, (char *)&c__1, (ftnlen)sizeof(integer));
00432                         e_wsfe();
00433                         ci__1.cierr = 0;
00434                         ci__1.ciunit = *nout;
00435                         ci__1.cifmt = "( ' Messages:' )";
00436                         s_wsfe(&ci__1);
00437                         e_wsfe();
00438                     }
00439 
00440                     io___37.ciunit = *nout;
00441                     s_wsfe(&io___37);
00442                     do_fio(&c__1, trans, (ftnlen)1);
00443                     do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00444                     do_fio(&c__1, (char *)&nrhs, (ftnlen)sizeof(integer));
00445                     do_fio(&c__1, (char *)&imat, (ftnlen)sizeof(integer));
00446                     do_fio(&c__1, (char *)&c__1, (ftnlen)sizeof(integer));
00447                     do_fio(&c__1, (char *)&result[0], (ftnlen)sizeof(
00448                             doublereal));
00449                     e_wsfe();
00450                     ++nfail;
00451                 }
00452                 ++nrun;
00453 /* L60: */
00454             }
00455 L100:
00456             ;
00457         }
00458 /* L120: */
00459     }
00460 
00461 /*     Print a summary of the results. */
00462 
00463     if (nfail > 0) {
00464         io___38.ciunit = *nout;
00465         s_wsfe(&io___38);
00466         do_fio(&c__1, "DSGESV", (ftnlen)6);
00467         do_fio(&c__1, (char *)&nfail, (ftnlen)sizeof(integer));
00468         do_fio(&c__1, (char *)&nrun, (ftnlen)sizeof(integer));
00469         e_wsfe();
00470     } else {
00471         io___39.ciunit = *nout;
00472         s_wsfe(&io___39);
00473         do_fio(&c__1, "DSGESV", (ftnlen)6);
00474         do_fio(&c__1, (char *)&nrun, (ftnlen)sizeof(integer));
00475         e_wsfe();
00476     }
00477     if (nerrs > 0) {
00478         io___40.ciunit = *nout;
00479         s_wsfe(&io___40);
00480         do_fio(&c__1, (char *)&nerrs, (ftnlen)sizeof(integer));
00481         e_wsfe();
00482     }
00483 
00484 
00485 /*     SUBNAM, INFO, INFOE, M, IMAT */
00486 
00487 
00488 /*     SUBNAM, INFO, M, IMAT */
00489 
00490     return 0;
00491 
00492 /*     End of DDRVAB */
00493 
00494 } /* ddrvab_ */


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