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


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