189 SUBROUTINE dlarrf( N, D, L, LD, CLSTRT, CLEND,
191 $ SPDIAM, CLGAPL, CLGAPR, PIVMIN, SIGMA,
192 $ DPLUS, LPLUS, WORK, INFO )
199 INTEGER CLSTRT, CLEND, INFO, N
200 DOUBLE PRECISION CLGAPL, CLGAPR, PIVMIN, SIGMA, SPDIAM
203 DOUBLE PRECISION D( * ), DPLUS( * ), L( * ), LD( * ),
204 $ LPLUS( * ), W( * ), WGAP( * ), WERR( * ), WORK( * )
210 DOUBLE PRECISION FOUR, MAXGROWTH1, MAXGROWTH2, ONE, QUART, TWO
211 PARAMETER ( ONE = 1.0d0, two = 2.0d0, four = 4.0d0,
214 $ maxgrowth2 = 8.d0 )
217 LOGICAL DORRR1, FORCER, NOFAIL, SAWNAN1, SAWNAN2, TRYRRR1
218 INTEGER I, INDX, KTRY, KTRYMAX, SLEFT, SRIGHT, SHIFT
219 PARAMETER ( KTRYMAX = 1, sleft = 1, sright = 2 )
220 DOUBLE PRECISION AVGAP, BESTSHIFT, CLWDTH, EPS, FACT, FAIL,
221 $ fail2, growthbound, ldelta, ldmax, lsigma,
222 $ max1, max2, mingap, oldp, prod, rdelta, rdmax,
223 $ rrr1, rrr2, rsigma, s, smlgrowth, tmp, znm2
227 DOUBLE PRECISION DLAMCH
228 EXTERNAL DISNAN, DLAMCH
246 fact = dble(2**ktrymax)
247 eps = dlamch(
'Precision' )
269 clwdth = abs(w(clend)-w(clstrt)) + werr(clend) + werr(clstrt)
270 avgap = clwdth / dble(clend-clstrt)
271 mingap = min(clgapl, clgapr)
273 lsigma = min(w( clstrt ),w( clend )) - werr( clstrt )
274 rsigma = max(w( clstrt ),w( clend )) + werr( clend )
277 lsigma = lsigma - abs(lsigma)* four * eps
278 rsigma = rsigma + abs(rsigma)* four * eps
281 ldmax = quart * mingap + two * pivmin
282 rdmax = quart * mingap + two * pivmin
284 ldelta = max(avgap,wgap( clstrt ))/fact
285 rdelta = max(avgap,wgap( clend-1 ))/fact
291 fail = dble(n-1)*mingap/(spdiam*eps)
292 fail2 = dble(n-1)*mingap/(spdiam*sqrt(eps))
297 growthbound = maxgrowth1*spdiam
303 ldelta = min(ldmax,ldelta)
304 rdelta = min(rdmax,rdelta)
311 dplus( 1 ) = d( 1 ) + s
312 IF(abs(dplus(1)).LT.pivmin)
THEN
318 max1 = abs( dplus( 1 ) )
320 lplus( i ) = ld( i ) / dplus( i )
321 s = s*lplus( i )*l( i ) - lsigma
322 dplus( i+1 ) = d( i+1 ) + s
323 IF(abs(dplus(i+1)).LT.pivmin)
THEN
329 max1 = max( max1,abs(dplus(i+1)) )
331 sawnan1 = sawnan1 .OR. disnan( max1 )
334 $ (max1.LE.growthbound .AND. .NOT.sawnan1 ) )
THEN
342 work( 1 ) = d( 1 ) + s
343 IF(abs(work(1)).LT.pivmin)
THEN
349 max2 = abs( work( 1 ) )
351 work( n+i ) = ld( i ) / work( i )
352 s = s*work( n+i )*l( i ) - rsigma
353 work( i+1 ) = d( i+1 ) + s
354 IF(abs(work(i+1)).LT.pivmin)
THEN
360 max2 = max( max2,abs(work(i+1)) )
362 sawnan2 = sawnan2 .OR. disnan( max2 )
365 $ (max2.LE.growthbound .AND. .NOT.sawnan2 ) )
THEN
373 IF(sawnan1.AND.sawnan2)
THEN
377 IF( .NOT.sawnan1 )
THEN
379 IF(max1.LE.smlgrowth)
THEN
384 IF( .NOT.sawnan2 )
THEN
385 IF(sawnan1 .OR. max2.LE.max1) indx = 2
386 IF(max2.LE.smlgrowth)
THEN
398 IF((clwdth.LT.mingap/dble(128)) .AND.
399 $ (min(max1,max2).LT.fail2)
400 $ .AND.(.NOT.sawnan1).AND.(.NOT.sawnan2))
THEN
406 IF( tryrrr1 .AND. dorrr1 )
THEN
408 tmp = abs( dplus( n ) )
413 IF( prod .LE. eps )
THEN
415 $ ((dplus(i+1)*work(n+i+1))/(dplus(i)*work(n+i)))*oldp
417 prod = prod*abs(work(n+i))
420 znm2 = znm2 + prod**2
421 tmp = max( tmp, abs( dplus( i ) * prod ))
423 rrr1 = tmp/( spdiam * sqrt( znm2 ) )
424 IF (rrr1.LE.maxgrowth2)
THEN
429 ELSE IF(indx.EQ.2)
THEN
430 tmp = abs( work( n ) )
435 IF( prod .LE. eps )
THEN
436 prod = ((work(i+1)*lplus(i+1))/(work(i)*lplus(i)))*oldp
438 prod = prod*abs(lplus(i))
441 znm2 = znm2 + prod**2
442 tmp = max( tmp, abs( work( i ) * prod ))
444 rrr2 = tmp/( spdiam * sqrt( znm2 ) )
445 IF (rrr2.LE.maxgrowth2)
THEN
455 IF (ktry.LT.ktrymax)
THEN
458 lsigma = max( lsigma - ldelta,
460 rsigma = min( rsigma + rdelta,
462 ldelta = two * ldelta
463 rdelta = two * rdelta
469 IF((smlgrowth.LT.fail).OR.nofail)
THEN
481 IF (shift.EQ.sleft)
THEN
482 ELSEIF (shift.EQ.sright)
THEN
484 CALL dcopy( n, work, 1, dplus, 1 )
485 CALL dcopy( n-1, work(n+1), 1, lplus, 1 )
subroutine dcopy(n, dx, incx, dy, incy)
DCOPY
subroutine dlarrf(n, d, l, ld, clstrt, clend, w, wgap, werr, spdiam, clgapl, clgapr, pivmin, sigma, dplus, lplus, work, info)
DLARRF finds a new relatively robust representation such that at least one of the eigenvalues is rela...