151 SUBROUTINE dlasq4( I0, N0, Z, PP, N0IN, DMIN, DMIN1, DMIN2, DN,
152 $ dn1, dn2, tau, ttype, g )
160 INTEGER i0, n0, n0in, pp, ttype
161 DOUBLE PRECISION dmin, dmin1, dmin2, dn, dn1, dn2, g, tau
164 DOUBLE PRECISION z( * )
170 DOUBLE PRECISION cnst1, cnst2, cnst3
171 parameter( cnst1 = 0.5630d0, cnst2 = 1.010d0,
173 DOUBLE PRECISION qurtr, third, half, zero, one, two, hundrd
174 parameter( qurtr = 0.250d0, third = 0.3330d0,
175 $ half = 0.50d0, zero = 0.0d0, one = 1.0d0,
176 $ two = 2.0d0, hundrd = 100.0d0 )
180 DOUBLE PRECISION a2, b1, b2, gam, gap1, gap2, s
183 INTRINSIC max, min, sqrt
190 IF( dmin.LE.zero )
THEN
197 IF( n0in.EQ.n0 )
THEN
201 IF( dmin.EQ.dn .OR. dmin.EQ.dn1 )
THEN
203 b1 = sqrt( z( nn-3 ) )*sqrt( z( nn-5 ) )
204 b2 = sqrt( z( nn-7 ) )*sqrt( z( nn-9 ) )
205 a2 = z( nn-7 ) + z( nn-5 )
209 IF( dmin.EQ.dn .AND. dmin1.EQ.dn1 )
THEN
210 gap2 = dmin2 - a2 - dmin2*qurtr
211 IF( gap2.GT.zero .AND. gap2.GT.b2 )
THEN
212 gap1 = a2 - dn - ( b2 / gap2 )*b2
214 gap1 = a2 - dn - ( b1+b2 )
216 IF( gap1.GT.zero .AND. gap1.GT.b1 )
THEN
217 s = max( dn-( b1 / gap1 )*b1, half*dmin )
223 IF( a2.GT.( b1+b2 ) )
224 $ s = min( s, a2-( b1+b2 ) )
225 s = max( s, third*dmin )
234 IF( dmin.EQ.dn )
THEN
237 IF( z( nn-5 ) .GT. z( nn-7 ) )
239 b2 = z( nn-5 ) / z( nn-7 )
245 IF( z( np-4 ) .GT. z( np-2 ) )
247 a2 = z( np-4 ) / z( np-2 )
248 IF( z( nn-9 ) .GT. z( nn-11 ) )
250 b2 = z( nn-9 ) / z( nn-11 )
257 DO 10 i4 = np, 4*i0 - 1 + pp, -4
261 IF( z( i4 ) .GT. z( i4-2 ) )
263 b2 = b2*( z( i4 ) / z( i4-2 ) )
265 IF( hundrd*max( b2, b1 ).LT.a2 .OR. cnst1.LT.a2 )
274 $ s = gam*( one-sqrt( a2 ) ) / ( one+a2 )
276 ELSE IF( dmin.EQ.dn2 )
THEN
289 IF( z( np-8 ).GT.b2 .OR. z( np-4 ).GT.b1 )
291 a2 = ( z( np-8 ) / b2 )*( one+z( np-4 ) / b1 )
295 IF( n0-i0.GT.2 )
THEN
296 b2 = z( nn-13 ) / z( nn-15 )
298 DO 30 i4 = nn - 17, 4*i0 - 1 + pp, -4
302 IF( z( i4 ) .GT. z( i4-2 ) )
304 b2 = b2*( z( i4 ) / z( i4-2 ) )
306 IF( hundrd*max( b2, b1 ).LT.a2 .OR. cnst1.LT.a2 )
314 $ s = gam*( one-sqrt( a2 ) ) / ( one+a2 )
319 IF( ttype.EQ.-6 )
THEN
320 g = g + third*( one-g )
321 ELSE IF( ttype.EQ.-18 )
THEN
330 ELSE IF( n0in.EQ.( n0+1 ) )
THEN
334 IF( dmin1.EQ.dn1 .AND. dmin2.EQ.dn2 )
THEN
340 IF( z( nn-5 ).GT.z( nn-7 ) )
342 b1 = z( nn-5 ) / z( nn-7 )
346 DO 50 i4 = 4*n0 - 9 + pp, 4*i0 - 1 + pp, -4
348 IF( z( i4 ).GT.z( i4-2 ) )
350 b1 = b1*( z( i4 ) / z( i4-2 ) )
352 IF( hundrd*max( b1, a2 ).LT.b2 )
356 b2 = sqrt( cnst3*b2 )
357 a2 = dmin1 / ( one+b2**2 )
358 gap2 = half*dmin2 - a2
359 IF( gap2.GT.zero .AND. gap2.GT.b2*a2 )
THEN
360 s = max( s, a2*( one-cnst2*a2*( b2 / gap2 )*b2 ) )
362 s = max( s, a2*( one-cnst2*b2 ) )
375 ELSE IF( n0in.EQ.( n0+2 ) )
THEN
381 IF( dmin2.EQ.dn2 .AND. two*z( nn-5 ).LT.z( nn-7 ) )
THEN
384 IF( z( nn-5 ).GT.z( nn-7 ) )
386 b1 = z( nn-5 ) / z( nn-7 )
390 DO 70 i4 = 4*n0 - 9 + pp, 4*i0 - 1 + pp, -4
391 IF( z( i4 ).GT.z( i4-2 ) )
393 b1 = b1*( z( i4 ) / z( i4-2 ) )
395 IF( hundrd*b1.LT.b2 )
399 b2 = sqrt( cnst3*b2 )
400 a2 = dmin2 / ( one+b2**2 )
401 gap2 = z( nn-7 ) + z( nn-9 ) -
402 $ sqrt( z( nn-11 ) )*sqrt( z( nn-9 ) ) - a2
403 IF( gap2.GT.zero .AND. gap2.GT.b2*a2 )
THEN
404 s = max( s, a2*( one-cnst2*a2*( b2 / gap2 )*b2 ) )
406 s = max( s, a2*( one-cnst2*b2 ) )
412 ELSE IF( n0in.GT.( n0+2 ) )
THEN