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 integer c__2 = 2;
00019
00020 int sget32_(real *rmax, integer *lmax, integer *ninfo,
00021 integer *knt)
00022 {
00023
00024
00025 static integer itval[32] = { 8,4,2,1,4,8,1,2,2,1,8,
00026 4,1,2,4,8,9,4,2,1,4,9,1,2,2,1,9,4,1,2,4,9 };
00027
00028
00029 real r__1, r__2;
00030
00031
00032 double sqrt(doublereal);
00033
00034
00035 real b[4] , x[4] ;
00036 integer n1, n2, ib;
00037 real tl[4] , tr[4] ;
00038 integer ib1, ib2, ib3;
00039 real den, val[3], eps;
00040 integer itl;
00041 real res, sgn;
00042 integer itr;
00043 real tmp;
00044 integer info, isgn;
00045 real tnrm, xnrm, scale, xnorm;
00046 extern int slasy2_(logical *, logical *, integer *,
00047 integer *, integer *, real *, integer *, real *, integer *, real *
00048 , integer *, real *, real *, integer *, real *, integer *),
00049 slabad_(real *, real *);
00050 extern doublereal slamch_(char *);
00051 real bignum;
00052 integer itranl, itlscl;
00053 logical ltranl;
00054 integer itranr, itrscl;
00055 logical ltranr;
00056 real smlnum;
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
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122 eps = slamch_("P");
00123 smlnum = slamch_("S") / eps;
00124 bignum = 1.f / smlnum;
00125 slabad_(&smlnum, &bignum);
00126
00127
00128
00129 val[0] = sqrt(smlnum);
00130 val[1] = 1.f;
00131 val[2] = sqrt(bignum);
00132
00133 *knt = 0;
00134 *ninfo = 0;
00135 *lmax = 0;
00136 *rmax = 0.f;
00137
00138
00139
00140 for (itranl = 0; itranl <= 1; ++itranl) {
00141 for (itranr = 0; itranr <= 1; ++itranr) {
00142 for (isgn = -1; isgn <= 1; isgn += 2) {
00143 sgn = (real) isgn;
00144 ltranl = itranl == 1;
00145 ltranr = itranr == 1;
00146
00147 n1 = 1;
00148 n2 = 1;
00149 for (itl = 1; itl <= 3; ++itl) {
00150 for (itr = 1; itr <= 3; ++itr) {
00151 for (ib = 1; ib <= 3; ++ib) {
00152 tl[0] = val[itl - 1];
00153 tr[0] = val[itr - 1];
00154 b[0] = val[ib - 1];
00155 ++(*knt);
00156 slasy2_(<ranl, <ranr, &isgn, &n1, &n2, tl, &
00157 c__2, tr, &c__2, b, &c__2, &scale, x, &
00158 c__2, &xnorm, &info);
00159 if (info != 0) {
00160 ++(*ninfo);
00161 }
00162 res = (r__1 = (tl[0] + sgn * tr[0]) * x[0] -
00163 scale * b[0], dabs(r__1));
00164 if (info == 0) {
00165
00166 r__1 = eps * ((dabs(tr[0]) + dabs(tl[0])) *
00167 dabs(x[0]));
00168 den = dmax(r__1,smlnum);
00169 } else {
00170
00171 r__1 = dabs(x[0]);
00172 den = smlnum * dmax(r__1,1.f);
00173 }
00174 res /= den;
00175 if (scale > 1.f) {
00176 res += 1.f / eps;
00177 }
00178 res += (r__1 = xnorm - dabs(x[0]), dabs(r__1)) /
00179 dmax(smlnum,xnorm) / eps;
00180 if (info != 0 && info != 1) {
00181 res += 1.f / eps;
00182 }
00183 if (res > *rmax) {
00184 *lmax = *knt;
00185 *rmax = res;
00186 }
00187
00188 }
00189
00190 }
00191
00192 }
00193
00194 n1 = 2;
00195 n2 = 1;
00196 for (itl = 1; itl <= 8; ++itl) {
00197 for (itlscl = 1; itlscl <= 3; ++itlscl) {
00198 for (itr = 1; itr <= 3; ++itr) {
00199 for (ib1 = 1; ib1 <= 3; ++ib1) {
00200 for (ib2 = 1; ib2 <= 3; ++ib2) {
00201 b[0] = val[ib1 - 1];
00202 b[1] = val[ib2 - 1] * -4.f;
00203 tl[0] = itval[((itl << 1) + 1 << 1) - 6] *
00204 val[itlscl - 1];
00205 tl[1] = itval[((itl << 1) + 1 << 1) - 5] *
00206 val[itlscl - 1];
00207 tl[2] = itval[((itl << 1) + 2 << 1) - 6] *
00208 val[itlscl - 1];
00209 tl[3] = itval[((itl << 1) + 2 << 1) - 5] *
00210 val[itlscl - 1];
00211 tr[0] = val[itr - 1];
00212 ++(*knt);
00213 slasy2_(<ranl, <ranr, &isgn, &n1, &n2,
00214 tl, &c__2, tr, &c__2, b, &c__2, &
00215 scale, x, &c__2, &xnorm, &info);
00216 if (info != 0) {
00217 ++(*ninfo);
00218 }
00219 if (ltranl) {
00220 tmp = tl[2];
00221 tl[2] = tl[1];
00222 tl[1] = tmp;
00223 }
00224 res = (r__1 = (tl[0] + sgn * tr[0]) * x[0]
00225 + tl[2] * x[1] - scale * b[0],
00226 dabs(r__1));
00227 res += (r__1 = (tl[3] + sgn * tr[0]) * x[
00228 1] + tl[1] * x[0] - scale * b[1],
00229 dabs(r__1));
00230 tnrm = dabs(tr[0]) + dabs(tl[0]) + dabs(
00231 tl[2]) + dabs(tl[1]) + dabs(tl[3])
00232 ;
00233
00234 r__1 = dabs(x[0]), r__2 = dabs(x[1]);
00235 xnrm = dmax(r__1,r__2);
00236
00237 r__1 = smlnum, r__2 = smlnum * xnrm, r__1
00238 = max(r__1,r__2), r__2 = tnrm *
00239 eps * xnrm;
00240 den = dmax(r__1,r__2);
00241 res /= den;
00242 if (scale > 1.f) {
00243 res += 1.f / eps;
00244 }
00245 res += (r__1 = xnorm - xnrm, dabs(r__1)) /
00246 dmax(smlnum,xnorm) / eps;
00247 if (res > *rmax) {
00248 *lmax = *knt;
00249 *rmax = res;
00250 }
00251
00252 }
00253
00254 }
00255
00256 }
00257
00258 }
00259
00260 }
00261
00262 n1 = 1;
00263 n2 = 2;
00264 for (itr = 1; itr <= 8; ++itr) {
00265 for (itrscl = 1; itrscl <= 3; ++itrscl) {
00266 for (itl = 1; itl <= 3; ++itl) {
00267 for (ib1 = 1; ib1 <= 3; ++ib1) {
00268 for (ib2 = 1; ib2 <= 3; ++ib2) {
00269 b[0] = val[ib1 - 1];
00270 b[2] = val[ib2 - 1] * -2.f;
00271 tr[0] = itval[((itr << 1) + 1 << 1) - 6] *
00272 val[itrscl - 1];
00273 tr[1] = itval[((itr << 1) + 1 << 1) - 5] *
00274 val[itrscl - 1];
00275 tr[2] = itval[((itr << 1) + 2 << 1) - 6] *
00276 val[itrscl - 1];
00277 tr[3] = itval[((itr << 1) + 2 << 1) - 5] *
00278 val[itrscl - 1];
00279 tl[0] = val[itl - 1];
00280 ++(*knt);
00281 slasy2_(<ranl, <ranr, &isgn, &n1, &n2,
00282 tl, &c__2, tr, &c__2, b, &c__2, &
00283 scale, x, &c__2, &xnorm, &info);
00284 if (info != 0) {
00285 ++(*ninfo);
00286 }
00287 if (ltranr) {
00288 tmp = tr[2];
00289 tr[2] = tr[1];
00290 tr[1] = tmp;
00291 }
00292 tnrm = dabs(tl[0]) + dabs(tr[0]) + dabs(
00293 tr[2]) + dabs(tr[3]) + dabs(tr[1])
00294 ;
00295 xnrm = dabs(x[0]) + dabs(x[2]);
00296 res = (r__1 = (tl[0] + sgn * tr[0]) * x[0]
00297 + sgn * tr[1] * x[2] - scale * b[
00298 0], dabs(r__1));
00299 res += (r__1 = (tl[0] + sgn * tr[3]) * x[
00300 2] + sgn * tr[2] * x[0] - scale *
00301 b[2], dabs(r__1));
00302
00303 r__1 = smlnum, r__2 = smlnum * xnrm, r__1
00304 = max(r__1,r__2), r__2 = tnrm *
00305 eps * xnrm;
00306 den = dmax(r__1,r__2);
00307 res /= den;
00308 if (scale > 1.f) {
00309 res += 1.f / eps;
00310 }
00311 res += (r__1 = xnorm - xnrm, dabs(r__1)) /
00312 dmax(smlnum,xnorm) / eps;
00313 if (res > *rmax) {
00314 *lmax = *knt;
00315 *rmax = res;
00316 }
00317
00318 }
00319
00320 }
00321
00322 }
00323
00324 }
00325
00326 }
00327
00328 n1 = 2;
00329 n2 = 2;
00330 for (itr = 1; itr <= 8; ++itr) {
00331 for (itrscl = 1; itrscl <= 3; ++itrscl) {
00332 for (itl = 1; itl <= 8; ++itl) {
00333 for (itlscl = 1; itlscl <= 3; ++itlscl) {
00334 for (ib1 = 1; ib1 <= 3; ++ib1) {
00335 for (ib2 = 1; ib2 <= 3; ++ib2) {
00336 for (ib3 = 1; ib3 <= 3; ++ib3) {
00337 b[0] = val[ib1 - 1];
00338 b[1] = val[ib2 - 1] * -4.f;
00339 b[2] = val[ib3 - 1] * -2.f;
00340
00341 r__1 = val[ib1 - 1], r__2 = val[
00342 ib2 - 1], r__1 = min(r__1,
00343 r__2), r__2 = val[ib3 - 1]
00344 ;
00345 b[3] = dmin(r__1,r__2) * 8.f;
00346 tr[0] = itval[((itr << 1) + 1 <<
00347 1) - 6] * val[itrscl - 1];
00348 tr[1] = itval[((itr << 1) + 1 <<
00349 1) - 5] * val[itrscl - 1];
00350 tr[2] = itval[((itr << 1) + 2 <<
00351 1) - 6] * val[itrscl - 1];
00352 tr[3] = itval[((itr << 1) + 2 <<
00353 1) - 5] * val[itrscl - 1];
00354 tl[0] = itval[((itl << 1) + 1 <<
00355 1) - 6] * val[itlscl - 1];
00356 tl[1] = itval[((itl << 1) + 1 <<
00357 1) - 5] * val[itlscl - 1];
00358 tl[2] = itval[((itl << 1) + 2 <<
00359 1) - 6] * val[itlscl - 1];
00360 tl[3] = itval[((itl << 1) + 2 <<
00361 1) - 5] * val[itlscl - 1];
00362 ++(*knt);
00363 slasy2_(<ranl, <ranr, &isgn, &
00364 n1, &n2, tl, &c__2, tr, &
00365 c__2, b, &c__2, &scale, x,
00366 &c__2, &xnorm, &info);
00367 if (info != 0) {
00368 ++(*ninfo);
00369 }
00370 if (ltranr) {
00371 tmp = tr[2];
00372 tr[2] = tr[1];
00373 tr[1] = tmp;
00374 }
00375 if (ltranl) {
00376 tmp = tl[2];
00377 tl[2] = tl[1];
00378 tl[1] = tmp;
00379 }
00380 tnrm = dabs(tr[0]) + dabs(tr[1])
00381 + dabs(tr[2]) + dabs(tr[3]
00382 ) + dabs(tl[0]) + dabs(tl[
00383 1]) + dabs(tl[2]) + dabs(
00384 tl[3]);
00385
00386 r__1 = dabs(x[0]) + dabs(x[2]),
00387 r__2 = dabs(x[1]) + dabs(
00388 x[3]);
00389 xnrm = dmax(r__1,r__2);
00390 res = (r__1 = (tl[0] + sgn * tr[0]
00391 ) * x[0] + sgn * tr[1] *
00392 x[2] + tl[2] * x[1] -
00393 scale * b[0], dabs(r__1));
00394 res += (r__1 = tl[0] * x[2] + sgn
00395 * tr[2] * x[0] + sgn * tr[
00396 3] * x[2] + tl[2] * x[3]
00397 - scale * b[2], dabs(r__1)
00398 );
00399 res += (r__1 = tl[1] * x[0] + sgn
00400 * tr[0] * x[1] + sgn * tr[
00401 1] * x[3] + tl[3] * x[1]
00402 - scale * b[1], dabs(r__1)
00403 );
00404 res += (r__1 = (tl[3] + sgn * tr[
00405 3]) * x[3] + sgn * tr[2] *
00406 x[1] + tl[1] * x[2] -
00407 scale * b[3], dabs(r__1));
00408
00409 r__1 = smlnum, r__2 = smlnum *
00410 xnrm, r__1 = max(r__1,
00411 r__2), r__2 = tnrm * eps *
00412 xnrm;
00413 den = dmax(r__1,r__2);
00414 res /= den;
00415 if (scale > 1.f) {
00416 res += 1.f / eps;
00417 }
00418 res += (r__1 = xnorm - xnrm, dabs(
00419 r__1)) / dmax(smlnum,
00420 xnorm) / eps;
00421 if (res > *rmax) {
00422 *lmax = *knt;
00423 *rmax = res;
00424 }
00425
00426 }
00427
00428 }
00429
00430 }
00431
00432 }
00433
00434 }
00435
00436 }
00437
00438 }
00439
00440 }
00441
00442 }
00443
00444 }
00445
00446 return 0;
00447
00448
00449
00450 }