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