Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #include "f2c.h"
00014 #include "blaswrap.h"
00015
00016 int slasq4_(integer *i0, integer *n0, real *z__, integer *pp,
00017 integer *n0in, real *dmin__, real *dmin1, real *dmin2, real *dn,
00018 real *dn1, real *dn2, real *tau, integer *ttype, real *g)
00019 {
00020
00021 integer i__1;
00022 real r__1, r__2;
00023
00024
00025 double sqrt(doublereal);
00026
00027
00028 real s, a2, b1, b2;
00029 integer i4, nn, np;
00030 real gam, gap1, gap2;
00031
00032
00033
00034
00035
00036
00037
00038
00039
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
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115 --z__;
00116
00117
00118 if (*dmin__ <= 0.f) {
00119 *tau = -(*dmin__);
00120 *ttype = -1;
00121 return 0;
00122 }
00123
00124 nn = (*n0 << 2) + *pp;
00125 if (*n0in == *n0) {
00126
00127
00128
00129 if (*dmin__ == *dn || *dmin__ == *dn1) {
00130
00131 b1 = sqrt(z__[nn - 3]) * sqrt(z__[nn - 5]);
00132 b2 = sqrt(z__[nn - 7]) * sqrt(z__[nn - 9]);
00133 a2 = z__[nn - 7] + z__[nn - 5];
00134
00135
00136
00137 if (*dmin__ == *dn && *dmin1 == *dn1) {
00138 gap2 = *dmin2 - a2 - *dmin2 * .25f;
00139 if (gap2 > 0.f && gap2 > b2) {
00140 gap1 = a2 - *dn - b2 / gap2 * b2;
00141 } else {
00142 gap1 = a2 - *dn - (b1 + b2);
00143 }
00144 if (gap1 > 0.f && gap1 > b1) {
00145
00146 r__1 = *dn - b1 / gap1 * b1, r__2 = *dmin__ * .5f;
00147 s = dmax(r__1,r__2);
00148 *ttype = -2;
00149 } else {
00150 s = 0.f;
00151 if (*dn > b1) {
00152 s = *dn - b1;
00153 }
00154 if (a2 > b1 + b2) {
00155
00156 r__1 = s, r__2 = a2 - (b1 + b2);
00157 s = dmin(r__1,r__2);
00158 }
00159
00160 r__1 = s, r__2 = *dmin__ * .333f;
00161 s = dmax(r__1,r__2);
00162 *ttype = -3;
00163 }
00164 } else {
00165
00166
00167
00168 *ttype = -4;
00169 s = *dmin__ * .25f;
00170 if (*dmin__ == *dn) {
00171 gam = *dn;
00172 a2 = 0.f;
00173 if (z__[nn - 5] > z__[nn - 7]) {
00174 return 0;
00175 }
00176 b2 = z__[nn - 5] / z__[nn - 7];
00177 np = nn - 9;
00178 } else {
00179 np = nn - (*pp << 1);
00180 b2 = z__[np - 2];
00181 gam = *dn1;
00182 if (z__[np - 4] > z__[np - 2]) {
00183 return 0;
00184 }
00185 a2 = z__[np - 4] / z__[np - 2];
00186 if (z__[nn - 9] > z__[nn - 11]) {
00187 return 0;
00188 }
00189 b2 = z__[nn - 9] / z__[nn - 11];
00190 np = nn - 13;
00191 }
00192
00193
00194
00195 a2 += b2;
00196 i__1 = (*i0 << 2) - 1 + *pp;
00197 for (i4 = np; i4 >= i__1; i4 += -4) {
00198 if (b2 == 0.f) {
00199 goto L20;
00200 }
00201 b1 = b2;
00202 if (z__[i4] > z__[i4 - 2]) {
00203 return 0;
00204 }
00205 b2 *= z__[i4] / z__[i4 - 2];
00206 a2 += b2;
00207 if (dmax(b2,b1) * 100.f < a2 || .563f < a2) {
00208 goto L20;
00209 }
00210
00211 }
00212 L20:
00213 a2 *= 1.05f;
00214
00215
00216
00217 if (a2 < .563f) {
00218 s = gam * (1.f - sqrt(a2)) / (a2 + 1.f);
00219 }
00220 }
00221 } else if (*dmin__ == *dn2) {
00222
00223
00224
00225 *ttype = -5;
00226 s = *dmin__ * .25f;
00227
00228
00229
00230 np = nn - (*pp << 1);
00231 b1 = z__[np - 2];
00232 b2 = z__[np - 6];
00233 gam = *dn2;
00234 if (z__[np - 8] > b2 || z__[np - 4] > b1) {
00235 return 0;
00236 }
00237 a2 = z__[np - 8] / b2 * (z__[np - 4] / b1 + 1.f);
00238
00239
00240
00241 if (*n0 - *i0 > 2) {
00242 b2 = z__[nn - 13] / z__[nn - 15];
00243 a2 += b2;
00244 i__1 = (*i0 << 2) - 1 + *pp;
00245 for (i4 = nn - 17; i4 >= i__1; i4 += -4) {
00246 if (b2 == 0.f) {
00247 goto L40;
00248 }
00249 b1 = b2;
00250 if (z__[i4] > z__[i4 - 2]) {
00251 return 0;
00252 }
00253 b2 *= z__[i4] / z__[i4 - 2];
00254 a2 += b2;
00255 if (dmax(b2,b1) * 100.f < a2 || .563f < a2) {
00256 goto L40;
00257 }
00258
00259 }
00260 L40:
00261 a2 *= 1.05f;
00262 }
00263
00264 if (a2 < .563f) {
00265 s = gam * (1.f - sqrt(a2)) / (a2 + 1.f);
00266 }
00267 } else {
00268
00269
00270
00271 if (*ttype == -6) {
00272 *g += (1.f - *g) * .333f;
00273 } else if (*ttype == -18) {
00274 *g = .083250000000000005f;
00275 } else {
00276 *g = .25f;
00277 }
00278 s = *g * *dmin__;
00279 *ttype = -6;
00280 }
00281
00282 } else if (*n0in == *n0 + 1) {
00283
00284
00285
00286 if (*dmin1 == *dn1 && *dmin2 == *dn2) {
00287
00288
00289
00290 *ttype = -7;
00291 s = *dmin1 * .333f;
00292 if (z__[nn - 5] > z__[nn - 7]) {
00293 return 0;
00294 }
00295 b1 = z__[nn - 5] / z__[nn - 7];
00296 b2 = b1;
00297 if (b2 == 0.f) {
00298 goto L60;
00299 }
00300 i__1 = (*i0 << 2) - 1 + *pp;
00301 for (i4 = (*n0 << 2) - 9 + *pp; i4 >= i__1; i4 += -4) {
00302 a2 = b1;
00303 if (z__[i4] > z__[i4 - 2]) {
00304 return 0;
00305 }
00306 b1 *= z__[i4] / z__[i4 - 2];
00307 b2 += b1;
00308 if (dmax(b1,a2) * 100.f < b2) {
00309 goto L60;
00310 }
00311
00312 }
00313 L60:
00314 b2 = sqrt(b2 * 1.05f);
00315
00316 r__1 = b2;
00317 a2 = *dmin1 / (r__1 * r__1 + 1.f);
00318 gap2 = *dmin2 * .5f - a2;
00319 if (gap2 > 0.f && gap2 > b2 * a2) {
00320
00321 r__1 = s, r__2 = a2 * (1.f - a2 * 1.01f * (b2 / gap2) * b2);
00322 s = dmax(r__1,r__2);
00323 } else {
00324
00325 r__1 = s, r__2 = a2 * (1.f - b2 * 1.01f);
00326 s = dmax(r__1,r__2);
00327 *ttype = -8;
00328 }
00329 } else {
00330
00331
00332
00333 s = *dmin1 * .25f;
00334 if (*dmin1 == *dn1) {
00335 s = *dmin1 * .5f;
00336 }
00337 *ttype = -9;
00338 }
00339
00340 } else if (*n0in == *n0 + 2) {
00341
00342
00343
00344
00345
00346 if (*dmin2 == *dn2 && z__[nn - 5] * 2.f < z__[nn - 7]) {
00347 *ttype = -10;
00348 s = *dmin2 * .333f;
00349 if (z__[nn - 5] > z__[nn - 7]) {
00350 return 0;
00351 }
00352 b1 = z__[nn - 5] / z__[nn - 7];
00353 b2 = b1;
00354 if (b2 == 0.f) {
00355 goto L80;
00356 }
00357 i__1 = (*i0 << 2) - 1 + *pp;
00358 for (i4 = (*n0 << 2) - 9 + *pp; i4 >= i__1; i4 += -4) {
00359 if (z__[i4] > z__[i4 - 2]) {
00360 return 0;
00361 }
00362 b1 *= z__[i4] / z__[i4 - 2];
00363 b2 += b1;
00364 if (b1 * 100.f < b2) {
00365 goto L80;
00366 }
00367
00368 }
00369 L80:
00370 b2 = sqrt(b2 * 1.05f);
00371
00372 r__1 = b2;
00373 a2 = *dmin2 / (r__1 * r__1 + 1.f);
00374 gap2 = z__[nn - 7] + z__[nn - 9] - sqrt(z__[nn - 11]) * sqrt(z__[
00375 nn - 9]) - a2;
00376 if (gap2 > 0.f && gap2 > b2 * a2) {
00377
00378 r__1 = s, r__2 = a2 * (1.f - a2 * 1.01f * (b2 / gap2) * b2);
00379 s = dmax(r__1,r__2);
00380 } else {
00381
00382 r__1 = s, r__2 = a2 * (1.f - b2 * 1.01f);
00383 s = dmax(r__1,r__2);
00384 }
00385 } else {
00386 s = *dmin2 * .25f;
00387 *ttype = -11;
00388 }
00389 } else if (*n0in > *n0 + 2) {
00390
00391
00392
00393 s = 0.f;
00394 *ttype = -12;
00395 }
00396
00397 *tau = s;
00398 return 0;
00399
00400
00401
00402 }