1 SUBROUTINE dlarrf2( N, D, L, LD, CLSTRT, CLEND,
2 $ CLMID1, CLMID2, W, WGAP, WERR, TRYMID,
3 $ SPDIAM, CLGAPL, CLGAPR, PIVMIN, SIGMA,
4 $ DPLUS, LPLUS, WORK, INFO )
13 INTEGER CLSTRT, CLEND, CLMID1, CLMID2, INFO, N
14 DOUBLE PRECISION CLGAPL, CLGAPR, PIVMIN, SIGMA, SPDIAM
18 DOUBLE PRECISION D( * ), DPLUS( * ), L( * ), LD( * ),
19 $ LPLUS( * ), W( * ), WGAP( * ), WERR( * ), WORK( * )
108 DOUBLE PRECISION FOUR, MAXGROWTH1, MAXGROWTH2, ONE, QUART, TWO
109 PARAMETER ( ONE = 1.0d0, two = 2.0d0,
110 $ four = 4.0d0, quart = 0.25d0,
112 $ maxgrowth2 = 8.d0 )
115 LOGICAL DORRR1, NOFAIL, SAWNAN1, SAWNAN2, TRYRRR1
116 INTEGER BI,I,J,KTRY,KTRYMAX,SLEFT,SRIGHT,SMID,SHIFT
117 PARAMETER ( KTRYMAX = 1, smid =0, sleft = 1, sright = 2 )
121 PARAMETER ( BLKLEN = 512 )
124 DOUBLE PRECISION AVGAP, BESTSHIFT, CLWDTH, EPS, FACT, FAIL,
125 $ FAIL2, GROWTHBOUND, LDELTA, LDMAX, LEASTGROWTH,
126 $ LSIGMA, MAX1, MAX2, MINGAP, MSIGMA1, MSIGMA2,
127 $ oldp, prod, rdelta, rdmax, rrr1, rrr2, rsigma,
132 DOUBLE PRECISION DLAMCH
133 EXTERNAL DISNAN, DLAMCH
144 fact = dble(2**ktrymax)
145 eps = dlamch(
'Precision' )
154 clwdth = abs(w(clend)-w(clstrt)) + werr(clend) + werr(clstrt)
155 avgap = clwdth / dble(clend-clstrt)
156 mingap =
min(clgapl, clgapr)
159 lsigma =
min(w( clstrt ),w( clend )) - werr( clstrt )
160 rsigma =
max(w( clstrt ),w( clend )) + werr( clend )
161 msigma1 = w( clmid1 ) + werr( clmid1 )
162 msigma2 = w( clmid2 ) - werr( clmid2 )
165 lsigma = lsigma - abs(lsigma)* four * eps
166 rsigma = rsigma + abs(rsigma)* four * eps
169 ldmax = quart * mingap + two * pivmin
170 rdmax = quart * mingap + two * pivmin
172 ldelta =
max(avgap,wgap( clstrt ))/fact
173 rdelta =
max(avgap,wgap( clend-1 ))/fact
178 leastgrowth = one / s
179 fail = dble(n-1)*mingap/(spdiam*eps)
180 fail2 = dble(n-1)*mingap/(spdiam*sqrt(eps))
181 growthbound = maxgrowth1*spdiam
189 IF(.NOT.trymid)
GOTO 4
206 dplus( 1 ) = d( 1 ) + s
207 max1 = abs( dplus( 1 ) )
208 DO 2 bi = 1, n-1, blklen
209 DO 1 i = bi,
min( bi+blklen-1, n-1)
210 lplus( i ) = ld( i ) / dplus( i )
211 s = s*lplus( i )*l( i ) - sigma
212 dplus( i+1 ) = d( i+1 ) + s
213 max1 =
max( max1,abs(dplus(i+1)) )
215 sawnan1=sawnan1 .OR. disnan(max1)
219 IF( .NOT.sawnan1 )
THEN
220 IF( max1.LE.growthbound )
THEN
222 ELSE IF( max1.LE.leastgrowth )
THEN
248 dplus( 1 ) = d( 1 ) + s
249 max1 = abs( dplus( 1 ) )
250 DO 12 bi = 1, n-1, blklen
251 DO 11 i = bi,
min( bi+blklen-1, n-1)
252 lplus( i ) = ld( i ) / dplus( i )
253 s = s*lplus( i )*l( i ) - lsigma
254 dplus( i+1 ) = d( i+1 ) + s
255 max1 =
max( max1,abs(dplus(i+1)) )
257 sawnan1=sawnan1 .OR. disnan(max1)
260 IF( .NOT.sawnan1 )
THEN
261 IF( max1.LE.growthbound )
THEN
265 ELSE IF( max1.LE.leastgrowth )
THEN
275 work( 1 ) = d( 1 ) + s
276 max2 = abs( work( 1 ) )
277 DO 22 bi = 1, n-1, blklen
278 DO 21 i = bi,
min( bi+blklen-1, n-1)
279 work( n+i ) = ld( i ) / work( i )
280 s = s*work( n+i )*l( i ) - rsigma
281 work( i+1 ) = d( i+1 ) + s
282 max2 =
max( max2,abs(work(i+1)) )
284 sawnan2=sawnan2 .OR. disnan(max2)
287 IF( .NOT.sawnan2 )
THEN
288 IF( max2.LE.growthbound )
THEN
292 ELSE IF( max2.LE.leastgrowth )
THEN
303 IF (ktry.LT.ktrymax)
THEN
306 lsigma =
max( lsigma - ldelta,
308 rsigma =
min( rsigma + rdelta,
310 ldelta = two * ldelta
311 rdelta = two * rdelta
313 ldelta =
min(ldmax,ldelta)
314 rdelta =
min(rdmax,rdelta)
320 IF((leastgrowth.LT.fail).OR.nofail)
THEN
324 dplus( 1 ) = d( 1 ) + s
326 lplus( i ) = ld( i ) / dplus( i )
327 s = s*lplus( i )*l( i ) - lsigma
328 dplus( i+1 ) = d( i+1 ) + s
329 IF(abs(dplus(i+1)).LT.pivmin)
THEN
343 IF (shift.EQ.sleft .OR. shift.EQ.smid )
THEN
344 ELSEIF (shift.EQ.sright)
THEN
346 CALL dcopy( n, work, 1, dplus, 1 )
347 CALL dcopy( n-1, work(n+1), 1, lplus, 1 )