1 SUBROUTINE slarre2a( RANGE, N, VL, VU, IL, IU, D, E, E2,
2 $ RTOL1, RTOL2, SPLTOL, NSPLIT, ISPLIT,
3 $ M, DOL, DOU, NEEDIL, NEEDIU,
4 $ W, WERR, WGAP, IBLOCK, INDEXW, GERS,
5 $ SDIAM, PIVMIN, WORK, IWORK, MINRGP, INFO )
15 INTEGER DOL, DOU, IL, INFO, IU, M, N, NSPLIT,
17 REAL MINRGP, PIVMIN, RTOL1, RTOL2, SPLTOL, VL, VU
20 INTEGER IBLOCK( * ), ISPLIT( * ), IWORK( * ),
22 REAL D( * ), E( * ), E2( * ), GERS( * ),
23 $ SDIAM( * ), W( * ),WERR( * ),
24 $ wgap( * ), work( * )
208 REAL FAC, FOUR, FOURTH, FUDGE, HALF, HNDRD,
209 $ MAXGROWTH, ONE, PERT, TWO, ZERO
210 PARAMETER ( ZERO = 0.0e0, one = 1.0e0,
211 $ two = 2.0e0, four=4.0e0,
214 $ half = one/two, fourth = one/four, fac= half,
215 $ maxgrowth = 64.0e0, fudge = 2.0e0 )
217 PARAMETER ( MAXTRY = 6 )
220 LOGICAL NOREP, RNDPRT, USEDQD
221 INTEGER CNT, CNT1, CNT2, I, IBEGIN, IDUM, IEND, IINFO,
222 $ IN, INDL, INDU, IRANGE, J, JBLK, MB, MM,
223 $ MYINDL, MYINDU, MYWBEG, MYWEND, WBEGIN, WEND
224 REAL AVGAP, BSRTOL, CLWDTH, DMAX, DPIVOT, EABS,
225 $ emax, eold, eps, gl, gu, isleft, isrght,
226 $ lgpvmn, lgspdm, rtl, s1, s2, safmin, sgndef,
227 $ sigma, spdiam, tau, tmp, tmp1, tmp2
237 EXTERNAL SLAMCH, LSAME
241 EXTERNAL scopy, slarnv, slarra,
slarrb2,
258 IF( lsame( range,
'A' ) )
THEN
260 ELSE IF( lsame( range,
'V' ) )
THEN
262 ELSE IF( lsame( range,
'I' ) )
THEN
269 safmin = slamch(
'S' )
278 IF( (irange.EQ.1).OR.
279 $ ((irange.EQ.2).AND.(d(1).GT.vl).AND.(d(1).LE.vu)).OR.
280 $ ((irange.EQ.3).AND.(il.EQ.1).AND.(iu.EQ.1)) )
THEN
315 IF( eabs .GE. emax )
THEN
328 pivmin = safmin *
max( one, emax**2 )
334 CALL slarra( n, d, e, e2, spltol, spdiam,
335 $ nsplit, isplit, iinfo )
337 IF( irange.EQ.1 )
THEN
349 CALL slarrd2( range,
'B', n, vl, vu, il, iu, gers,
350 $ bsrtol, d, e, e2, pivmin, nsplit, isplit,
351 $ mm, w, werr, vl, vu, iblock, indexw,
352 $ work, iwork, dol, dou, iinfo )
353 IF( iinfo.NE.0 )
THEN
370 DO 170 jblk = 1, nsplit
371 iend = isplit( jblk )
372 in = iend - ibegin + 1
376 IF( (irange.EQ.1).OR.( (irange.EQ.2).AND.
377 $ ( d( ibegin ).GT.vl ).AND.( d( ibegin ).LE.vu ) )
378 $ .OR. ( (irange.EQ.3).AND.(iblock(wbegin).EQ.jblk))
401 IF( ( irange.EQ.1 ) .OR.
402 $ ((irange.EQ.3).AND.(il.EQ.1.AND.iu.EQ.n)) )
THEN
405 wend = wbegin + mb - 1
412 IF( iblock(i).EQ.jblk )
THEN
428 wend = wbegin + mb - 1
430 indl = indexw(wbegin)
431 indu = indexw( wend )
434 IF( (wend.LT.dol).OR.(wbegin.GT.dou) )
THEN
443 IF(.NOT. ( irange.EQ.1 ) )
THEN
452 usedqd = ( mb .GT. fac*in )
458 DO 30 i = wbegin, wend - 1
459 wgap( i ) =
max( zero,
460 $ w(i+1)-werr(i+1) - (w(i)+werr(i)) )
462 wgap( wend ) =
max( zero,
463 $ vu - sigma - (w( wend )+werr( wend )))
470 DO 15 i = ibegin , iend
471 gl =
min( gers( 2*i-1 ), gl )
472 gu =
max( gers( 2*i ), gu )
479 CALL slarrk( in, 1, gl, gu, d(ibegin),
480 $ e2(ibegin), pivmin, rtl, tmp, tmp1, iinfo )
481 IF( iinfo.NE.0 )
THEN
485 isleft =
max(gl, tmp - tmp1
486 $ - hndrd * eps* abs(tmp - tmp1))
487 CALL slarrk( in, in, gl, gu, d(ibegin),
488 $ e2(ibegin), pivmin, rtl, tmp, tmp1, iinfo )
489 IF( iinfo.NE.0 )
THEN
493 isrght =
min(gu, tmp + tmp1
494 $ + hndrd * eps * abs(tmp + tmp1))
495 IF( ( irange.EQ.1 ).OR.usedqd )
THEN
498 spdiam = isrght - isleft
502 isleft =
max(gl, w(wbegin) - werr(wbegin)
503 $ - hndrd * eps*abs(w(wbegin)- werr(wbegin) ))
504 isrght =
min(gu,w(wend) + werr(wend)
505 $ + hndrd * eps * abs(w(wend)+ werr(wend)))
513 IF( irange.EQ.1 )
THEN
521 wend = wbegin + mb - 1
523 s1 = isleft + fourth * spdiam
524 s2 = isrght - fourth * spdiam
530 s1 = isleft + fourth * spdiam
531 s2 = isrght - fourth * spdiam
533 tmp =
min(isrght,vu) -
max(isleft,vl)
534 s1 =
max(isleft,vl) + fourth * tmp
535 s2 =
min(isrght,vu) - fourth * tmp
541 CALL slarrc(
'T', in, s1, s2, d(ibegin),
542 $ e(ibegin), pivmin, cnt, cnt1, cnt2, iinfo)
548 ELSEIF( cnt1 - indl .GE. indu - cnt2 )
THEN
549 IF( irange.EQ.1 )
THEN
550 sigma =
max(isleft,gl)
551 ELSEIF( usedqd )
THEN
557 sigma =
max(isleft,vl)
561 IF( irange.EQ.1 )
THEN
562 sigma =
min(isrght,gu)
563 ELSEIF( usedqd )
THEN
570 sigma =
min(isrght,vu)
582 tau = spdiam*eps*n + two*pivmin
583 tau =
max(tau,eps*abs(sigma))
586 clwdth = w(wend) + werr(wend) - w(wbegin) - werr(wbegin)
587 avgap = abs(clwdth / real(wend-wbegin))
588 IF( sgndef.EQ.one )
THEN
589 tau = half*
max(wgap(wbegin),avgap)
590 tau =
max(tau,werr(wbegin))
592 tau = half*
max(wgap(wend-1),avgap)
593 tau =
max(tau,werr(wend))
600 DO 80 idum = 1, maxtry
604 dpivot = d( ibegin ) - sigma
606 dmax = abs( work(1) )
609 work( 2*in+i ) = one / work( i )
610 tmp = e( j )*work( 2*in+i )
612 dpivot = ( d( j+1 )-sigma ) - tmp*e( j )
614 dmax =
max( dmax, abs(dpivot) )
618 IF( dmax .GT. maxgrowth*spdiam )
THEN
627 IF( idum.EQ.maxtry-1 )
THEN
628 IF( sgndef.EQ.one )
THEN
631 $ gl - fudge*spdiam*eps*n - fudge*two*pivmin
634 $ gu + fudge*spdiam*eps*n + fudge*two*pivmin
637 sigma = sigma - sgndef * tau
656 CALL scopy( in, work, 1, d( ibegin ), 1 )
657 CALL scopy( in-1, work( in+1 ), 1, e( ibegin ), 1 )
660 IF(rndprt .AND. mb.GT.1 )
THEN
670 CALL slarnv(2, iseed, 2*in-1, work(1))
672 d(ibegin+i-1) = d(ibegin+i-1)*(one+eps*pert*work(2*i-1))
673 e(ibegin+i-1) = e(ibegin+i-1)*(one+eps*pert*work(2*i))
675 d(iend) = d(iend)*(one+eps*pert*work(2*in-1))
684 werr(j) = werr(j) + abs(w(j)) * eps
688 DO 135 i = ibegin, iend-1
689 work( i ) = d( i ) * e( i )**2
692 indl = indexw( wbegin )
693 indu = indexw( wend )
698 needil =
min(needil,wbegin)
699 neediu =
max(neediu,wend)
704 mywbeg =
max(wbegin,dol)
705 mywend =
min(wend,dou)
707 IF(mywbeg.GT.wbegin)
THEN
713 DO 136 i = wbegin, mywbeg-1
714 IF ( wgap(i).GE.minrgp*abs(w(i)) )
THEN
715 needil =
max(i+1,needil)
719 IF(mywend.LT.wend)
THEN
723 DO 137 i = mywend,wend-1
724 IF ( wgap(i).GE.minrgp*abs(w(i)) )
THEN
725 neediu =
min(i,neediu)
735 myindl = indexw( mywbeg )
736 myindu = indexw( mywend )
738 lgpvmn = log( pivmin )
739 lgspdm = log( spdiam + pivmin )
741 CALL slarrb2(in, d(ibegin), work(ibegin),
742 $ myindl, myindu, rtol1, rtol2, myindl-1,
743 $ w(mywbeg), wgap(mywbeg), werr(mywbeg),
744 $ work( 2*n+1 ), iwork, pivmin,
745 $ lgpvmn, lgspdm, in, iinfo )
746 IF( iinfo .NE. 0 )
THEN
752 wgap( wend ) =
max( zero,
753 $ ( vu-sigma ) - ( w( wend ) + werr( wend ) ) )
754 DO 140 i = indl, indu
765 IF (m.LT.dou-dol+1)
THEN