299 SUBROUTINE dlarre( RANGE, N, VL, VU, IL, IU, D, E, E2,
300 $ RTOL1, RTOL2, SPLTOL, NSPLIT, ISPLIT, M,
301 $ W, WERR, WGAP, IBLOCK, INDEXW, GERS, PIVMIN,
302 $ WORK, IWORK, INFO )
310 INTEGER IL, INFO, IU, M, N, NSPLIT
311 DOUBLE PRECISION PIVMIN, RTOL1, RTOL2, SPLTOL, VL, VU
314 INTEGER IBLOCK( * ), ISPLIT( * ), IWORK( * ),
316 DOUBLE PRECISION D( * ), E( * ), E2( * ), GERS( * ),
317 $ w( * ),werr( * ), wgap( * ), work( * )
323 DOUBLE PRECISION FAC, FOUR, FOURTH, FUDGE, HALF, HNDRD,
324 $ MAXGROWTH, ONE, PERT, TWO, ZERO
325 PARAMETER ( ZERO = 0.0d0, one = 1.0d0,
326 $ two = 2.0d0, four=4.0d0,
329 $ half = one/two, fourth = one/four, fac= half,
330 $ maxgrowth = 64.0d0, fudge = 2.0d0 )
331 INTEGER MAXTRY, ALLRNG, INDRNG, VALRNG
332 PARAMETER ( MAXTRY = 6, allrng = 1, indrng = 2,
336 LOGICAL FORCEB, NOREP, USEDQD
337 INTEGER CNT, CNT1, CNT2, I, IBEGIN, IDUM, IEND, IINFO,
338 $ IN, INDL, INDU, IRANGE, J, JBLK, MB, MM,
340 DOUBLE PRECISION AVGAP, BSRTOL, CLWDTH, DMAX, DPIVOT, EABS,
341 $ EMAX, EOLD, EPS, GL, GU, ISLEFT, ISRGHT, RTL,
342 $ RTOL, S1, S2, SAFMIN, SGNDEF, SIGMA, SPDIAM,
352 DOUBLE PRECISION DLAMCH
353 EXTERNAL DLAMCH, LSAME
362 INTRINSIC abs, max, min
380 IF( lsame( range,
'A' ) )
THEN
382 ELSE IF( lsame( range,
'V' ) )
THEN
384 ELSE IF( lsame( range,
'I' ) )
THEN
389 safmin = dlamch(
'S' )
398 IF( (irange.EQ.allrng).OR.
399 $ ((irange.EQ.valrng).AND.(d(1).GT.vl).AND.(d(1).LE.vu)).OR.
400 $ ((irange.EQ.indrng).AND.(il.EQ.1).AND.(iu.EQ.1)) )
THEN
429 IF( eabs .GE. emax )
THEN
433 gers( 2*i-1) = d(i) - tmp1
434 gl = min( gl, gers( 2*i - 1))
435 gers( 2*i ) = d(i) + tmp1
436 gu = max( gu, gers(2*i) )
440 pivmin = safmin * max( one, emax**2 )
446 CALL dlarra( n, d, e, e2, spltol, spdiam,
447 $ nsplit, isplit, iinfo )
455 usedqd = (( irange.EQ.allrng ) .AND. (.NOT.forceb))
457 IF( (irange.EQ.allrng) .AND. (.NOT. forceb) )
THEN
468 CALL dlarrd( range,
'B', n, vl, vu, il, iu, gers,
469 $ bsrtol, d, e, e2, pivmin, nsplit, isplit,
470 $ mm, w, werr, vl, vu, iblock, indexw,
471 $ work, iwork, iinfo )
472 IF( iinfo.NE.0 )
THEN
490 DO 170 jblk = 1, nsplit
491 iend = isplit( jblk )
492 in = iend - ibegin + 1
496 IF( (irange.EQ.allrng).OR.( (irange.EQ.valrng).AND.
497 $ ( d( ibegin ).GT.vl ).AND.( d( ibegin ).LE.vu ) )
498 $ .OR. ( (irange.EQ.indrng).AND.(iblock(wbegin).EQ.jblk))
524 DO 15 i = ibegin , iend
525 gl = min( gers( 2*i-1 ), gl )
526 gu = max( gers( 2*i ), gu )
530 IF(.NOT. ((irange.EQ.allrng).AND.(.NOT.forceb)) )
THEN
534 IF( iblock(i).EQ.jblk )
THEN
551 usedqd = ( (mb .GT. fac*in) .AND. (.NOT.forceb) )
552 wend = wbegin + mb - 1
557 DO 30 i = wbegin, wend - 1
558 wgap( i ) = max( zero,
559 $ w(i+1)-werr(i+1) - (w(i)+werr(i)) )
561 wgap( wend ) = max( zero,
562 $ vu - sigma - (w( wend )+werr( wend )))
564 indl = indexw(wbegin)
565 indu = indexw( wend )
568 IF(( (irange.EQ.allrng) .AND. (.NOT. forceb) ).OR.usedqd)
THEN
571 CALL dlarrk( in, 1, gl, gu, d(ibegin),
572 $ e2(ibegin), pivmin, rtl, tmp, tmp1, iinfo )
573 IF( iinfo.NE.0 )
THEN
577 isleft = max(gl, tmp - tmp1
578 $ - hndrd * eps* abs(tmp - tmp1))
580 CALL dlarrk( in, in, gl, gu, d(ibegin),
581 $ e2(ibegin), pivmin, rtl, tmp, tmp1, iinfo )
582 IF( iinfo.NE.0 )
THEN
586 isrght = min(gu, tmp + tmp1
587 $ + hndrd * eps * abs(tmp + tmp1))
589 spdiam = isrght - isleft
593 isleft = max(gl, w(wbegin) - werr(wbegin)
594 $ - hndrd * eps*abs(w(wbegin)- werr(wbegin) ))
595 isrght = min(gu,w(wend) + werr(wend)
596 $ + hndrd * eps * abs(w(wend)+ werr(wend)))
608 IF( ( irange.EQ.allrng ) .AND. (.NOT.forceb) )
THEN
616 wend = wbegin + mb - 1
618 s1 = isleft + fourth * spdiam
619 s2 = isrght - fourth * spdiam
625 s1 = isleft + fourth * spdiam
626 s2 = isrght - fourth * spdiam
628 tmp = min(isrght,vu) - max(isleft,vl)
629 s1 = max(isleft,vl) + fourth * tmp
630 s2 = min(isrght,vu) - fourth * tmp
636 CALL dlarrc(
'T', in, s1, s2, d(ibegin),
637 $ e(ibegin), pivmin, cnt, cnt1, cnt2, iinfo)
643 ELSEIF( cnt1 - indl .GE. indu - cnt2 )
THEN
644 IF( ( irange.EQ.allrng ) .AND. (.NOT.forceb) )
THEN
645 sigma = max(isleft,gl)
646 ELSEIF( usedqd )
THEN
653 sigma = max(isleft,vl)
657 IF( ( irange.EQ.allrng ) .AND. (.NOT.forceb) )
THEN
658 sigma = min(isrght,gu)
659 ELSEIF( usedqd )
THEN
666 sigma = min(isrght,vu)
680 tau = spdiam*eps*n + two*pivmin
681 tau = max( tau,two*eps*abs(sigma) )
684 clwdth = w(wend) + werr(wend) - w(wbegin) - werr(wbegin)
685 avgap = abs(clwdth / dble(wend-wbegin))
686 IF( sgndef.EQ.one )
THEN
687 tau = half*max(wgap(wbegin),avgap)
688 tau = max(tau,werr(wbegin))
690 tau = half*max(wgap(wend-1),avgap)
691 tau = max(tau,werr(wend))
698 DO 80 idum = 1, maxtry
702 dpivot = d( ibegin ) - sigma
704 dmax = abs( work(1) )
707 work( 2*in+i ) = one / work( i )
708 tmp = e( j )*work( 2*in+i )
710 dpivot = ( d( j+1 )-sigma ) - tmp*e( j )
712 dmax = max( dmax, abs(dpivot) )
716 IF( dmax .GT. maxgrowth*spdiam )
THEN
721 IF( usedqd .AND. .NOT.norep )
THEN
725 tmp = sgndef*work( i )
726 IF( tmp.LT.zero ) norep = .true.
733 IF( idum.EQ.maxtry-1 )
THEN
734 IF( sgndef.EQ.one )
THEN
737 $ gl - fudge*spdiam*eps*n - fudge*two*pivmin
740 $ gu + fudge*spdiam*eps*n + fudge*two*pivmin
743 sigma = sigma - sgndef * tau
762 CALL dcopy( in, work, 1, d( ibegin ), 1 )
763 CALL dcopy( in-1, work( in+1 ), 1, e( ibegin ), 1 )
776 CALL dlarnv(2, iseed, 2*in-1, work(1))
778 d(ibegin+i-1) = d(ibegin+i-1)*(one+eps*pert*work(i))
779 e(ibegin+i-1) = e(ibegin+i-1)*(one+eps*pert*work(in+i))
781 d(iend) = d(iend)*(one+eps*four*work(in))
791 IF ( .NOT.usedqd )
THEN
799 werr(j) = werr(j) + abs(w(j)) * eps
803 DO 135 i = ibegin, iend-1
804 work( i ) = d( i ) * e( i )**2
807 CALL dlarrb(in, d(ibegin), work(ibegin),
808 $ indl, indu, rtol1, rtol2, indl-1,
809 $ w(wbegin), wgap(wbegin), werr(wbegin),
810 $ work( 2*n+1 ), iwork, pivmin, spdiam,
812 IF( iinfo .NE. 0 )
THEN
818 wgap( wend ) = max( zero,
819 $ ( vu-sigma ) - ( w( wend ) + werr( wend ) ) )
820 DO 138 i = indl, indu
837 rtol = log(dble(in)) * four * eps
840 work( 2*i-1 ) = abs( d( j ) )
841 work( 2*i ) = e( j )*e( j )*work( 2*i-1 )
844 work( 2*in-1 ) = abs( d( iend ) )
846 CALL dlasq2( in, work, iinfo )
847 IF( iinfo .NE. 0 )
THEN
856 IF( work( i ).LT.zero )
THEN
862 IF( sgndef.GT.zero )
THEN
863 DO 150 i = indl, indu
865 w( m ) = work( in-i+1 )
870 DO 160 i = indl, indu
878 DO 165 i = m - mb + 1, m
880 werr( i ) = rtol * abs( w(i) )
882 DO 166 i = m - mb + 1, m - 1
884 wgap( i ) = max( zero,
885 $ w(i+1)-werr(i+1) - (w(i)+werr(i)) )
887 wgap( m ) = max( zero,
888 $ ( vu-sigma ) - ( w( m ) + werr( m ) ) )