00001 SUBROUTINE DLASQ4( I0, N0, Z, PP, N0IN, DMIN, DMIN1, DMIN2, DN,
00002 $ DN1, DN2, TAU, TTYPE, G )
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 INTEGER I0, N0, N0IN, PP, TTYPE
00016 DOUBLE PRECISION DMIN, DMIN1, DMIN2, DN, DN1, DN2, G, TAU
00017
00018
00019 DOUBLE PRECISION Z( * )
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
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 DOUBLE PRECISION CNST1, CNST2, CNST3
00079 PARAMETER ( CNST1 = 0.5630D0, CNST2 = 1.010D0,
00080 $ CNST3 = 1.050D0 )
00081 DOUBLE PRECISION QURTR, THIRD, HALF, ZERO, ONE, TWO, HUNDRD
00082 PARAMETER ( QURTR = 0.250D0, THIRD = 0.3330D0,
00083 $ HALF = 0.50D0, ZERO = 0.0D0, ONE = 1.0D0,
00084 $ TWO = 2.0D0, HUNDRD = 100.0D0 )
00085
00086
00087 INTEGER I4, NN, NP
00088 DOUBLE PRECISION A2, B1, B2, GAM, GAP1, GAP2, S
00089
00090
00091 INTRINSIC MAX, MIN, SQRT
00092
00093
00094
00095
00096
00097
00098 IF( DMIN.LE.ZERO ) THEN
00099 TAU = -DMIN
00100 TTYPE = -1
00101 RETURN
00102 END IF
00103
00104 NN = 4*N0 + PP
00105 IF( N0IN.EQ.N0 ) THEN
00106
00107
00108
00109 IF( DMIN.EQ.DN .OR. DMIN.EQ.DN1 ) THEN
00110
00111 B1 = SQRT( Z( NN-3 ) )*SQRT( Z( NN-5 ) )
00112 B2 = SQRT( Z( NN-7 ) )*SQRT( Z( NN-9 ) )
00113 A2 = Z( NN-7 ) + Z( NN-5 )
00114
00115
00116
00117 IF( DMIN.EQ.DN .AND. DMIN1.EQ.DN1 ) THEN
00118 GAP2 = DMIN2 - A2 - DMIN2*QURTR
00119 IF( GAP2.GT.ZERO .AND. GAP2.GT.B2 ) THEN
00120 GAP1 = A2 - DN - ( B2 / GAP2 )*B2
00121 ELSE
00122 GAP1 = A2 - DN - ( B1+B2 )
00123 END IF
00124 IF( GAP1.GT.ZERO .AND. GAP1.GT.B1 ) THEN
00125 S = MAX( DN-( B1 / GAP1 )*B1, HALF*DMIN )
00126 TTYPE = -2
00127 ELSE
00128 S = ZERO
00129 IF( DN.GT.B1 )
00130 $ S = DN - B1
00131 IF( A2.GT.( B1+B2 ) )
00132 $ S = MIN( S, A2-( B1+B2 ) )
00133 S = MAX( S, THIRD*DMIN )
00134 TTYPE = -3
00135 END IF
00136 ELSE
00137
00138
00139
00140 TTYPE = -4
00141 S = QURTR*DMIN
00142 IF( DMIN.EQ.DN ) THEN
00143 GAM = DN
00144 A2 = ZERO
00145 IF( Z( NN-5 ) .GT. Z( NN-7 ) )
00146 $ RETURN
00147 B2 = Z( NN-5 ) / Z( NN-7 )
00148 NP = NN - 9
00149 ELSE
00150 NP = NN - 2*PP
00151 B2 = Z( NP-2 )
00152 GAM = DN1
00153 IF( Z( NP-4 ) .GT. Z( NP-2 ) )
00154 $ RETURN
00155 A2 = Z( NP-4 ) / Z( NP-2 )
00156 IF( Z( NN-9 ) .GT. Z( NN-11 ) )
00157 $ RETURN
00158 B2 = Z( NN-9 ) / Z( NN-11 )
00159 NP = NN - 13
00160 END IF
00161
00162
00163
00164 A2 = A2 + B2
00165 DO 10 I4 = NP, 4*I0 - 1 + PP, -4
00166 IF( B2.EQ.ZERO )
00167 $ GO TO 20
00168 B1 = B2
00169 IF( Z( I4 ) .GT. Z( I4-2 ) )
00170 $ RETURN
00171 B2 = B2*( Z( I4 ) / Z( I4-2 ) )
00172 A2 = A2 + B2
00173 IF( HUNDRD*MAX( B2, B1 ).LT.A2 .OR. CNST1.LT.A2 )
00174 $ GO TO 20
00175 10 CONTINUE
00176 20 CONTINUE
00177 A2 = CNST3*A2
00178
00179
00180
00181 IF( A2.LT.CNST1 )
00182 $ S = GAM*( ONE-SQRT( A2 ) ) / ( ONE+A2 )
00183 END IF
00184 ELSE IF( DMIN.EQ.DN2 ) THEN
00185
00186
00187
00188 TTYPE = -5
00189 S = QURTR*DMIN
00190
00191
00192
00193 NP = NN - 2*PP
00194 B1 = Z( NP-2 )
00195 B2 = Z( NP-6 )
00196 GAM = DN2
00197 IF( Z( NP-8 ).GT.B2 .OR. Z( NP-4 ).GT.B1 )
00198 $ RETURN
00199 A2 = ( Z( NP-8 ) / B2 )*( ONE+Z( NP-4 ) / B1 )
00200
00201
00202
00203 IF( N0-I0.GT.2 ) THEN
00204 B2 = Z( NN-13 ) / Z( NN-15 )
00205 A2 = A2 + B2
00206 DO 30 I4 = NN - 17, 4*I0 - 1 + PP, -4
00207 IF( B2.EQ.ZERO )
00208 $ GO TO 40
00209 B1 = B2
00210 IF( Z( I4 ) .GT. Z( I4-2 ) )
00211 $ RETURN
00212 B2 = B2*( Z( I4 ) / Z( I4-2 ) )
00213 A2 = A2 + B2
00214 IF( HUNDRD*MAX( B2, B1 ).LT.A2 .OR. CNST1.LT.A2 )
00215 $ GO TO 40
00216 30 CONTINUE
00217 40 CONTINUE
00218 A2 = CNST3*A2
00219 END IF
00220
00221 IF( A2.LT.CNST1 )
00222 $ S = GAM*( ONE-SQRT( A2 ) ) / ( ONE+A2 )
00223 ELSE
00224
00225
00226
00227 IF( TTYPE.EQ.-6 ) THEN
00228 G = G + THIRD*( ONE-G )
00229 ELSE IF( TTYPE.EQ.-18 ) THEN
00230 G = QURTR*THIRD
00231 ELSE
00232 G = QURTR
00233 END IF
00234 S = G*DMIN
00235 TTYPE = -6
00236 END IF
00237
00238 ELSE IF( N0IN.EQ.( N0+1 ) ) THEN
00239
00240
00241
00242 IF( DMIN1.EQ.DN1 .AND. DMIN2.EQ.DN2 ) THEN
00243
00244
00245
00246 TTYPE = -7
00247 S = THIRD*DMIN1
00248 IF( Z( NN-5 ).GT.Z( NN-7 ) )
00249 $ RETURN
00250 B1 = Z( NN-5 ) / Z( NN-7 )
00251 B2 = B1
00252 IF( B2.EQ.ZERO )
00253 $ GO TO 60
00254 DO 50 I4 = 4*N0 - 9 + PP, 4*I0 - 1 + PP, -4
00255 A2 = B1
00256 IF( Z( I4 ).GT.Z( I4-2 ) )
00257 $ RETURN
00258 B1 = B1*( Z( I4 ) / Z( I4-2 ) )
00259 B2 = B2 + B1
00260 IF( HUNDRD*MAX( B1, A2 ).LT.B2 )
00261 $ GO TO 60
00262 50 CONTINUE
00263 60 CONTINUE
00264 B2 = SQRT( CNST3*B2 )
00265 A2 = DMIN1 / ( ONE+B2**2 )
00266 GAP2 = HALF*DMIN2 - A2
00267 IF( GAP2.GT.ZERO .AND. GAP2.GT.B2*A2 ) THEN
00268 S = MAX( S, A2*( ONE-CNST2*A2*( B2 / GAP2 )*B2 ) )
00269 ELSE
00270 S = MAX( S, A2*( ONE-CNST2*B2 ) )
00271 TTYPE = -8
00272 END IF
00273 ELSE
00274
00275
00276
00277 S = QURTR*DMIN1
00278 IF( DMIN1.EQ.DN1 )
00279 $ S = HALF*DMIN1
00280 TTYPE = -9
00281 END IF
00282
00283 ELSE IF( N0IN.EQ.( N0+2 ) ) THEN
00284
00285
00286
00287
00288
00289 IF( DMIN2.EQ.DN2 .AND. TWO*Z( NN-5 ).LT.Z( NN-7 ) ) THEN
00290 TTYPE = -10
00291 S = THIRD*DMIN2
00292 IF( Z( NN-5 ).GT.Z( NN-7 ) )
00293 $ RETURN
00294 B1 = Z( NN-5 ) / Z( NN-7 )
00295 B2 = B1
00296 IF( B2.EQ.ZERO )
00297 $ GO TO 80
00298 DO 70 I4 = 4*N0 - 9 + PP, 4*I0 - 1 + PP, -4
00299 IF( Z( I4 ).GT.Z( I4-2 ) )
00300 $ RETURN
00301 B1 = B1*( Z( I4 ) / Z( I4-2 ) )
00302 B2 = B2 + B1
00303 IF( HUNDRD*B1.LT.B2 )
00304 $ GO TO 80
00305 70 CONTINUE
00306 80 CONTINUE
00307 B2 = SQRT( CNST3*B2 )
00308 A2 = DMIN2 / ( ONE+B2**2 )
00309 GAP2 = Z( NN-7 ) + Z( NN-9 ) -
00310 $ SQRT( Z( NN-11 ) )*SQRT( Z( NN-9 ) ) - A2
00311 IF( GAP2.GT.ZERO .AND. GAP2.GT.B2*A2 ) THEN
00312 S = MAX( S, A2*( ONE-CNST2*A2*( B2 / GAP2 )*B2 ) )
00313 ELSE
00314 S = MAX( S, A2*( ONE-CNST2*B2 ) )
00315 END IF
00316 ELSE
00317 S = QURTR*DMIN2
00318 TTYPE = -11
00319 END IF
00320 ELSE IF( N0IN.GT.( N0+2 ) ) THEN
00321
00322
00323
00324 S = ZERO
00325 TTYPE = -12
00326 END IF
00327
00328 TAU = S
00329 RETURN
00330
00331
00332
00333 END