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


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