1 SUBROUTINE dlasq4( I0, N0, Z, PP, N0IN, DMIN, DMIN1, DMIN2, DN,
2 $ DN1, DN2, TAU, TTYPE )
10 INTEGER I0, N0, N0IN, PP, TTYPE
11 DOUBLE PRECISION DMIN, DMIN1, DMIN2, DN, DN1, DN2, TAU
14 DOUBLE PRECISION Z( * )
69 DOUBLE PRECISION CNST1, CNST2, CNST3
70 parameter( cnst1 = 0.5630d0, cnst2 = 1.010d0,
72 DOUBLE PRECISION QURTR, THIRD, HALF, ZERO, ONE, TWO, HUNDRD
73 parameter( qurtr = 0.250d0, third = 0.3330d0,
74 $ half = 0.50d0, zero = 0.0d0, one = 1.0d0,
75 $ two = 2.0d0, hundrd = 100.0d0 )
79 DOUBLE PRECISION A2, B1, B2, G, GAM, GAP1, GAP2, S
82 INTRINSIC max, min, sqrt
95 IF( dmin.LE.zero )
THEN
102 IF( n0in.EQ.n0 )
THEN
106 IF( dmin.EQ.dn .OR. dmin.EQ.dn1 )
THEN
108 b1 = sqrt( z( nn-3 ) )*sqrt( z( nn-5 ) )
109 b2 = sqrt( z( nn-7 ) )*sqrt( z( nn-9 ) )
110 a2 = z( nn-7 ) + z( nn-5 )
114 IF( dmin.EQ.dn .AND. dmin1.EQ.dn1 )
THEN
115 gap2 = dmin2 - a2 - dmin2*qurtr
116 IF( gap2.GT.zero .AND. gap2.GT.b2 )
THEN
117 gap1 = a2 - dn - ( b2 / gap2 )*b2
119 gap1 = a2 - dn - ( b1+b2 )
121 IF( gap1.GT.zero .AND. gap1.GT.b1 )
THEN
122 s = max( dn-( b1 / gap1 )*b1, half*dmin )
128 IF( a2.GT.( b1+b2 ) )
129 $ s = min( s, a2-( b1+b2 ) )
130 s = max( s, third*dmin )
139 IF( dmin.EQ.dn )
THEN
142 IF( z( nn-5 ) .GT. z( nn-7 ) )
144 b2 = z( nn-5 ) / z( nn-7 )
150 IF( z( np-4 ) .GT. z( np-2 ) )
152 a2 = z( np-4 ) / z( np-2 )
153 IF( z( nn-9 ) .GT. z( nn-11 ) )
155 b2 = z( nn-9 ) / z( nn-11 )
162 DO 10 i4 = np, 4*i0 - 1 + pp, -4
166 IF( z( i4 ) .GT. z( i4-2 ) )
168 b2 = b2*( z( i4 ) / z( i4-2 ) )
170 IF( hundrd*max( b2, b1 ).LT.a2 .OR. cnst1.LT.a2 )
179 $ s = gam*( one-sqrt( a2 ) ) / ( one+a2 )
181 ELSE IF( dmin.EQ.dn2 )
THEN
194 IF( z( np-8 ).GT.b2 .OR. z( np-4 ).GT.b1 )
196 a2 = ( z( np-8 ) / b2 )*( one+z( np-4 ) / b1 )
200 IF( n0-i0.GT.2 )
THEN
201 b2 = z( nn-13 ) / z( nn-15 )
203 DO 30 i4 = nn - 17, 4*i0 - 1 + pp, -4
207 IF( z( i4 ) .GT. z( i4-2 ) )
209 b2 = b2*( z( i4 ) / z( i4-2 ) )
211 IF( hundrd*max( b2, b1 ).LT.a2 .OR. cnst1.LT.a2 )
219 $ s = gam*( one-sqrt( a2 ) ) / ( one+a2 )
224 IF( ttype.EQ.-6 )
THEN
225 g = g + third*( one-g )
226 ELSE IF( ttype.EQ.-18 )
THEN
235 ELSE IF( n0in.EQ.( n0+1 ) )
THEN
239 IF( dmin1.EQ.dn1 .AND. dmin2.EQ.dn2 )
THEN
245 IF( z( nn-5 ).GT.z( nn-7 ) )
247 b1 = z( nn-5 ) / z( nn-7 )
251 DO 50 i4 = 4*n0 - 9 + pp, 4*i0 - 1 + pp, -4
253 IF( z( i4 ).GT.z( i4-2 ) )
255 b1 = b1*( z( i4 ) / z( i4-2 ) )
257 IF( hundrd*max( b1, a2 ).LT.b2 )
261 b2 = sqrt( cnst3*b2 )
262 a2 = dmin1 / ( one+b2**2 )
263 gap2 = half*dmin2 - a2
264 IF( gap2.GT.zero .AND. gap2.GT.b2*a2 )
THEN
265 s = max( s, a2*( one-cnst2*a2*( b2 / gap2 )*b2 ) )
267 s = max( s, a2*( one-cnst2*b2 ) )
280 ELSE IF( n0in.EQ.( n0+2 ) )
THEN
286 IF( dmin2.EQ.dn2 .AND. two*z( nn-5 ).LT.z( nn-7 ) )
THEN
289 IF( z( nn-5 ).GT.z( nn-7 ) )
291 b1 = z( nn-5 ) / z( nn-7 )
295 DO 70 i4 = 4*n0 - 9 + pp, 4*i0 - 1 + pp, -4
296 IF( z( i4 ).GT.z( i4-2 ) )
298 b1 = b1*( z( i4 ) / z( i4-2 ) )
300 IF( hundrd*b1.LT.b2 )
304 b2 = sqrt( cnst3*b2 )
305 a2 = dmin2 / ( one+b2**2 )
306 gap2 = z( nn-7 ) + z( nn-9 ) -
307 $ sqrt( z( nn-11 ) )*sqrt( z( nn-9 ) ) - a2
308 IF( gap2.GT.zero .AND. gap2.GT.b2*a2 )
THEN
309 s = max( s, a2*( one-cnst2*a2*( b2 / gap2 )*b2 ) )
311 s = max( s, a2*( one-cnst2*b2 ) )
317 ELSE IF( n0in.GT.( n0+2 ) )
THEN
subroutine dlasq4(I0, N0, Z, PP, N0IN, DMIN, DMIN1, DMIN2, DN, DN1, DN2, TAU, TTYPE)