dget34.c
Go to the documentation of this file.
00001 /* dget34.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__16 = 16;
00019 static integer c__0 = 0;
00020 static integer c__1 = 1;
00021 static integer c__4 = 4;
00022 static integer c__5 = 5;
00023 static logical c_true = TRUE_;
00024 static integer c__2 = 2;
00025 static integer c__32 = 32;
00026 static integer c__3 = 3;
00027 static doublereal c_b64 = 1.;
00028 
00029 /* Subroutine */ int dget34_(doublereal *rmax, integer *lmax, integer *ninfo, 
00030         integer *knt)
00031 {
00032     /* System generated locals */
00033     doublereal d__1, d__2, d__3;
00034 
00035     /* Builtin functions */
00036     double sqrt(doublereal), d_sign(doublereal *, doublereal *);
00037 
00038     /* Local variables */
00039     integer i__, j;
00040     doublereal q[16]    /* was [4][4] */, t[16] /* was [4][4] */, t1[16]        
00041             /* was [4][4] */;
00042     integer ia, ib, ic;
00043     doublereal vm[2];
00044     integer ia11, ia12, ia21, ia22, ic11, ic12, ic21, ic22, iam, icm;
00045     doublereal val[9], eps, res;
00046     integer info;
00047     doublereal tnrm, work[32];
00048     extern /* Subroutine */ int dhst01_(integer *, integer *, integer *, 
00049             doublereal *, integer *, doublereal *, integer *, doublereal *, 
00050             integer *, doublereal *, integer *, doublereal *), dcopy_(integer 
00051             *, doublereal *, integer *, doublereal *, integer *), dlabad_(
00052             doublereal *, doublereal *);
00053     extern doublereal dlamch_(char *);
00054     extern /* Subroutine */ int dlaexc_(logical *, integer *, doublereal *, 
00055             integer *, doublereal *, integer *, integer *, integer *, integer 
00056             *, doublereal *, integer *);
00057     doublereal bignum, smlnum, result[2];
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 /*     .. Array Arguments .. */
00067 /*     .. */
00068 
00069 /*  Purpose */
00070 /*  ======= */
00071 
00072 /*  DGET34 tests DLAEXC, a routine for swapping adjacent blocks (either */
00073 /*  1 by 1 or 2 by 2) on the diagonal of a matrix in real Schur form. */
00074 /*  Thus, DLAEXC computes an orthogonal matrix Q such that */
00075 
00076 /*      Q' * [ A B ] * Q  = [ C1 B1 ] */
00077 /*           [ 0 C ]        [ 0  A1 ] */
00078 
00079 /*  where C1 is similar to C and A1 is similar to A.  Both A and C are */
00080 /*  assumed to be in standard form (equal diagonal entries and */
00081 /*  offdiagonal with differing signs) and A1 and C1 are returned with the */
00082 /*  same properties. */
00083 
00084 /*  The test code verifies these last last assertions, as well as that */
00085 /*  the residual in the above equation is small. */
00086 
00087 /*  Arguments */
00088 /*  ========== */
00089 
00090 /*  RMAX    (output) DOUBLE PRECISION */
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 array, dimension (2) */
00097 /*          NINFO(J) is the number of examples where INFO=J occurred. */
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 /*     .. Executable Statements .. */
00117 
00118 /*     Get machine parameters */
00119 
00120     /* Parameter adjustments */
00121     --ninfo;
00122 
00123     /* Function Body */
00124     eps = dlamch_("P");
00125     smlnum = dlamch_("S") / eps;
00126     bignum = 1. / smlnum;
00127     dlabad_(&smlnum, &bignum);
00128 
00129 /*     Set up test case parameters */
00130 
00131     val[0] = 0.;
00132     val[1] = sqrt(smlnum);
00133     val[2] = 1.;
00134     val[3] = 2.;
00135     val[4] = sqrt(bignum);
00136     val[5] = -sqrt(smlnum);
00137     val[6] = -1.;
00138     val[7] = -2.;
00139     val[8] = -sqrt(bignum);
00140     vm[0] = 1.;
00141     vm[1] = eps * 2. + 1.;
00142     dcopy_(&c__16, &val[3], &c__0, t, &c__1);
00143 
00144     ninfo[1] = 0;
00145     ninfo[2] = 0;
00146     *knt = 0;
00147     *lmax = 0;
00148     *rmax = 0.;
00149 
00150 /*     Begin test loop */
00151 
00152     for (ia = 1; ia <= 9; ++ia) {
00153         for (iam = 1; iam <= 2; ++iam) {
00154             for (ib = 1; ib <= 9; ++ib) {
00155                 for (ic = 1; ic <= 9; ++ic) {
00156                     t[0] = val[ia - 1] * vm[iam - 1];
00157                     t[5] = val[ic - 1];
00158                     t[4] = val[ib - 1];
00159                     t[1] = 0.;
00160 /* Computing MAX */
00161                     d__1 = abs(t[0]), d__2 = abs(t[5]), d__1 = max(d__1,d__2),
00162                              d__2 = abs(t[4]);
00163                     tnrm = max(d__1,d__2);
00164                     dcopy_(&c__16, t, &c__1, t1, &c__1);
00165                     dcopy_(&c__16, val, &c__0, q, &c__1);
00166                     dcopy_(&c__4, &val[2], &c__0, q, &c__5);
00167                     dlaexc_(&c_true, &c__2, t, &c__4, q, &c__4, &c__1, &c__1, 
00168                             &c__1, work, &info);
00169                     if (info != 0) {
00170                         ++ninfo[info];
00171                     }
00172                     dhst01_(&c__2, &c__1, &c__2, t1, &c__4, t, &c__4, q, &
00173                             c__4, work, &c__32, result);
00174                     res = result[0] + result[1];
00175                     if (info != 0) {
00176                         res += 1. / eps;
00177                     }
00178                     if (t[0] != t1[5]) {
00179                         res += 1. / eps;
00180                     }
00181                     if (t[5] != t1[0]) {
00182                         res += 1. / eps;
00183                     }
00184                     if (t[1] != 0.) {
00185                         res += 1. / eps;
00186                     }
00187                     ++(*knt);
00188                     if (res > *rmax) {
00189                         *lmax = *knt;
00190                         *rmax = res;
00191                     }
00192 /* L10: */
00193                 }
00194 /* L20: */
00195             }
00196 /* L30: */
00197         }
00198 /* L40: */
00199     }
00200 
00201     for (ia = 1; ia <= 5; ++ia) {
00202         for (iam = 1; iam <= 2; ++iam) {
00203             for (ib = 1; ib <= 5; ++ib) {
00204                 for (ic11 = 1; ic11 <= 5; ++ic11) {
00205                     for (ic12 = 2; ic12 <= 5; ++ic12) {
00206                         for (ic21 = 2; ic21 <= 4; ++ic21) {
00207                             for (ic22 = -1; ic22 <= 1; ic22 += 2) {
00208                                 t[0] = val[ia - 1] * vm[iam - 1];
00209                                 t[4] = val[ib - 1];
00210                                 t[8] = val[ib - 1] * -2.;
00211                                 t[1] = 0.;
00212                                 t[5] = val[ic11 - 1];
00213                                 t[9] = val[ic12 - 1];
00214                                 t[2] = 0.;
00215                                 t[6] = -val[ic21 - 1];
00216                                 t[10] = val[ic11 - 1] * (doublereal) ic22;
00217 /* Computing MAX */
00218                                 d__1 = abs(t[0]), d__2 = abs(t[4]), d__1 = 
00219                                         max(d__1,d__2), d__2 = abs(t[8]), 
00220                                         d__1 = max(d__1,d__2), d__2 = abs(t[5]
00221                                         ), d__1 = max(d__1,d__2), d__2 = abs(
00222                                         t[9]), d__1 = max(d__1,d__2), d__2 = 
00223                                         abs(t[6]), d__1 = max(d__1,d__2), 
00224                                         d__2 = abs(t[10]);
00225                                 tnrm = max(d__1,d__2);
00226                                 dcopy_(&c__16, t, &c__1, t1, &c__1);
00227                                 dcopy_(&c__16, val, &c__0, q, &c__1);
00228                                 dcopy_(&c__4, &val[2], &c__0, q, &c__5);
00229                                 dlaexc_(&c_true, &c__3, t, &c__4, q, &c__4, &
00230                                         c__1, &c__1, &c__2, work, &info);
00231                                 if (info != 0) {
00232                                     ++ninfo[info];
00233                                 }
00234                                 dhst01_(&c__3, &c__1, &c__3, t1, &c__4, t, &
00235                                         c__4, q, &c__4, work, &c__32, result);
00236                                 res = result[0] + result[1];
00237                                 if (info == 0) {
00238                                     if (t1[0] != t[10]) {
00239                                         res += 1. / eps;
00240                                     }
00241                                     if (t[2] != 0.) {
00242                                         res += 1. / eps;
00243                                     }
00244                                     if (t[6] != 0.) {
00245                                         res += 1. / eps;
00246                                     }
00247                                     if (t[1] != 0. && (t[0] != t[5] || d_sign(
00248                                             &c_b64, &t[4]) == d_sign(&c_b64, &
00249                                             t[1]))) {
00250                                         res += 1. / eps;
00251                                     }
00252                                 }
00253                                 ++(*knt);
00254                                 if (res > *rmax) {
00255                                     *lmax = *knt;
00256                                     *rmax = res;
00257                                 }
00258 /* L50: */
00259                             }
00260 /* L60: */
00261                         }
00262 /* L70: */
00263                     }
00264 /* L80: */
00265                 }
00266 /* L90: */
00267             }
00268 /* L100: */
00269         }
00270 /* L110: */
00271     }
00272 
00273     for (ia11 = 1; ia11 <= 5; ++ia11) {
00274         for (ia12 = 2; ia12 <= 5; ++ia12) {
00275             for (ia21 = 2; ia21 <= 4; ++ia21) {
00276                 for (ia22 = -1; ia22 <= 1; ia22 += 2) {
00277                     for (icm = 1; icm <= 2; ++icm) {
00278                         for (ib = 1; ib <= 5; ++ib) {
00279                             for (ic = 1; ic <= 5; ++ic) {
00280                                 t[0] = val[ia11 - 1];
00281                                 t[4] = val[ia12 - 1];
00282                                 t[8] = val[ib - 1] * -2.;
00283                                 t[1] = -val[ia21 - 1];
00284                                 t[5] = val[ia11 - 1] * (doublereal) ia22;
00285                                 t[9] = val[ib - 1];
00286                                 t[2] = 0.;
00287                                 t[6] = 0.;
00288                                 t[10] = val[ic - 1] * vm[icm - 1];
00289 /* Computing MAX */
00290                                 d__1 = abs(t[0]), d__2 = abs(t[4]), d__1 = 
00291                                         max(d__1,d__2), d__2 = abs(t[8]), 
00292                                         d__1 = max(d__1,d__2), d__2 = abs(t[5]
00293                                         ), d__1 = max(d__1,d__2), d__2 = abs(
00294                                         t[9]), d__1 = max(d__1,d__2), d__2 = 
00295                                         abs(t[6]), d__1 = max(d__1,d__2), 
00296                                         d__2 = abs(t[10]);
00297                                 tnrm = max(d__1,d__2);
00298                                 dcopy_(&c__16, t, &c__1, t1, &c__1);
00299                                 dcopy_(&c__16, val, &c__0, q, &c__1);
00300                                 dcopy_(&c__4, &val[2], &c__0, q, &c__5);
00301                                 dlaexc_(&c_true, &c__3, t, &c__4, q, &c__4, &
00302                                         c__1, &c__2, &c__1, work, &info);
00303                                 if (info != 0) {
00304                                     ++ninfo[info];
00305                                 }
00306                                 dhst01_(&c__3, &c__1, &c__3, t1, &c__4, t, &
00307                                         c__4, q, &c__4, work, &c__32, result);
00308                                 res = result[0] + result[1];
00309                                 if (info == 0) {
00310                                     if (t1[10] != t[0]) {
00311                                         res += 1. / eps;
00312                                     }
00313                                     if (t[1] != 0.) {
00314                                         res += 1. / eps;
00315                                     }
00316                                     if (t[2] != 0.) {
00317                                         res += 1. / eps;
00318                                     }
00319                                     if (t[6] != 0. && (t[5] != t[10] || 
00320                                             d_sign(&c_b64, &t[9]) == d_sign(&
00321                                             c_b64, &t[6]))) {
00322                                         res += 1. / eps;
00323                                     }
00324                                 }
00325                                 ++(*knt);
00326                                 if (res > *rmax) {
00327                                     *lmax = *knt;
00328                                     *rmax = res;
00329                                 }
00330 /* L120: */
00331                             }
00332 /* L130: */
00333                         }
00334 /* L140: */
00335                     }
00336 /* L150: */
00337                 }
00338 /* L160: */
00339             }
00340 /* L170: */
00341         }
00342 /* L180: */
00343     }
00344 
00345     for (ia11 = 1; ia11 <= 5; ++ia11) {
00346         for (ia12 = 2; ia12 <= 5; ++ia12) {
00347             for (ia21 = 2; ia21 <= 4; ++ia21) {
00348                 for (ia22 = -1; ia22 <= 1; ia22 += 2) {
00349                     for (ib = 1; ib <= 5; ++ib) {
00350                         for (ic11 = 3; ic11 <= 4; ++ic11) {
00351                             for (ic12 = 3; ic12 <= 4; ++ic12) {
00352                                 for (ic21 = 3; ic21 <= 4; ++ic21) {
00353                                     for (ic22 = -1; ic22 <= 1; ic22 += 2) {
00354                                         for (icm = 5; icm <= 7; ++icm) {
00355                                             iam = 1;
00356                                             t[0] = val[ia11 - 1] * vm[iam - 1]
00357                                                     ;
00358                                             t[4] = val[ia12 - 1] * vm[iam - 1]
00359                                                     ;
00360                                             t[8] = val[ib - 1] * -2.;
00361                                             t[12] = val[ib - 1] * .5;
00362                                             t[1] = -t[4] * val[ia21 - 1];
00363                                             t[5] = val[ia11 - 1] * (
00364                                                     doublereal) ia22 * vm[iam 
00365                                                     - 1];
00366                                             t[9] = val[ib - 1];
00367                                             t[13] = val[ib - 1] * 3.;
00368                                             t[2] = 0.;
00369                                             t[6] = 0.;
00370                                             t[10] = val[ic11 - 1] * (d__1 = 
00371                                                     val[icm - 1], abs(d__1));
00372                                             t[14] = val[ic12 - 1] * (d__1 = 
00373                                                     val[icm - 1], abs(d__1));
00374                                             t[3] = 0.;
00375                                             t[7] = 0.;
00376                                             t[11] = -t[14] * val[ic21 - 1] * (
00377                                                     d__1 = val[icm - 1], abs(
00378                                                     d__1));
00379                                             t[15] = val[ic11 - 1] * (
00380                                                     doublereal) ic22 * (d__1 =
00381                                                      val[icm - 1], abs(d__1));
00382                                             tnrm = 0.;
00383                                             for (i__ = 1; i__ <= 4; ++i__) {
00384                           for (j = 1; j <= 4; ++j) {
00385 /* Computing MAX */
00386                               d__2 = tnrm, d__3 = (d__1 = t[i__ + (j << 2) - 
00387                                       5], abs(d__1));
00388                               tnrm = max(d__2,d__3);
00389 /* L190: */
00390                           }
00391 /* L200: */
00392                                             }
00393                                             dcopy_(&c__16, t, &c__1, t1, &
00394                                                     c__1);
00395                                             dcopy_(&c__16, val, &c__0, q, &
00396                                                     c__1);
00397                                             dcopy_(&c__4, &val[2], &c__0, q, &
00398                                                     c__5);
00399                                             dlaexc_(&c_true, &c__4, t, &c__4, 
00400                                                     q, &c__4, &c__1, &c__2, &
00401                                                     c__2, work, &info);
00402                                             if (info != 0) {
00403                           ++ninfo[info];
00404                                             }
00405                                             dhst01_(&c__4, &c__1, &c__4, t1, &
00406                                                     c__4, t, &c__4, q, &c__4, 
00407                                                     work, &c__32, result);
00408                                             res = result[0] + result[1];
00409                                             if (info == 0) {
00410                           if (t[2] != 0.) {
00411                               res += 1. / eps;
00412                           }
00413                           if (t[3] != 0.) {
00414                               res += 1. / eps;
00415                           }
00416                           if (t[6] != 0.) {
00417                               res += 1. / eps;
00418                           }
00419                           if (t[7] != 0.) {
00420                               res += 1. / eps;
00421                           }
00422                           if (t[1] != 0. && (t[0] != t[5] || d_sign(&c_b64, &
00423                                   t[4]) == d_sign(&c_b64, &t[1]))) {
00424                               res += 1. / eps;
00425                           }
00426                           if (t[11] != 0. && (t[10] != t[15] || d_sign(&c_b64,
00427                                    &t[14]) == d_sign(&c_b64, &t[11]))) {
00428                               res += 1. / eps;
00429                           }
00430                                             }
00431                                             ++(*knt);
00432                                             if (res > *rmax) {
00433                           *lmax = *knt;
00434                           *rmax = res;
00435                                             }
00436 /* L210: */
00437                                         }
00438 /* L220: */
00439                                     }
00440 /* L230: */
00441                                 }
00442 /* L240: */
00443                             }
00444 /* L250: */
00445                         }
00446 /* L260: */
00447                     }
00448 /* L270: */
00449                 }
00450 /* L280: */
00451             }
00452 /* L290: */
00453         }
00454 /* L300: */
00455     }
00456 
00457     return 0;
00458 
00459 /*     End of DGET34 */
00460 
00461 } /* dget34_ */


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