sget39.c
Go to the documentation of this file.
00001 /* sget39.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__1 = 1;
00020 static logical c_false = FALSE_;
00021 static logical c_true = TRUE_;
00022 static real c_b25 = 1.f;
00023 static real c_b59 = -1.f;
00024 
00025 /* Subroutine */ int sget39_(real *rmax, integer *lmax, integer *ninfo, 
00026         integer *knt)
00027 {
00028     /* Initialized data */
00029 
00030     static integer idim[6] = { 4,5,5,5,5,5 };
00031     static integer ival[150]    /* was [5][5][6] */ = { 3,0,0,0,0,1,1,-1,0,0,
00032             3,2,1,0,0,4,3,2,2,0,0,0,0,0,0,1,0,0,0,0,2,2,0,0,0,3,3,4,0,0,4,2,2,
00033             3,0,1,1,1,1,5,1,0,0,0,0,2,4,-2,0,0,3,3,4,0,0,4,2,2,3,0,1,1,1,1,1,
00034             1,0,0,0,0,2,1,-1,0,0,9,8,1,0,0,4,9,1,2,-1,2,2,2,2,2,9,0,0,0,0,6,4,
00035             0,0,0,3,2,1,1,0,5,1,-1,1,0,2,2,2,2,2,4,0,0,0,0,2,2,0,0,0,1,4,4,0,
00036             0,2,4,2,2,-1,2,2,2,2,2 };
00037 
00038     /* System generated locals */
00039     integer i__1, i__2;
00040     real r__1, r__2;
00041 
00042     /* Builtin functions */
00043     double sqrt(doublereal), cos(doublereal), sin(doublereal);
00044 
00045     /* Local variables */
00046     real b[10], d__[20];
00047     integer i__, j, k, n;
00048     real t[100] /* was [10][10] */, w, x[20], y[20], vm1[5], vm2[5], vm3[5], 
00049             vm4[5], vm5[3], dum[1], eps;
00050     integer ivm1, ivm2, ivm3, ivm4, ivm5, ndim, info;
00051     real dumm;
00052     extern doublereal sdot_(integer *, real *, integer *, real *, integer *);
00053     real norm, work[10], scale, domin, resid;
00054     extern /* Subroutine */ int sgemv_(char *, integer *, integer *, real *, 
00055             real *, integer *, real *, integer *, real *, real *, integer *);
00056     extern doublereal sasum_(integer *, real *, integer *);
00057     extern /* Subroutine */ int scopy_(integer *, real *, integer *, real *, 
00058             integer *);
00059     real xnorm;
00060     extern /* Subroutine */ int slabad_(real *, real *);
00061     extern doublereal slamch_(char *), slange_(char *, integer *, 
00062             integer *, real *, integer *, real *);
00063     real bignum;
00064     extern integer isamax_(integer *, real *, integer *);
00065     real normtb;
00066     extern /* Subroutine */ int slaqtr_(logical *, logical *, integer *, real 
00067             *, integer *, real *, real *, real *, real *, real *, integer *);
00068     real smlnum;
00069 
00070 
00071 /*  -- LAPACK test routine (version 3.1) -- */
00072 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00073 /*     November 2006 */
00074 
00075 /*     .. Scalar Arguments .. */
00076 /*     .. */
00077 
00078 /*  Purpose */
00079 /*  ======= */
00080 
00081 /*  SGET39 tests SLAQTR, a routine for solving the real or */
00082 /*  special complex quasi upper triangular system */
00083 
00084 /*       op(T)*p = scale*c, */
00085 /*  or */
00086 /*       op(T + iB)*(p+iq) = scale*(c+id), */
00087 
00088 /*  in real arithmetic. T is upper quasi-triangular. */
00089 /*  If it is complex, then the first diagonal block of T must be */
00090 /*  1 by 1, B has the special structure */
00091 
00092 /*                 B = [ b(1) b(2) ... b(n) ] */
00093 /*                     [       w            ] */
00094 /*                     [           w        ] */
00095 /*                     [              .     ] */
00096 /*                     [                 w  ] */
00097 
00098 /*  op(A) = A or A', where A' denotes the conjugate transpose of */
00099 /*  the matrix A. */
00100 
00101 /*  On input, X = [ c ].  On output, X = [ p ]. */
00102 /*                [ d ]                  [ q ] */
00103 
00104 /*  Scale is an output less than or equal to 1, chosen to avoid */
00105 /*  overflow in X. */
00106 /*  This subroutine is specially designed for the condition number */
00107 /*  estimation in the eigenproblem routine STRSNA. */
00108 
00109 /*  The test code verifies that the following residual is order 1: */
00110 
00111 /*       ||(T+i*B)*(x1+i*x2) - scale*(d1+i*d2)|| */
00112 /*     ----------------------------------------- */
00113 /*         max(ulp*(||T||+||B||)*(||x1||+||x2||), */
00114 /*             (||T||+||B||)*smlnum/ulp, */
00115 /*             smlnum) */
00116 
00117 /*  (The (||T||+||B||)*smlnum/ulp term accounts for possible */
00118 /*   (gradual or nongradual) underflow in x1 and x2.) */
00119 
00120 /*  Arguments */
00121 /*  ========== */
00122 
00123 /*  RMAX    (output) REAL */
00124 /*          Value of the largest test ratio. */
00125 
00126 /*  LMAX    (output) INTEGER */
00127 /*          Example number where largest test ratio achieved. */
00128 
00129 /*  NINFO   (output) INTEGER */
00130 /*          Number of examples where INFO is nonzero. */
00131 
00132 /*  KNT     (output) INTEGER */
00133 /*          Total number of examples tested. */
00134 
00135 /*  ===================================================================== */
00136 
00137 /*     .. Parameters .. */
00138 /*     .. */
00139 /*     .. Local Scalars .. */
00140 /*     .. */
00141 /*     .. External Functions .. */
00142 /*     .. */
00143 /*     .. External Subroutines .. */
00144 /*     .. */
00145 /*     .. Intrinsic Functions .. */
00146 /*     .. */
00147 /*     .. Local Arrays .. */
00148 /*     .. */
00149 /*     .. Data statements .. */
00150 /*     .. */
00151 /*     .. Executable Statements .. */
00152 
00153 /*     Get machine parameters */
00154 
00155     eps = slamch_("P");
00156     smlnum = slamch_("S");
00157     bignum = 1.f / smlnum;
00158     slabad_(&smlnum, &bignum);
00159 
00160 /*     Set up test case parameters */
00161 
00162     vm1[0] = 1.f;
00163     vm1[1] = sqrt(smlnum);
00164     vm1[2] = sqrt(vm1[1]);
00165     vm1[3] = sqrt(bignum);
00166     vm1[4] = sqrt(vm1[3]);
00167 
00168     vm2[0] = 1.f;
00169     vm2[1] = sqrt(smlnum);
00170     vm2[2] = sqrt(vm2[1]);
00171     vm2[3] = sqrt(bignum);
00172     vm2[4] = sqrt(vm2[3]);
00173 
00174     vm3[0] = 1.f;
00175     vm3[1] = sqrt(smlnum);
00176     vm3[2] = sqrt(vm3[1]);
00177     vm3[3] = sqrt(bignum);
00178     vm3[4] = sqrt(vm3[3]);
00179 
00180     vm4[0] = 1.f;
00181     vm4[1] = sqrt(smlnum);
00182     vm4[2] = sqrt(vm4[1]);
00183     vm4[3] = sqrt(bignum);
00184     vm4[4] = sqrt(vm4[3]);
00185 
00186     vm5[0] = 1.f;
00187     vm5[1] = eps;
00188     vm5[2] = sqrt(smlnum);
00189 
00190 /*     Initalization */
00191 
00192     *knt = 0;
00193     *rmax = 0.f;
00194     *ninfo = 0;
00195     smlnum /= eps;
00196 
00197 /*     Begin test loop */
00198 
00199     for (ivm5 = 1; ivm5 <= 3; ++ivm5) {
00200         for (ivm4 = 1; ivm4 <= 5; ++ivm4) {
00201             for (ivm3 = 1; ivm3 <= 5; ++ivm3) {
00202                 for (ivm2 = 1; ivm2 <= 5; ++ivm2) {
00203                     for (ivm1 = 1; ivm1 <= 5; ++ivm1) {
00204                         for (ndim = 1; ndim <= 6; ++ndim) {
00205 
00206                             n = idim[ndim - 1];
00207                             i__1 = n;
00208                             for (i__ = 1; i__ <= i__1; ++i__) {
00209                                 i__2 = n;
00210                                 for (j = 1; j <= i__2; ++j) {
00211                                     t[i__ + j * 10 - 11] = (real) ival[i__ + (
00212                                             j + ndim * 5) * 5 - 31] * vm1[
00213                                             ivm1 - 1];
00214                                     if (i__ >= j) {
00215                                         t[i__ + j * 10 - 11] *= vm5[ivm5 - 1];
00216                                     }
00217 /* L10: */
00218                                 }
00219 /* L20: */
00220                             }
00221 
00222                             w = vm2[ivm2 - 1] * 1.f;
00223 
00224                             i__1 = n;
00225                             for (i__ = 1; i__ <= i__1; ++i__) {
00226                                 b[i__ - 1] = cos((real) i__) * vm3[ivm3 - 1];
00227 /* L30: */
00228                             }
00229 
00230                             i__1 = n << 1;
00231                             for (i__ = 1; i__ <= i__1; ++i__) {
00232                                 d__[i__ - 1] = sin((real) i__) * vm4[ivm4 - 1]
00233                                         ;
00234 /* L40: */
00235                             }
00236 
00237                             norm = slange_("1", &n, &n, t, &c__10, work);
00238                             k = isamax_(&n, b, &c__1);
00239                             normtb = norm + (r__1 = b[k - 1], dabs(r__1)) + 
00240                                     dabs(w);
00241 
00242                             scopy_(&n, d__, &c__1, x, &c__1);
00243                             ++(*knt);
00244                             slaqtr_(&c_false, &c_true, &n, t, &c__10, dum, &
00245                                     dumm, &scale, x, work, &info);
00246                             if (info != 0) {
00247                                 ++(*ninfo);
00248                             }
00249 
00250 /*                       || T*x - scale*d || / */
00251 /*                         max(ulp*||T||*||x||,smlnum/ulp*||T||,smlnum) */
00252 
00253                             scopy_(&n, d__, &c__1, y, &c__1);
00254                             r__1 = -scale;
00255                             sgemv_("No transpose", &n, &n, &c_b25, t, &c__10, 
00256                                     x, &c__1, &r__1, y, &c__1);
00257                             xnorm = sasum_(&n, x, &c__1);
00258                             resid = sasum_(&n, y, &c__1);
00259 /* Computing MAX */
00260                             r__1 = smlnum, r__2 = smlnum / eps * norm, r__1 = 
00261                                     max(r__1,r__2), r__2 = norm * eps * xnorm;
00262                             domin = dmax(r__1,r__2);
00263                             resid /= domin;
00264                             if (resid > *rmax) {
00265                                 *rmax = resid;
00266                                 *lmax = *knt;
00267                             }
00268 
00269                             scopy_(&n, d__, &c__1, x, &c__1);
00270                             ++(*knt);
00271                             slaqtr_(&c_true, &c_true, &n, t, &c__10, dum, &
00272                                     dumm, &scale, x, work, &info);
00273                             if (info != 0) {
00274                                 ++(*ninfo);
00275                             }
00276 
00277 /*                       || T*x - scale*d || / */
00278 /*                         max(ulp*||T||*||x||,smlnum/ulp*||T||,smlnum) */
00279 
00280                             scopy_(&n, d__, &c__1, y, &c__1);
00281                             r__1 = -scale;
00282                             sgemv_("Transpose", &n, &n, &c_b25, t, &c__10, x, 
00283                                     &c__1, &r__1, y, &c__1);
00284                             xnorm = sasum_(&n, x, &c__1);
00285                             resid = sasum_(&n, y, &c__1);
00286 /* Computing MAX */
00287                             r__1 = smlnum, r__2 = smlnum / eps * norm, r__1 = 
00288                                     max(r__1,r__2), r__2 = norm * eps * xnorm;
00289                             domin = dmax(r__1,r__2);
00290                             resid /= domin;
00291                             if (resid > *rmax) {
00292                                 *rmax = resid;
00293                                 *lmax = *knt;
00294                             }
00295 
00296                             i__1 = n << 1;
00297                             scopy_(&i__1, d__, &c__1, x, &c__1);
00298                             ++(*knt);
00299                             slaqtr_(&c_false, &c_false, &n, t, &c__10, b, &w, 
00300                                     &scale, x, work, &info);
00301                             if (info != 0) {
00302                                 ++(*ninfo);
00303                             }
00304 
00305 /*                       ||(T+i*B)*(x1+i*x2) - scale*(d1+i*d2)|| / */
00306 /*                          max(ulp*(||T||+||B||)*(||x1||+||x2||), */
00307 /*                                  smlnum/ulp * (||T||+||B||), smlnum ) */
00308 
00309 
00310                             i__1 = n << 1;
00311                             scopy_(&i__1, d__, &c__1, y, &c__1);
00312                             y[0] = sdot_(&n, b, &c__1, &x[n], &c__1) + scale *
00313                                      y[0];
00314                             i__1 = n;
00315                             for (i__ = 2; i__ <= i__1; ++i__) {
00316                                 y[i__ - 1] = w * x[i__ + n - 1] + scale * y[
00317                                         i__ - 1];
00318 /* L50: */
00319                             }
00320                             sgemv_("No transpose", &n, &n, &c_b25, t, &c__10, 
00321                                     x, &c__1, &c_b59, y, &c__1);
00322 
00323                             y[n] = sdot_(&n, b, &c__1, x, &c__1) - scale * y[
00324                                     n];
00325                             i__1 = n;
00326                             for (i__ = 2; i__ <= i__1; ++i__) {
00327                                 y[i__ + n - 1] = w * x[i__ - 1] - scale * y[
00328                                         i__ + n - 1];
00329 /* L60: */
00330                             }
00331                             sgemv_("No transpose", &n, &n, &c_b25, t, &c__10, 
00332                                     &x[n], &c__1, &c_b25, &y[n], &c__1);
00333 
00334                             i__1 = n << 1;
00335                             resid = sasum_(&i__1, y, &c__1);
00336 /* Computing MAX */
00337                             i__1 = n << 1;
00338                             r__1 = smlnum, r__2 = smlnum / eps * normtb, r__1 
00339                                     = max(r__1,r__2), r__2 = eps * (normtb * 
00340                                     sasum_(&i__1, x, &c__1));
00341                             domin = dmax(r__1,r__2);
00342                             resid /= domin;
00343                             if (resid > *rmax) {
00344                                 *rmax = resid;
00345                                 *lmax = *knt;
00346                             }
00347 
00348                             i__1 = n << 1;
00349                             scopy_(&i__1, d__, &c__1, x, &c__1);
00350                             ++(*knt);
00351                             slaqtr_(&c_true, &c_false, &n, t, &c__10, b, &w, &
00352                                     scale, x, work, &info);
00353                             if (info != 0) {
00354                                 ++(*ninfo);
00355                             }
00356 
00357 /*                       ||(T+i*B)*(x1+i*x2) - scale*(d1+i*d2)|| / */
00358 /*                          max(ulp*(||T||+||B||)*(||x1||+||x2||), */
00359 /*                                  smlnum/ulp * (||T||+||B||), smlnum ) */
00360 
00361                             i__1 = n << 1;
00362                             scopy_(&i__1, d__, &c__1, y, &c__1);
00363                             y[0] = b[0] * x[n] - scale * y[0];
00364                             i__1 = n;
00365                             for (i__ = 2; i__ <= i__1; ++i__) {
00366                                 y[i__ - 1] = b[i__ - 1] * x[n] + w * x[i__ + 
00367                                         n - 1] - scale * y[i__ - 1];
00368 /* L70: */
00369                             }
00370                             sgemv_("Transpose", &n, &n, &c_b25, t, &c__10, x, 
00371                                     &c__1, &c_b25, y, &c__1);
00372 
00373                             y[n] = b[0] * x[0] + scale * y[n];
00374                             i__1 = n;
00375                             for (i__ = 2; i__ <= i__1; ++i__) {
00376                                 y[i__ + n - 1] = b[i__ - 1] * x[0] + w * x[
00377                                         i__ - 1] + scale * y[i__ + n - 1];
00378 /* L80: */
00379                             }
00380                             sgemv_("Transpose", &n, &n, &c_b25, t, &c__10, &x[
00381                                     n], &c__1, &c_b59, &y[n], &c__1);
00382 
00383                             i__1 = n << 1;
00384                             resid = sasum_(&i__1, y, &c__1);
00385 /* Computing MAX */
00386                             i__1 = n << 1;
00387                             r__1 = smlnum, r__2 = smlnum / eps * normtb, r__1 
00388                                     = max(r__1,r__2), r__2 = eps * (normtb * 
00389                                     sasum_(&i__1, x, &c__1));
00390                             domin = dmax(r__1,r__2);
00391                             resid /= domin;
00392                             if (resid > *rmax) {
00393                                 *rmax = resid;
00394                                 *lmax = *knt;
00395                             }
00396 
00397 /* L90: */
00398                         }
00399 /* L100: */
00400                     }
00401 /* L110: */
00402                 }
00403 /* L120: */
00404             }
00405 /* L130: */
00406         }
00407 /* L140: */
00408     }
00409 
00410     return 0;
00411 
00412 /*     End of SGET39 */
00413 
00414 } /* sget39_ */


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