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


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