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


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