debchvxx.c
Go to the documentation of this file.
00001 /* debchvxx.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 /* Table of constant values */
00017 
00018 static integer c__10 = 10;
00019 static integer c__2 = 2;
00020 static integer c__3 = 3;
00021 static integer c__1 = 1;
00022 static integer c__4 = 4;
00023 static integer c__5 = 5;
00024 static integer c__6 = 6;
00025 static integer c__7 = 7;
00026 static integer c__8 = 8;
00027 
00028 /* Subroutine */ int debchvxx_(doublereal *thresh, char *path)
00029 {
00030     /* Format strings */
00031     static char fmt_8000[] = "(\002 D\002,a2,\002SVXX: N =\002,i2,\002, INFO"
00032             " = \002,i3,\002, ORCOND = \002,g12.5,\002, real RCOND = \002,g12"
00033             ".5)";
00034     static char fmt_9996[] = "(3x,i2,\002: Normwise guaranteed forward erro"
00035             "r\002,/5x,\002Guaranteed case: if norm ( abs( Xc - Xt )\002,\002"
00036             " / norm ( Xt ) .LE. ERRBND( *, nwise_i, bnd_i ), then\002,/5x"
00037             ",\002ERRBND( *, nwise_i, bnd_i ) .LE. MAX(SQRT(N), 10) * EPS\002)"
00038             ;
00039     static char fmt_9995[] = "(3x,i2,\002: Componentwise guaranteed forward "
00040             "error\002)";
00041     static char fmt_9994[] = "(3x,i2,\002: Backwards error\002)";
00042     static char fmt_9993[] = "(3x,i2,\002: Reciprocal condition number\002)";
00043     static char fmt_9992[] = "(3x,i2,\002: Reciprocal normwise condition num"
00044             "ber\002)";
00045     static char fmt_9991[] = "(3x,i2,\002: Raw normwise error estimate\002)";
00046     static char fmt_9990[] = "(3x,i2,\002: Reciprocal componentwise conditio"
00047             "n number\002)";
00048     static char fmt_9989[] = "(3x,i2,\002: Raw componentwise error estimat"
00049             "e\002)";
00050     static char fmt_9999[] = "(\002 D\002,a2,\002SVXX: N =\002,i2,\002, RHS "
00051             "= \002,i2,\002, NWISE GUAR. = \002,a,\002, CWISE GUAR. = \002,a"
00052             ",\002 test(\002,i1,\002) =\002,g12.5)";
00053     static char fmt_9998[] = "(\002 D\002,a2,\002SVXX: \002,i6,\002 out of"
00054             " \002,i6,\002 tests failed to pass the threshold\002)";
00055     static char fmt_9997[] = "(\002 D\002,a2,\002SVXX passed the tests of er"
00056             "ror bounds\002)";
00057 
00058     /* System generated locals */
00059     integer i__1, i__2, i__3, i__4, i__5, i__6;
00060     doublereal d__1, d__2, d__3;
00061 
00062     /* Builtin functions */
00063     /* Subroutine */ int s_copy(char *, char *, ftnlen, ftnlen);
00064     double sqrt(doublereal);
00065     integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void),
00066              s_wsle(cilist *), e_wsle(void);
00067 
00068     /* Local variables */
00069     extern /* Subroutine */ int dsysvxx_(char *, char *, integer *, integer *, 
00070              doublereal *, integer *, doublereal *, integer *, integer *, 
00071             char *, doublereal *, doublereal *, integer *, doublereal *, 
00072             integer *, doublereal *, doublereal *, doublereal *, integer *, 
00073             doublereal *, doublereal *, integer *, doublereal *, doublereal *, 
00074              integer *, integer *);
00075     doublereal errbnd_c__[30], errbnd_n__[30], a[100]   /* was [10][10] */, b[
00076             100]        /* was [10][10] */, c__[10];
00077     integer i__, j, k;
00078     doublereal m;
00079     integer n;
00080     doublereal r__[10], s[10], x[100]   /* was [10][10] */, cwise_bnd__;
00081     char c2[2];
00082     doublereal nwise_bnd__, cwise_err__, nwise_err__, errthresh, ab[190]        
00083             /* was [19][10] */, af[100] /* was [10][10] */;
00084     integer kl, ku;
00085     doublereal condthresh, afb[280]     /* was [28][10] */;
00086     integer lda;
00087     doublereal eps, cwise_rcond__, nwise_rcond__;
00088     integer n_aux_tests__, ldab;
00089     doublereal diff[100]        /* was [10][10] */;
00090     char fact[1];
00091     doublereal berr[10];
00092     integer info, ipiv[10], nrhs;
00093     doublereal rinv[10];
00094     char uplo[1];
00095     doublereal work[150], sumr;
00096     integer ldafb;
00097     doublereal ccond;
00098     integer nfail;
00099     char cguar[3];
00100     doublereal ncond;
00101     char equed[1];
00102     doublereal rcond, acopy[100]        /* was [10][10] */;
00103     char nguar[3], trans[1];
00104     integer iwork[30];
00105     doublereal rnorm, normt, sumri;
00106     logical printed_guide__;
00107     extern doublereal dlamch_(char *);
00108     extern /* Subroutine */ int dlacpy_(char *, integer *, integer *, 
00109             doublereal *, integer *, doublereal *, integer *);
00110     doublereal abcopy[190]      /* was [19][10] */;
00111     extern logical lsamen_(integer *, char *, char *);
00112     doublereal params[2], orcond, rinorm, tstrat[6], rpvgrw;
00113     extern /* Subroutine */ int dlahilb_(integer *, integer *, doublereal *, 
00114             integer *, doublereal *, integer *, doublereal *, integer *, 
00115             doublereal *, integer *);
00116     doublereal invhilb[100]     /* was [10][10] */, normdif;
00117     extern /* Subroutine */ int dgbsvxx_(char *, char *, integer *, integer *, 
00118              integer *, integer *, doublereal *, integer *, doublereal *, 
00119             integer *, integer *, char *, doublereal *, doublereal *, 
00120             doublereal *, integer *, doublereal *, integer *, doublereal *, 
00121             doublereal *, doublereal *, integer *, doublereal *, doublereal *, 
00122              integer *, doublereal *, doublereal *, integer *, integer *), dgesvxx_(char *, char *, integer *, 
00123             integer *, doublereal *, integer *, doublereal *, integer *, 
00124             integer *, char *, doublereal *, doublereal *, doublereal *, 
00125             integer *, doublereal *, integer *, doublereal *, doublereal *, 
00126             doublereal *, integer *, doublereal *, doublereal *, integer *, 
00127             doublereal *, doublereal *, integer *, integer *), dposvxx_(char *, char *, integer *, integer *, 
00128             doublereal *, integer *, doublereal *, integer *, char *, 
00129             doublereal *, doublereal *, integer *, doublereal *, integer *, 
00130             doublereal *, doublereal *, doublereal *, integer *, doublereal *, 
00131              doublereal *, integer *, doublereal *, doublereal *, integer *, 
00132             integer *);
00133 
00134     /* Fortran I/O blocks */
00135     static cilist io___42 = { 0, 6, 0, fmt_8000, 0 };
00136     static cilist io___66 = { 0, 6, 0, 0, 0 };
00137     static cilist io___67 = { 0, 6, 0, fmt_9996, 0 };
00138     static cilist io___68 = { 0, 6, 0, fmt_9995, 0 };
00139     static cilist io___69 = { 0, 6, 0, fmt_9994, 0 };
00140     static cilist io___70 = { 0, 6, 0, fmt_9993, 0 };
00141     static cilist io___71 = { 0, 6, 0, fmt_9992, 0 };
00142     static cilist io___72 = { 0, 6, 0, fmt_9991, 0 };
00143     static cilist io___73 = { 0, 6, 0, fmt_9990, 0 };
00144     static cilist io___74 = { 0, 6, 0, fmt_9989, 0 };
00145     static cilist io___75 = { 0, 6, 0, 0, 0 };
00146     static cilist io___76 = { 0, 6, 0, fmt_9999, 0 };
00147     static cilist io___77 = { 0, 6, 0, 0, 0 };
00148     static cilist io___78 = { 0, 6, 0, fmt_9998, 0 };
00149     static cilist io___79 = { 0, 6, 0, fmt_9997, 0 };
00150 
00151 
00152 /*     .. Scalar Arguments .. */
00153 
00154 /*  Purpose */
00155 /*  ====== */
00156 
00157 /*  DEBCHVXX will run D**SVXX on a series of Hilbert matrices and then */
00158 /*  compare the error bounds returned by D**SVXX to see if the returned */
00159 /*  answer indeed falls within those bounds. */
00160 
00161 /*  Eight test ratios will be computed.  The tests will pass if they are .LT. */
00162 /*  THRESH.  There are two cases that are determined by 1 / (SQRT( N ) * EPS). */
00163 /*  If that value is .LE. to the component wise reciprocal condition number, */
00164 /*  it uses the guaranteed case, other wise it uses the unguaranteed case. */
00165 
00166 /*  Test ratios: */
00167 /*     Let Xc be X_computed and Xt be X_truth. */
00168 /*     The norm used is the infinity norm. */
00169 /*     Let A be the guaranteed case and B be the unguaranteed case. */
00170 
00171 /*       1. Normwise guaranteed forward error bound. */
00172 /*       A: norm ( abs( Xc - Xt ) / norm ( Xt ) .LE. ERRBND( *, nwise_i, bnd_i ) and */
00173 /*          ERRBND( *, nwise_i, bnd_i ) .LE. MAX(SQRT(N),10) * EPS. */
00174 /*          If these conditions are met, the test ratio is set to be */
00175 /*          ERRBND( *, nwise_i, bnd_i ) / MAX(SQRT(N), 10).  Otherwise it is 1/EPS. */
00176 /*       B: For this case, CGESVXX should just return 1.  If it is less than */
00177 /*          one, treat it the same as in 1A.  Otherwise it fails. (Set test */
00178 /*          ratio to ERRBND( *, nwise_i, bnd_i ) * THRESH?) */
00179 
00180 /*       2. Componentwise guaranteed forward error bound. */
00181 /*       A: norm ( abs( Xc(j) - Xt(j) ) ) / norm (Xt(j)) .LE. ERRBND( *, cwise_i, bnd_i ) */
00182 /*          for all j .AND. ERRBND( *, cwise_i, bnd_i ) .LE. MAX(SQRT(N), 10) * EPS. */
00183 /*          If these conditions are met, the test ratio is set to be */
00184 /*          ERRBND( *, cwise_i, bnd_i ) / MAX(SQRT(N), 10).  Otherwise it is 1/EPS. */
00185 /*       B: Same as normwise test ratio. */
00186 
00187 /*       3. Backwards error. */
00188 /*       A: The test ratio is set to BERR/EPS. */
00189 /*       B: Same test ratio. */
00190 
00191 /*       4. Reciprocal condition number. */
00192 /*       A: A condition number is computed with Xt and compared with the one */
00193 /*          returned from CGESVXX.  Let RCONDc be the RCOND returned by D**SVXX */
00194 /*          and RCONDt be the RCOND from the truth value.  Test ratio is set to */
00195 /*          MAX(RCONDc/RCONDt, RCONDt/RCONDc). */
00196 /*       B: Test ratio is set to 1 / (EPS * RCONDc). */
00197 
00198 /*       5. Reciprocal normwise condition number. */
00199 /*       A: The test ratio is set to */
00200 /*          MAX(ERRBND( *, nwise_i, cond_i ) / NCOND, NCOND / ERRBND( *, nwise_i, cond_i )). */
00201 /*       B: Test ratio is set to 1 / (EPS * ERRBND( *, nwise_i, cond_i )). */
00202 
00203 /*       6. Reciprocal componentwise condition number. */
00204 /*       A: Test ratio is set to */
00205 /*          MAX(ERRBND( *, cwise_i, cond_i ) / CCOND, CCOND / ERRBND( *, cwise_i, cond_i )). */
00206 /*       B: Test ratio is set to 1 / (EPS * ERRBND( *, cwise_i, cond_i )). */
00207 
00208 /*     .. Parameters .. */
00209 /*     NMAX is determined by the largest number in the inverse of the hilbert */
00210 /*     matrix.  Precision is exhausted when the largest entry in it is greater */
00211 /*     than 2 to the power of the number of bits in the fraction of the data */
00212 /*     type used plus one, which is 24 for single precision. */
00213 /*     NMAX should be 6 for single and 11 for double. */
00214 /*     .. Local Scalars .. */
00215 /*     .. Local Arrays .. */
00216 /*     .. External Functions .. */
00217 /*     .. External Subroutines .. */
00218 /*     .. Intrinsic Functions .. */
00219 /*     .. Parameters .. */
00220 /*  Create the loop to test out the Hilbert matrices */
00221     *(unsigned char *)fact = 'E';
00222     *(unsigned char *)uplo = 'U';
00223     *(unsigned char *)trans = 'N';
00224     *(unsigned char *)equed = 'N';
00225     eps = dlamch_("Epsilon");
00226     nfail = 0;
00227     n_aux_tests__ = 0;
00228     lda = 10;
00229     ldab = 19;
00230     ldafb = 28;
00231     s_copy(c2, path + 1, (ftnlen)2, (ftnlen)2);
00232 /*     Main loop to test the different Hilbert Matrices. */
00233     printed_guide__ = FALSE_;
00234     for (n = 1; n <= 10; ++n) {
00235         params[0] = -1.;
00236         params[1] = -1.;
00237         kl = n - 1;
00238         ku = n - 1;
00239         nrhs = n;
00240 /* Computing MAX */
00241         d__1 = sqrt((doublereal) n);
00242         m = max(d__1,10.);
00243 /*        Generate the Hilbert matrix, its inverse, and the */
00244 /*        right hand side, all scaled by the LCM(1,..,2N-1). */
00245         dlahilb_(&n, &n, a, &lda, invhilb, &lda, b, &lda, work, &info);
00246 /*        Copy A into ACOPY. */
00247         dlacpy_("ALL", &n, &n, a, &c__10, acopy, &c__10);
00248 /*        Store A in band format for GB tests */
00249         i__1 = n;
00250         for (j = 1; j <= i__1; ++j) {
00251             i__2 = kl + ku + 1;
00252             for (i__ = 1; i__ <= i__2; ++i__) {
00253                 ab[i__ + j * 19 - 20] = 0.;
00254             }
00255         }
00256         i__1 = n;
00257         for (j = 1; j <= i__1; ++j) {
00258 /* Computing MAX */
00259             i__2 = 1, i__3 = j - ku;
00260 /* Computing MIN */
00261             i__5 = n, i__6 = j + kl;
00262             i__4 = min(i__5,i__6);
00263             for (i__ = max(i__2,i__3); i__ <= i__4; ++i__) {
00264                 ab[ku + 1 + i__ - j + j * 19 - 20] = a[i__ + j * 10 - 11];
00265             }
00266         }
00267 /*        Copy AB into ABCOPY. */
00268         i__1 = n;
00269         for (j = 1; j <= i__1; ++j) {
00270             i__4 = kl + ku + 1;
00271             for (i__ = 1; i__ <= i__4; ++i__) {
00272                 abcopy[i__ + j * 19 - 20] = 0.;
00273             }
00274         }
00275         i__1 = kl + ku + 1;
00276         dlacpy_("ALL", &i__1, &n, ab, &ldab, abcopy, &ldab);
00277 /*        Call D**SVXX with default PARAMS and N_ERR_BND = 3. */
00278         if (lsamen_(&c__2, c2, "SY")) {
00279             dsysvxx_(fact, uplo, &n, &nrhs, acopy, &lda, af, &lda, ipiv, 
00280                     equed, s, b, &lda, x, &lda, &orcond, &rpvgrw, berr, &c__3, 
00281                      errbnd_n__, errbnd_c__, &c__2, params, work, iwork, &
00282                     info);
00283         } else if (lsamen_(&c__2, c2, "PO")) {
00284             dposvxx_(fact, uplo, &n, &nrhs, acopy, &lda, af, &lda, equed, s, 
00285                     b, &lda, x, &lda, &orcond, &rpvgrw, berr, &c__3, 
00286                     errbnd_n__, errbnd_c__, &c__2, params, work, iwork, &info);
00287         } else if (lsamen_(&c__2, c2, "GB")) {
00288             dgbsvxx_(fact, trans, &n, &kl, &ku, &nrhs, abcopy, &ldab, afb, &
00289                     ldafb, ipiv, equed, r__, c__, b, &lda, x, &lda, &orcond, &
00290                     rpvgrw, berr, &c__3, errbnd_n__, errbnd_c__, &c__2, 
00291                     params, work, iwork, &info);
00292         } else {
00293             dgesvxx_(fact, trans, &n, &nrhs, acopy, &lda, af, &lda, ipiv, 
00294                     equed, r__, c__, b, &lda, x, &lda, &orcond, &rpvgrw, berr, 
00295                      &c__3, errbnd_n__, errbnd_c__, &c__2, params, work, 
00296                     iwork, &info);
00297         }
00298         ++n_aux_tests__;
00299         if (orcond < eps) {
00300 /*        Either factorization failed or the matrix is flagged, and 1 <= */
00301 /*        INFO <= N+1. We don't decide based on rcond anymore. */
00302 /*            IF (INFO .EQ. 0 .OR. INFO .GT. N+1) THEN */
00303 /*               NFAIL = NFAIL + 1 */
00304 /*               WRITE (*, FMT=8000) N, INFO, ORCOND, RCOND */
00305 /*            END IF */
00306         } else {
00307 /*        Either everything succeeded (INFO == 0) or some solution failed */
00308 /*        to converge (INFO > N+1). */
00309             if (info > 0 && info <= n + 1) {
00310                 ++nfail;
00311                 s_wsfe(&io___42);
00312                 do_fio(&c__1, c2, (ftnlen)2);
00313                 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00314                 do_fio(&c__1, (char *)&info, (ftnlen)sizeof(integer));
00315                 do_fio(&c__1, (char *)&orcond, (ftnlen)sizeof(doublereal));
00316                 do_fio(&c__1, (char *)&rcond, (ftnlen)sizeof(doublereal));
00317                 e_wsfe();
00318             }
00319         }
00320 /*        Calculating the difference between D**SVXX's X and the true X. */
00321         i__1 = n;
00322         for (i__ = 1; i__ <= i__1; ++i__) {
00323             i__4 = nrhs;
00324             for (j = 1; j <= i__4; ++j) {
00325                 diff[i__ + j * 10 - 11] = x[i__ + j * 10 - 11] - invhilb[i__ 
00326                         + j * 10 - 11];
00327             }
00328         }
00329 /*        Calculating the RCOND */
00330         rnorm = 0.;
00331         rinorm = 0.;
00332         if (lsamen_(&c__2, c2, "PO") || lsamen_(&c__2, 
00333                 c2, "SY")) {
00334             i__1 = n;
00335             for (i__ = 1; i__ <= i__1; ++i__) {
00336                 sumr = 0.;
00337                 sumri = 0.;
00338                 i__4 = n;
00339                 for (j = 1; j <= i__4; ++j) {
00340                     sumr += s[i__ - 1] * (d__1 = a[i__ + j * 10 - 11], abs(
00341                             d__1)) * s[j - 1];
00342                     sumri += (d__1 = invhilb[i__ + j * 10 - 11], abs(d__1)) / 
00343                             (s[j - 1] * s[i__ - 1]);
00344                 }
00345                 rnorm = max(rnorm,sumr);
00346                 rinorm = max(rinorm,sumri);
00347             }
00348         } else if (lsamen_(&c__2, c2, "GE") || lsamen_(&
00349                 c__2, c2, "GB")) {
00350             i__1 = n;
00351             for (i__ = 1; i__ <= i__1; ++i__) {
00352                 sumr = 0.;
00353                 sumri = 0.;
00354                 i__4 = n;
00355                 for (j = 1; j <= i__4; ++j) {
00356                     sumr += r__[i__ - 1] * (d__1 = a[i__ + j * 10 - 11], abs(
00357                             d__1)) * c__[j - 1];
00358                     sumri += (d__1 = invhilb[i__ + j * 10 - 11], abs(d__1)) / 
00359                             (r__[j - 1] * c__[i__ - 1]);
00360                 }
00361                 rnorm = max(rnorm,sumr);
00362                 rinorm = max(rinorm,sumri);
00363             }
00364         }
00365         rnorm /= abs(a[0]);
00366         rcond = 1. / (rnorm * rinorm);
00367 /*        Calculating the R for normwise rcond. */
00368         i__1 = n;
00369         for (i__ = 1; i__ <= i__1; ++i__) {
00370             rinv[i__ - 1] = 0.;
00371         }
00372         i__1 = n;
00373         for (j = 1; j <= i__1; ++j) {
00374             i__4 = n;
00375             for (i__ = 1; i__ <= i__4; ++i__) {
00376                 rinv[i__ - 1] += (d__1 = a[i__ + j * 10 - 11], abs(d__1));
00377             }
00378         }
00379 /*        Calculating the Normwise rcond. */
00380         rinorm = 0.;
00381         i__1 = n;
00382         for (i__ = 1; i__ <= i__1; ++i__) {
00383             sumri = 0.;
00384             i__4 = n;
00385             for (j = 1; j <= i__4; ++j) {
00386                 sumri += (d__1 = invhilb[i__ + j * 10 - 11] * rinv[j - 1], 
00387                         abs(d__1));
00388             }
00389             rinorm = max(rinorm,sumri);
00390         }
00391 /*        invhilb is the inverse *unscaled* Hilbert matrix, so scale its norm */
00392 /*        by 1/A(1,1) to make the scaling match A (the scaled Hilbert matrix) */
00393         ncond = abs(a[0]) / rinorm;
00394         condthresh = m * eps;
00395         errthresh = m * eps;
00396         i__1 = nrhs;
00397         for (k = 1; k <= i__1; ++k) {
00398             normt = 0.;
00399             normdif = 0.;
00400             cwise_err__ = 0.;
00401             i__4 = n;
00402             for (i__ = 1; i__ <= i__4; ++i__) {
00403 /* Computing MAX */
00404                 d__2 = (d__1 = invhilb[i__ + k * 10 - 11], abs(d__1));
00405                 normt = max(d__2,normt);
00406 /* Computing MAX */
00407                 d__2 = (d__1 = x[i__ + k * 10 - 11] - invhilb[i__ + k * 10 - 
00408                         11], abs(d__1));
00409                 normdif = max(d__2,normdif);
00410                 if (invhilb[i__ + k * 10 - 11] != 0.) {
00411 /* Computing MAX */
00412                     d__3 = (d__1 = x[i__ + k * 10 - 11] - invhilb[i__ + k * 
00413                             10 - 11], abs(d__1)) / (d__2 = invhilb[i__ + k * 
00414                             10 - 11], abs(d__2));
00415                     cwise_err__ = max(d__3,cwise_err__);
00416                 } else if (x[i__ + k * 10 - 11] != 0.) {
00417                     cwise_err__ = dlamch_("OVERFLOW");
00418                 }
00419             }
00420             if (normt != 0.) {
00421                 nwise_err__ = normdif / normt;
00422             } else if (normdif != 0.) {
00423                 nwise_err__ = dlamch_("OVERFLOW");
00424             } else {
00425                 nwise_err__ = 0.;
00426             }
00427             i__4 = n;
00428             for (i__ = 1; i__ <= i__4; ++i__) {
00429                 rinv[i__ - 1] = 0.;
00430             }
00431             i__4 = n;
00432             for (j = 1; j <= i__4; ++j) {
00433                 i__2 = n;
00434                 for (i__ = 1; i__ <= i__2; ++i__) {
00435                     rinv[i__ - 1] += (d__1 = a[i__ + j * 10 - 11] * invhilb[j 
00436                             + k * 10 - 11], abs(d__1));
00437                 }
00438             }
00439             rinorm = 0.;
00440             i__4 = n;
00441             for (i__ = 1; i__ <= i__4; ++i__) {
00442                 sumri = 0.;
00443                 i__2 = n;
00444                 for (j = 1; j <= i__2; ++j) {
00445                     sumri += (d__1 = invhilb[i__ + j * 10 - 11] * rinv[j - 1] 
00446                             / invhilb[i__ + k * 10 - 11], abs(d__1));
00447                 }
00448                 rinorm = max(rinorm,sumri);
00449             }
00450 /*        invhilb is the inverse *unscaled* Hilbert matrix, so scale its norm */
00451 /*        by 1/A(1,1) to make the scaling match A (the scaled Hilbert matrix) */
00452             ccond = abs(a[0]) / rinorm;
00453 /*        Forward error bound tests */
00454             nwise_bnd__ = errbnd_n__[k + nrhs - 1];
00455             cwise_bnd__ = errbnd_c__[k + nrhs - 1];
00456             nwise_rcond__ = errbnd_n__[k + (nrhs << 1) - 1];
00457             cwise_rcond__ = errbnd_c__[k + (nrhs << 1) - 1];
00458 /*            write (*,*) 'nwise : ', n, k, ncond, nwise_rcond, */
00459 /*     $           condthresh, ncond.ge.condthresh */
00460 /*            write (*,*) 'nwise2: ', k, nwise_bnd, nwise_err, errthresh */
00461             if (ncond >= condthresh) {
00462                 s_copy(nguar, "YES", (ftnlen)3, (ftnlen)3);
00463                 if (nwise_bnd__ > errthresh) {
00464                     tstrat[0] = 1 / (eps * 2.);
00465                 } else {
00466                     if (nwise_bnd__ != 0.) {
00467                         tstrat[0] = nwise_err__ / nwise_bnd__;
00468                     } else if (nwise_err__ != 0.) {
00469                         tstrat[0] = 1 / (eps * 16.f);
00470                     } else {
00471                         tstrat[0] = 0.;
00472                     }
00473                     if (tstrat[0] > 1.) {
00474                         tstrat[0] = 1 / (eps * 4.);
00475                     }
00476                 }
00477             } else {
00478                 s_copy(nguar, "NO", (ftnlen)3, (ftnlen)2);
00479                 if (nwise_bnd__ < 1.) {
00480                     tstrat[0] = 1 / (eps * 8.);
00481                 } else {
00482                     tstrat[0] = 1.;
00483                 }
00484             }
00485 /*            write (*,*) 'cwise : ', n, k, ccond, cwise_rcond, */
00486 /*     $           condthresh, ccond.ge.condthresh */
00487 /*            write (*,*) 'cwise2: ', k, cwise_bnd, cwise_err, errthresh */
00488             if (ccond >= condthresh) {
00489                 s_copy(cguar, "YES", (ftnlen)3, (ftnlen)3);
00490                 if (cwise_bnd__ > errthresh) {
00491                     tstrat[1] = 1 / (eps * 2.);
00492                 } else {
00493                     if (cwise_bnd__ != 0.) {
00494                         tstrat[1] = cwise_err__ / cwise_bnd__;
00495                     } else if (cwise_err__ != 0.) {
00496                         tstrat[1] = 1 / (eps * 16.);
00497                     } else {
00498                         tstrat[1] = 0.;
00499                     }
00500                     if (tstrat[1] > 1.) {
00501                         tstrat[1] = 1 / (eps * 4.);
00502                     }
00503                 }
00504             } else {
00505                 s_copy(cguar, "NO", (ftnlen)3, (ftnlen)2);
00506                 if (cwise_bnd__ < 1.) {
00507                     tstrat[1] = 1 / (eps * 8.);
00508                 } else {
00509                     tstrat[1] = 1.;
00510                 }
00511             }
00512 /*     Backwards error test */
00513             tstrat[2] = berr[k - 1] / eps;
00514 /*     Condition number tests */
00515             tstrat[3] = rcond / orcond;
00516             if (rcond >= condthresh && tstrat[3] < 1.) {
00517                 tstrat[3] = 1. / tstrat[3];
00518             }
00519             tstrat[4] = ncond / nwise_rcond__;
00520             if (ncond >= condthresh && tstrat[4] < 1.) {
00521                 tstrat[4] = 1. / tstrat[4];
00522             }
00523             tstrat[5] = ccond / nwise_rcond__;
00524             if (ccond >= condthresh && tstrat[5] < 1.) {
00525                 tstrat[5] = 1. / tstrat[5];
00526             }
00527             for (i__ = 1; i__ <= 6; ++i__) {
00528                 if (tstrat[i__ - 1] > *thresh) {
00529                     if (! printed_guide__) {
00530                         s_wsle(&io___66);
00531                         e_wsle();
00532                         s_wsfe(&io___67);
00533                         do_fio(&c__1, (char *)&c__1, (ftnlen)sizeof(integer));
00534                         e_wsfe();
00535                         s_wsfe(&io___68);
00536                         do_fio(&c__1, (char *)&c__2, (ftnlen)sizeof(integer));
00537                         e_wsfe();
00538                         s_wsfe(&io___69);
00539                         do_fio(&c__1, (char *)&c__3, (ftnlen)sizeof(integer));
00540                         e_wsfe();
00541                         s_wsfe(&io___70);
00542                         do_fio(&c__1, (char *)&c__4, (ftnlen)sizeof(integer));
00543                         e_wsfe();
00544                         s_wsfe(&io___71);
00545                         do_fio(&c__1, (char *)&c__5, (ftnlen)sizeof(integer));
00546                         e_wsfe();
00547                         s_wsfe(&io___72);
00548                         do_fio(&c__1, (char *)&c__6, (ftnlen)sizeof(integer));
00549                         e_wsfe();
00550                         s_wsfe(&io___73);
00551                         do_fio(&c__1, (char *)&c__7, (ftnlen)sizeof(integer));
00552                         e_wsfe();
00553                         s_wsfe(&io___74);
00554                         do_fio(&c__1, (char *)&c__8, (ftnlen)sizeof(integer));
00555                         e_wsfe();
00556                         s_wsle(&io___75);
00557                         e_wsle();
00558                         printed_guide__ = TRUE_;
00559                     }
00560                     s_wsfe(&io___76);
00561                     do_fio(&c__1, c2, (ftnlen)2);
00562                     do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00563                     do_fio(&c__1, (char *)&k, (ftnlen)sizeof(integer));
00564                     do_fio(&c__1, nguar, (ftnlen)3);
00565                     do_fio(&c__1, cguar, (ftnlen)3);
00566                     do_fio(&c__1, (char *)&i__, (ftnlen)sizeof(integer));
00567                     do_fio(&c__1, (char *)&tstrat[i__ - 1], (ftnlen)sizeof(
00568                             doublereal));
00569                     e_wsfe();
00570                     ++nfail;
00571                 }
00572             }
00573         }
00574 /* $$$         WRITE(*,*) */
00575 /* $$$         WRITE(*,*) 'Normwise Error Bounds' */
00576 /* $$$         WRITE(*,*) 'Guaranteed error bound: ',ERRBND(NRHS,nwise_i,bnd_i) */
00577 /* $$$         WRITE(*,*) 'Reciprocal condition number: ',ERRBND(NRHS,nwise_i,cond_i) */
00578 /* $$$         WRITE(*,*) 'Raw error estimate: ',ERRBND(NRHS,nwise_i,rawbnd_i) */
00579 /* $$$         WRITE(*,*) */
00580 /* $$$         WRITE(*,*) 'Componentwise Error Bounds' */
00581 /* $$$         WRITE(*,*) 'Guaranteed error bound: ',ERRBND(NRHS,cwise_i,bnd_i) */
00582 /* $$$         WRITE(*,*) 'Reciprocal condition number: ',ERRBND(NRHS,cwise_i,cond_i) */
00583 /* $$$         WRITE(*,*) 'Raw error estimate: ',ERRBND(NRHS,cwise_i,rawbnd_i) */
00584 /* $$$         print *, 'Info: ', info */
00585 /* $$$         WRITE(*,*) */
00586 /*         WRITE(*,*) 'TSTRAT: ',TSTRAT */
00587     }
00588     s_wsle(&io___77);
00589     e_wsle();
00590     if (nfail > 0) {
00591         s_wsfe(&io___78);
00592         do_fio(&c__1, c2, (ftnlen)2);
00593         do_fio(&c__1, (char *)&nfail, (ftnlen)sizeof(integer));
00594         i__1 = n * 6 + n_aux_tests__;
00595         do_fio(&c__1, (char *)&i__1, (ftnlen)sizeof(integer));
00596         e_wsfe();
00597     } else {
00598         s_wsfe(&io___79);
00599         do_fio(&c__1, c2, (ftnlen)2);
00600         e_wsfe();
00601     }
00602 /*     Test ratios. */
00603     return 0;
00604 } /* debchvxx_ */


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