dget33.c
Go to the documentation of this file.
00001 /* dget33.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 doublereal c_b19 = 1.;
00019 
00020 /* Subroutine */ int dget33_(doublereal *rmax, integer *lmax, integer *ninfo, 
00021         integer *knt)
00022 {
00023     /* System generated locals */
00024     doublereal d__1, d__2, d__3;
00025 
00026     /* Builtin functions */
00027     double d_sign(doublereal *, doublereal *);
00028 
00029     /* Local variables */
00030     doublereal q[4]     /* was [2][2] */, t[4]  /* was [2][2] */;
00031     integer i1, i2, i3, i4, j1, j2, j3;
00032     doublereal t1[4]    /* was [2][2] */, t2[4] /* was [2][2] */, cs, sn, vm[
00033             3];
00034     integer im1, im2, im3, im4;
00035     doublereal wi1, wi2, wr1, wr2, val[4], eps, res, sum, tnrm;
00036     extern /* Subroutine */ int dlanv2_(doublereal *, doublereal *, 
00037             doublereal *, doublereal *, doublereal *, doublereal *, 
00038             doublereal *, doublereal *, doublereal *, doublereal *), dlabad_(
00039             doublereal *, doublereal *);
00040     extern doublereal dlamch_(char *);
00041     doublereal bignum, smlnum;
00042 
00043 
00044 /*  -- LAPACK test routine (version 3.1) -- */
00045 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00046 /*     November 2006 */
00047 
00048 /*     .. Scalar Arguments .. */
00049 /*     .. */
00050 
00051 /*  Purpose */
00052 /*  ======= */
00053 
00054 /*  DGET33 tests DLANV2, a routine for putting 2 by 2 blocks into */
00055 /*  standard form.  In other words, it computes a two by two rotation */
00056 /*  [[C,S];[-S,C]] where in */
00057 
00058 /*     [ C S ][T(1,1) T(1,2)][ C -S ] = [ T11 T12 ] */
00059 /*     [-S C ][T(2,1) T(2,2)][ S  C ]   [ T21 T22 ] */
00060 
00061 /*  either */
00062 /*     1) T21=0 (real eigenvalues), or */
00063 /*     2) T11=T22 and T21*T12<0 (complex conjugate eigenvalues). */
00064 /*  We also  verify that the residual is small. */
00065 
00066 /*  Arguments */
00067 /*  ========== */
00068 
00069 /*  RMAX    (output) DOUBLE PRECISION */
00070 /*          Value of the largest test ratio. */
00071 
00072 /*  LMAX    (output) INTEGER */
00073 /*          Example number where largest test ratio achieved. */
00074 
00075 /*  NINFO   (output) INTEGER */
00076 /*          Number of examples returned with INFO .NE. 0. */
00077 
00078 /*  KNT     (output) INTEGER */
00079 /*          Total number of examples tested. */
00080 
00081 /*  ===================================================================== */
00082 
00083 /*     .. Parameters .. */
00084 /*     .. */
00085 /*     .. Local Scalars .. */
00086 /*     .. */
00087 /*     .. Local Arrays .. */
00088 /*     .. */
00089 /*     .. External Functions .. */
00090 /*     .. */
00091 /*     .. External Subroutines .. */
00092 /*     .. */
00093 /*     .. Intrinsic Functions .. */
00094 /*     .. */
00095 /*     .. Executable Statements .. */
00096 
00097 /*     Get machine parameters */
00098 
00099     eps = dlamch_("P");
00100     smlnum = dlamch_("S") / eps;
00101     bignum = 1. / smlnum;
00102     dlabad_(&smlnum, &bignum);
00103 
00104 /*     Set up test case parameters */
00105 
00106     val[0] = 1.;
00107     val[1] = eps * 2. + 1.;
00108     val[2] = 2.;
00109     val[3] = 2. - eps * 4.;
00110     vm[0] = smlnum;
00111     vm[1] = 1.;
00112     vm[2] = bignum;
00113 
00114     *knt = 0;
00115     *ninfo = 0;
00116     *lmax = 0;
00117     *rmax = 0.;
00118 
00119 /*     Begin test loop */
00120 
00121     for (i1 = 1; i1 <= 4; ++i1) {
00122         for (i2 = 1; i2 <= 4; ++i2) {
00123             for (i3 = 1; i3 <= 4; ++i3) {
00124                 for (i4 = 1; i4 <= 4; ++i4) {
00125                     for (im1 = 1; im1 <= 3; ++im1) {
00126                         for (im2 = 1; im2 <= 3; ++im2) {
00127                             for (im3 = 1; im3 <= 3; ++im3) {
00128                                 for (im4 = 1; im4 <= 3; ++im4) {
00129                                     t[0] = val[i1 - 1] * vm[im1 - 1];
00130                                     t[2] = val[i2 - 1] * vm[im2 - 1];
00131                                     t[1] = -val[i3 - 1] * vm[im3 - 1];
00132                                     t[3] = val[i4 - 1] * vm[im4 - 1];
00133 /* Computing MAX */
00134                                     d__1 = abs(t[0]), d__2 = abs(t[2]), d__1 =
00135                                              max(d__1,d__2), d__2 = abs(t[1]),
00136                                              d__1 = max(d__1,d__2), d__2 = 
00137                                             abs(t[3]);
00138                                     tnrm = max(d__1,d__2);
00139                                     t1[0] = t[0];
00140                                     t1[2] = t[2];
00141                                     t1[1] = t[1];
00142                                     t1[3] = t[3];
00143                                     q[0] = 1.;
00144                                     q[2] = 0.;
00145                                     q[1] = 0.;
00146                                     q[3] = 1.;
00147 
00148                                     dlanv2_(t, &t[2], &t[1], &t[3], &wr1, &
00149                                             wi1, &wr2, &wi2, &cs, &sn);
00150                                     for (j1 = 1; j1 <= 2; ++j1) {
00151                                         res = q[j1 - 1] * cs + q[j1 + 1] * sn;
00152                                         q[j1 + 1] = -q[j1 - 1] * sn + q[j1 + 
00153                                                 1] * cs;
00154                                         q[j1 - 1] = res;
00155 /* L10: */
00156                                     }
00157 
00158                                     res = 0.;
00159 /* Computing 2nd power */
00160                                     d__2 = q[0];
00161 /* Computing 2nd power */
00162                                     d__3 = q[2];
00163                                     res += (d__1 = d__2 * d__2 + d__3 * d__3 
00164                                             - 1., abs(d__1)) / eps;
00165 /* Computing 2nd power */
00166                                     d__2 = q[3];
00167 /* Computing 2nd power */
00168                                     d__3 = q[1];
00169                                     res += (d__1 = d__2 * d__2 + d__3 * d__3 
00170                                             - 1., abs(d__1)) / eps;
00171                                     res += (d__1 = q[0] * q[1] + q[2] * q[3], 
00172                                             abs(d__1)) / eps;
00173                                     for (j1 = 1; j1 <= 2; ++j1) {
00174                                         for (j2 = 1; j2 <= 2; ++j2) {
00175                                             t2[j1 + (j2 << 1) - 3] = 0.;
00176                                             for (j3 = 1; j3 <= 2; ++j3) {
00177                           t2[j1 + (j2 << 1) - 3] += t1[j1 + (j3 << 1) - 3] * 
00178                                   q[j3 + (j2 << 1) - 3];
00179 /* L20: */
00180                                             }
00181 /* L30: */
00182                                         }
00183 /* L40: */
00184                                     }
00185                                     for (j1 = 1; j1 <= 2; ++j1) {
00186                                         for (j2 = 1; j2 <= 2; ++j2) {
00187                                             sum = t[j1 + (j2 << 1) - 3];
00188                                             for (j3 = 1; j3 <= 2; ++j3) {
00189                           sum -= q[j3 + (j1 << 1) - 3] * t2[j3 + (j2 << 1) - 
00190                                   3];
00191 /* L50: */
00192                                             }
00193                                             res += abs(sum) / eps / tnrm;
00194 /* L60: */
00195                                         }
00196 /* L70: */
00197                                     }
00198                                     if (t[1] != 0. && (t[0] != t[3] || d_sign(
00199                                             &c_b19, &t[2]) * d_sign(&c_b19, &
00200                                             t[1]) > 0.)) {
00201                                         res += 1. / eps;
00202                                     }
00203                                     ++(*knt);
00204                                     if (res > *rmax) {
00205                                         *lmax = *knt;
00206                                         *rmax = res;
00207                                     }
00208 /* L80: */
00209                                 }
00210 /* L90: */
00211                             }
00212 /* L100: */
00213                         }
00214 /* L110: */
00215                     }
00216 /* L120: */
00217                 }
00218 /* L130: */
00219             }
00220 /* L140: */
00221         }
00222 /* L150: */
00223     }
00224 
00225     return 0;
00226 
00227 /*     End of DGET33 */
00228 
00229 } /* dget33_ */


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