00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #include "f2c.h"
00014 #include "blaswrap.h"
00015
00016
00017
00018 static real c_b19 = 1.f;
00019
00020 int sget33_(real *rmax, integer *lmax, integer *ninfo,
00021 integer *knt)
00022 {
00023
00024 real r__1, r__2, r__3;
00025
00026
00027 double r_sign(real *, real *);
00028
00029
00030 real q[4] , t[4] ;
00031 integer i1, i2, i3, i4, j1, j2, j3;
00032 real t1[4] , t2[4] , cs, sn, vm[3];
00033 integer im1, im2, im3, im4;
00034 real wi1, wi2, wr1, wr2, val[4], eps, res, sum, tnrm;
00035 extern 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
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097 eps = slamch_("P");
00098 smlnum = slamch_("S") / eps;
00099 bignum = 1.f / smlnum;
00100 slabad_(&smlnum, &bignum);
00101
00102
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
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
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
00154 }
00155
00156 res = 0.f;
00157
00158 r__2 = q[0];
00159
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
00164 r__2 = q[3];
00165
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
00178 }
00179
00180 }
00181
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
00190 }
00191 res += dabs(sum) / eps / tnrm;
00192
00193 }
00194
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
00207 }
00208
00209 }
00210
00211 }
00212
00213 }
00214
00215 }
00216
00217 }
00218
00219 }
00220
00221 }
00222
00223 return 0;
00224
00225
00226
00227 }