sget32.c
Go to the documentation of this file.
00001 /* sget32.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__2 = 2;
00019 
00020 /* Subroutine */ int sget32_(real *rmax, integer *lmax, integer *ninfo, 
00021         integer *knt)
00022 {
00023     /* Initialized data */
00024 
00025     static integer itval[32]    /* was [2][2][8] */ = { 8,4,2,1,4,8,1,2,2,1,8,
00026             4,1,2,4,8,9,4,2,1,4,9,1,2,2,1,9,4,1,2,4,9 };
00027 
00028     /* System generated locals */
00029     real r__1, r__2;
00030 
00031     /* Builtin functions */
00032     double sqrt(doublereal);
00033 
00034     /* Local variables */
00035     real b[4]   /* was [2][2] */, x[4]  /* was [2][2] */;
00036     integer n1, n2, ib;
00037     real tl[4]  /* was [2][2] */, tr[4] /* was [2][2] */;
00038     integer ib1, ib2, ib3;
00039     real den, val[3], eps;
00040     integer itl;
00041     real res, sgn;
00042     integer itr;
00043     real tmp;
00044     integer info, isgn;
00045     real tnrm, xnrm, scale, xnorm;
00046     extern /* Subroutine */ int slasy2_(logical *, logical *, integer *, 
00047             integer *, integer *, real *, integer *, real *, integer *, real *
00048 , integer *, real *, real *, integer *, real *, integer *), 
00049             slabad_(real *, real *);
00050     extern doublereal slamch_(char *);
00051     real bignum;
00052     integer itranl, itlscl;
00053     logical ltranl;
00054     integer itranr, itrscl;
00055     logical ltranr;
00056     real smlnum;
00057 
00058 
00059 /*  -- LAPACK test routine (version 3.1) -- */
00060 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00061 /*     November 2006 */
00062 
00063 /*     .. Scalar Arguments .. */
00064 /*     .. */
00065 
00066 /*  Purpose */
00067 /*  ======= */
00068 
00069 /*  SGET32 tests SLASY2, a routine for solving */
00070 
00071 /*          op(TL)*X + ISGN*X*op(TR) = SCALE*B */
00072 
00073 /*  where TL is N1 by N1, TR is N2 by N2, and N1,N2 =1 or 2 only. */
00074 /*  X and B are N1 by N2, op() is an optional transpose, an */
00075 /*  ISGN = 1 or -1. SCALE is chosen less than or equal to 1 to */
00076 /*  avoid overflow in X. */
00077 
00078 /*  The test condition is that the scaled residual */
00079 
00080 /*  norm( op(TL)*X + ISGN*X*op(TR) = SCALE*B ) */
00081 /*       / ( max( ulp*norm(TL), ulp*norm(TR)) * norm(X), SMLNUM ) */
00082 
00083 /*  should be on the order of 1. Here, ulp is the machine precision. */
00084 /*  Also, it is verified that SCALE is less than or equal to 1, and */
00085 /*  that XNORM = infinity-norm(X). */
00086 
00087 /*  Arguments */
00088 /*  ========== */
00089 
00090 /*  RMAX    (output) REAL */
00091 /*          Value of the largest test ratio. */
00092 
00093 /*  LMAX    (output) INTEGER */
00094 /*          Example number where largest test ratio achieved. */
00095 
00096 /*  NINFO   (output) INTEGER */
00097 /*          Number of examples returned with INFO.NE.0. */
00098 
00099 /*  KNT     (output) INTEGER */
00100 /*          Total number of examples tested. */
00101 
00102 /*  ===================================================================== */
00103 
00104 /*     .. Parameters .. */
00105 /*     .. */
00106 /*     .. Local Scalars .. */
00107 /*     .. */
00108 /*     .. Local Arrays .. */
00109 /*     .. */
00110 /*     .. External Functions .. */
00111 /*     .. */
00112 /*     .. External Subroutines .. */
00113 /*     .. */
00114 /*     .. Intrinsic Functions .. */
00115 /*     .. */
00116 /*     .. Data statements .. */
00117 /*     .. */
00118 /*     .. Executable Statements .. */
00119 
00120 /*     Get machine parameters */
00121 
00122     eps = slamch_("P");
00123     smlnum = slamch_("S") / eps;
00124     bignum = 1.f / smlnum;
00125     slabad_(&smlnum, &bignum);
00126 
00127 /*     Set up test case parameters */
00128 
00129     val[0] = sqrt(smlnum);
00130     val[1] = 1.f;
00131     val[2] = sqrt(bignum);
00132 
00133     *knt = 0;
00134     *ninfo = 0;
00135     *lmax = 0;
00136     *rmax = 0.f;
00137 
00138 /*     Begin test loop */
00139 
00140     for (itranl = 0; itranl <= 1; ++itranl) {
00141         for (itranr = 0; itranr <= 1; ++itranr) {
00142             for (isgn = -1; isgn <= 1; isgn += 2) {
00143                 sgn = (real) isgn;
00144                 ltranl = itranl == 1;
00145                 ltranr = itranr == 1;
00146 
00147                 n1 = 1;
00148                 n2 = 1;
00149                 for (itl = 1; itl <= 3; ++itl) {
00150                     for (itr = 1; itr <= 3; ++itr) {
00151                         for (ib = 1; ib <= 3; ++ib) {
00152                             tl[0] = val[itl - 1];
00153                             tr[0] = val[itr - 1];
00154                             b[0] = val[ib - 1];
00155                             ++(*knt);
00156                             slasy2_(&ltranl, &ltranr, &isgn, &n1, &n2, tl, &
00157                                     c__2, tr, &c__2, b, &c__2, &scale, x, &
00158                                     c__2, &xnorm, &info);
00159                             if (info != 0) {
00160                                 ++(*ninfo);
00161                             }
00162                             res = (r__1 = (tl[0] + sgn * tr[0]) * x[0] - 
00163                                     scale * b[0], dabs(r__1));
00164                             if (info == 0) {
00165 /* Computing MAX */
00166                                 r__1 = eps * ((dabs(tr[0]) + dabs(tl[0])) * 
00167                                         dabs(x[0]));
00168                                 den = dmax(r__1,smlnum);
00169                             } else {
00170 /* Computing MAX */
00171                                 r__1 = dabs(x[0]);
00172                                 den = smlnum * dmax(r__1,1.f);
00173                             }
00174                             res /= den;
00175                             if (scale > 1.f) {
00176                                 res += 1.f / eps;
00177                             }
00178                             res += (r__1 = xnorm - dabs(x[0]), dabs(r__1)) / 
00179                                     dmax(smlnum,xnorm) / eps;
00180                             if (info != 0 && info != 1) {
00181                                 res += 1.f / eps;
00182                             }
00183                             if (res > *rmax) {
00184                                 *lmax = *knt;
00185                                 *rmax = res;
00186                             }
00187 /* L10: */
00188                         }
00189 /* L20: */
00190                     }
00191 /* L30: */
00192                 }
00193 
00194                 n1 = 2;
00195                 n2 = 1;
00196                 for (itl = 1; itl <= 8; ++itl) {
00197                     for (itlscl = 1; itlscl <= 3; ++itlscl) {
00198                         for (itr = 1; itr <= 3; ++itr) {
00199                             for (ib1 = 1; ib1 <= 3; ++ib1) {
00200                                 for (ib2 = 1; ib2 <= 3; ++ib2) {
00201                                     b[0] = val[ib1 - 1];
00202                                     b[1] = val[ib2 - 1] * -4.f;
00203                                     tl[0] = itval[((itl << 1) + 1 << 1) - 6] *
00204                                              val[itlscl - 1];
00205                                     tl[1] = itval[((itl << 1) + 1 << 1) - 5] *
00206                                              val[itlscl - 1];
00207                                     tl[2] = itval[((itl << 1) + 2 << 1) - 6] *
00208                                              val[itlscl - 1];
00209                                     tl[3] = itval[((itl << 1) + 2 << 1) - 5] *
00210                                              val[itlscl - 1];
00211                                     tr[0] = val[itr - 1];
00212                                     ++(*knt);
00213                                     slasy2_(&ltranl, &ltranr, &isgn, &n1, &n2, 
00214                                              tl, &c__2, tr, &c__2, b, &c__2, &
00215                                             scale, x, &c__2, &xnorm, &info);
00216                                     if (info != 0) {
00217                                         ++(*ninfo);
00218                                     }
00219                                     if (ltranl) {
00220                                         tmp = tl[2];
00221                                         tl[2] = tl[1];
00222                                         tl[1] = tmp;
00223                                     }
00224                                     res = (r__1 = (tl[0] + sgn * tr[0]) * x[0]
00225                                              + tl[2] * x[1] - scale * b[0], 
00226                                             dabs(r__1));
00227                                     res += (r__1 = (tl[3] + sgn * tr[0]) * x[
00228                                             1] + tl[1] * x[0] - scale * b[1], 
00229                                             dabs(r__1));
00230                                     tnrm = dabs(tr[0]) + dabs(tl[0]) + dabs(
00231                                             tl[2]) + dabs(tl[1]) + dabs(tl[3])
00232                                             ;
00233 /* Computing MAX */
00234                                     r__1 = dabs(x[0]), r__2 = dabs(x[1]);
00235                                     xnrm = dmax(r__1,r__2);
00236 /* Computing MAX */
00237                                     r__1 = smlnum, r__2 = smlnum * xnrm, r__1 
00238                                             = max(r__1,r__2), r__2 = tnrm * 
00239                                             eps * xnrm;
00240                                     den = dmax(r__1,r__2);
00241                                     res /= den;
00242                                     if (scale > 1.f) {
00243                                         res += 1.f / eps;
00244                                     }
00245                                     res += (r__1 = xnorm - xnrm, dabs(r__1)) /
00246                                              dmax(smlnum,xnorm) / eps;
00247                                     if (res > *rmax) {
00248                                         *lmax = *knt;
00249                                         *rmax = res;
00250                                     }
00251 /* L40: */
00252                                 }
00253 /* L50: */
00254                             }
00255 /* L60: */
00256                         }
00257 /* L70: */
00258                     }
00259 /* L80: */
00260                 }
00261 
00262                 n1 = 1;
00263                 n2 = 2;
00264                 for (itr = 1; itr <= 8; ++itr) {
00265                     for (itrscl = 1; itrscl <= 3; ++itrscl) {
00266                         for (itl = 1; itl <= 3; ++itl) {
00267                             for (ib1 = 1; ib1 <= 3; ++ib1) {
00268                                 for (ib2 = 1; ib2 <= 3; ++ib2) {
00269                                     b[0] = val[ib1 - 1];
00270                                     b[2] = val[ib2 - 1] * -2.f;
00271                                     tr[0] = itval[((itr << 1) + 1 << 1) - 6] *
00272                                              val[itrscl - 1];
00273                                     tr[1] = itval[((itr << 1) + 1 << 1) - 5] *
00274                                              val[itrscl - 1];
00275                                     tr[2] = itval[((itr << 1) + 2 << 1) - 6] *
00276                                              val[itrscl - 1];
00277                                     tr[3] = itval[((itr << 1) + 2 << 1) - 5] *
00278                                              val[itrscl - 1];
00279                                     tl[0] = val[itl - 1];
00280                                     ++(*knt);
00281                                     slasy2_(&ltranl, &ltranr, &isgn, &n1, &n2, 
00282                                              tl, &c__2, tr, &c__2, b, &c__2, &
00283                                             scale, x, &c__2, &xnorm, &info);
00284                                     if (info != 0) {
00285                                         ++(*ninfo);
00286                                     }
00287                                     if (ltranr) {
00288                                         tmp = tr[2];
00289                                         tr[2] = tr[1];
00290                                         tr[1] = tmp;
00291                                     }
00292                                     tnrm = dabs(tl[0]) + dabs(tr[0]) + dabs(
00293                                             tr[2]) + dabs(tr[3]) + dabs(tr[1])
00294                                             ;
00295                                     xnrm = dabs(x[0]) + dabs(x[2]);
00296                                     res = (r__1 = (tl[0] + sgn * tr[0]) * x[0]
00297                                              + sgn * tr[1] * x[2] - scale * b[
00298                                             0], dabs(r__1));
00299                                     res += (r__1 = (tl[0] + sgn * tr[3]) * x[
00300                                             2] + sgn * tr[2] * x[0] - scale * 
00301                                             b[2], dabs(r__1));
00302 /* Computing MAX */
00303                                     r__1 = smlnum, r__2 = smlnum * xnrm, r__1 
00304                                             = max(r__1,r__2), r__2 = tnrm * 
00305                                             eps * xnrm;
00306                                     den = dmax(r__1,r__2);
00307                                     res /= den;
00308                                     if (scale > 1.f) {
00309                                         res += 1.f / eps;
00310                                     }
00311                                     res += (r__1 = xnorm - xnrm, dabs(r__1)) /
00312                                              dmax(smlnum,xnorm) / eps;
00313                                     if (res > *rmax) {
00314                                         *lmax = *knt;
00315                                         *rmax = res;
00316                                     }
00317 /* L90: */
00318                                 }
00319 /* L100: */
00320                             }
00321 /* L110: */
00322                         }
00323 /* L120: */
00324                     }
00325 /* L130: */
00326                 }
00327 
00328                 n1 = 2;
00329                 n2 = 2;
00330                 for (itr = 1; itr <= 8; ++itr) {
00331                     for (itrscl = 1; itrscl <= 3; ++itrscl) {
00332                         for (itl = 1; itl <= 8; ++itl) {
00333                             for (itlscl = 1; itlscl <= 3; ++itlscl) {
00334                                 for (ib1 = 1; ib1 <= 3; ++ib1) {
00335                                     for (ib2 = 1; ib2 <= 3; ++ib2) {
00336                                         for (ib3 = 1; ib3 <= 3; ++ib3) {
00337                                             b[0] = val[ib1 - 1];
00338                                             b[1] = val[ib2 - 1] * -4.f;
00339                                             b[2] = val[ib3 - 1] * -2.f;
00340 /* Computing MIN */
00341                                             r__1 = val[ib1 - 1], r__2 = val[
00342                                                     ib2 - 1], r__1 = min(r__1,
00343                                                     r__2), r__2 = val[ib3 - 1]
00344                                                     ;
00345                                             b[3] = dmin(r__1,r__2) * 8.f;
00346                                             tr[0] = itval[((itr << 1) + 1 << 
00347                                                     1) - 6] * val[itrscl - 1];
00348                                             tr[1] = itval[((itr << 1) + 1 << 
00349                                                     1) - 5] * val[itrscl - 1];
00350                                             tr[2] = itval[((itr << 1) + 2 << 
00351                                                     1) - 6] * val[itrscl - 1];
00352                                             tr[3] = itval[((itr << 1) + 2 << 
00353                                                     1) - 5] * val[itrscl - 1];
00354                                             tl[0] = itval[((itl << 1) + 1 << 
00355                                                     1) - 6] * val[itlscl - 1];
00356                                             tl[1] = itval[((itl << 1) + 1 << 
00357                                                     1) - 5] * val[itlscl - 1];
00358                                             tl[2] = itval[((itl << 1) + 2 << 
00359                                                     1) - 6] * val[itlscl - 1];
00360                                             tl[3] = itval[((itl << 1) + 2 << 
00361                                                     1) - 5] * val[itlscl - 1];
00362                                             ++(*knt);
00363                                             slasy2_(&ltranl, &ltranr, &isgn, &
00364                                                     n1, &n2, tl, &c__2, tr, &
00365                                                     c__2, b, &c__2, &scale, x, 
00366                                                      &c__2, &xnorm, &info);
00367                                             if (info != 0) {
00368                           ++(*ninfo);
00369                                             }
00370                                             if (ltranr) {
00371                           tmp = tr[2];
00372                           tr[2] = tr[1];
00373                           tr[1] = tmp;
00374                                             }
00375                                             if (ltranl) {
00376                           tmp = tl[2];
00377                           tl[2] = tl[1];
00378                           tl[1] = tmp;
00379                                             }
00380                                             tnrm = dabs(tr[0]) + dabs(tr[1]) 
00381                                                     + dabs(tr[2]) + dabs(tr[3]
00382                                                     ) + dabs(tl[0]) + dabs(tl[
00383                                                     1]) + dabs(tl[2]) + dabs(
00384                                                     tl[3]);
00385 /* Computing MAX */
00386                                             r__1 = dabs(x[0]) + dabs(x[2]), 
00387                                                     r__2 = dabs(x[1]) + dabs(
00388                                                     x[3]);
00389                                             xnrm = dmax(r__1,r__2);
00390                                             res = (r__1 = (tl[0] + sgn * tr[0]
00391                                                     ) * x[0] + sgn * tr[1] * 
00392                                                     x[2] + tl[2] * x[1] - 
00393                                                     scale * b[0], dabs(r__1));
00394                                             res += (r__1 = tl[0] * x[2] + sgn 
00395                                                     * tr[2] * x[0] + sgn * tr[
00396                                                     3] * x[2] + tl[2] * x[3] 
00397                                                     - scale * b[2], dabs(r__1)
00398                                                     );
00399                                             res += (r__1 = tl[1] * x[0] + sgn 
00400                                                     * tr[0] * x[1] + sgn * tr[
00401                                                     1] * x[3] + tl[3] * x[1] 
00402                                                     - scale * b[1], dabs(r__1)
00403                                                     );
00404                                             res += (r__1 = (tl[3] + sgn * tr[
00405                                                     3]) * x[3] + sgn * tr[2] *
00406                                                      x[1] + tl[1] * x[2] - 
00407                                                     scale * b[3], dabs(r__1));
00408 /* Computing MAX */
00409                                             r__1 = smlnum, r__2 = smlnum * 
00410                                                     xnrm, r__1 = max(r__1,
00411                                                     r__2), r__2 = tnrm * eps *
00412                                                      xnrm;
00413                                             den = dmax(r__1,r__2);
00414                                             res /= den;
00415                                             if (scale > 1.f) {
00416                           res += 1.f / eps;
00417                                             }
00418                                             res += (r__1 = xnorm - xnrm, dabs(
00419                                                     r__1)) / dmax(smlnum,
00420                                                     xnorm) / eps;
00421                                             if (res > *rmax) {
00422                           *lmax = *knt;
00423                           *rmax = res;
00424                                             }
00425 /* L140: */
00426                                         }
00427 /* L150: */
00428                                     }
00429 /* L160: */
00430                                 }
00431 /* L170: */
00432                             }
00433 /* L180: */
00434                         }
00435 /* L190: */
00436                     }
00437 /* L200: */
00438                 }
00439 /* L210: */
00440             }
00441 /* L220: */
00442         }
00443 /* L230: */
00444     }
00445 
00446     return 0;
00447 
00448 /*     End of SGET32 */
00449 
00450 } /* sget32_ */


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