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 doublereal c_b19 = 1.;
00019
00020 int dget33_(doublereal *rmax, integer *lmax, integer *ninfo,
00021 integer *knt)
00022 {
00023
00024 doublereal d__1, d__2, d__3;
00025
00026
00027 double d_sign(doublereal *, doublereal *);
00028
00029
00030 doublereal q[4] , t[4] ;
00031 integer i1, i2, i3, i4, j1, j2, j3;
00032 doublereal t1[4] , t2[4] , 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 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
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
00098
00099 eps = dlamch_("P");
00100 smlnum = dlamch_("S") / eps;
00101 bignum = 1. / smlnum;
00102 dlabad_(&smlnum, &bignum);
00103
00104
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
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
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
00156 }
00157
00158 res = 0.;
00159
00160 d__2 = q[0];
00161
00162 d__3 = q[2];
00163 res += (d__1 = d__2 * d__2 + d__3 * d__3
00164 - 1., abs(d__1)) / eps;
00165
00166 d__2 = q[3];
00167
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
00180 }
00181
00182 }
00183
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
00192 }
00193 res += abs(sum) / eps / tnrm;
00194
00195 }
00196
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
00209 }
00210
00211 }
00212
00213 }
00214
00215 }
00216
00217 }
00218
00219 }
00220
00221 }
00222
00223 }
00224
00225 return 0;
00226
00227
00228
00229 }