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


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