1 SUBROUTINE slarrd2( RANGE, ORDER, N, VL, VU, IL, IU, GERS,
2 $ RELTOL, D, E, E2, PIVMIN, NSPLIT, ISPLIT,
3 $ M, W, WERR, WL, WU, IBLOCK, INDEXW,
4 $ WORK, IWORK, DOL, DOU, INFO )
11 CHARACTER ORDER, RANGE
12 INTEGER DOL, DOU, IL, INFO, IU, M, N, NSPLIT
13 REAL PIVMIN, RELTOL, VL, VU, WL, WU
16 INTEGER IBLOCK( * ), INDEXW( * ),
17 $ ISPLIT( * ), IWORK( * )
18 REAL D( * ), E( * ), E2( * ),
19 $ gers( * ), w( * ), werr( * ), work( * )
205 REAL ZERO, ONE, TWO, HALF, FUDGE
206 PARAMETER ( ZERO = 0.0e0, one = 1.0e0,
207 $ two = 2.0e0, half = one/two,
212 LOGICAL NCNVRG, TOOFEW
213 INTEGER I, IB, IBEGIN, IDISCL, IDISCU, IE, IEND, IINFO,
214 $ IM, IN, IOFF, IORDER, IOUT, IRANGE, ITMAX,
215 $ itmp1, itmp2, iw, iwoff, j, jblk, jdisc, je,
217 REAL ATOLI, EPS, GL, GU, RTOLI, SPDIAM, TMP1, TMP2,
218 $ TNORM, UFLOW, WKILL, WLU, WUL
228 EXTERNAL lsame, ilaenv, slamch
234 INTRINSIC abs, int, log,
max,
min, sqrt
242 IF( lsame( range,
'A' ) )
THEN
244 ELSE IF( lsame( range,
'V' ) )
THEN
246 ELSE IF( lsame( range,
'I' ) )
THEN
254 IF( lsame( order,
'B' ) )
THEN
256 ELSE IF( lsame( order,
'E' ) )
THEN
264 IF( irange.LE.0 )
THEN
266 ELSE IF( iorder.LE.0 )
THEN
268 ELSE IF( n.LT.0 )
THEN
270 ELSE IF( irange.EQ.2 )
THEN
273 ELSE IF( irange.EQ.3 .AND. ( il.LT.1 .OR. il.GT.
max( 1, n ) ) )
276 ELSE IF( irange.EQ.3 .AND. ( iu.LT.
min( n, il ) .OR. iu.GT.n ) )
295 IF( irange.EQ.3 .AND. il.EQ.1 .AND. iu.EQ.n ) irange = 1
299 uflow = slamch(
'U' )
305 IF( (irange.EQ.1).OR.
306 $ ((irange.EQ.2).AND.(d(1).GT.vl).AND.(d(1).LE.vu)).OR.
307 $ ((irange.EQ.3).AND.(il.EQ.1).AND.(iu.EQ.1)) )
THEN
320 nb = ilaenv( 1,
'SSTEBZ',
' ', n, -1, -1, -1 )
327 gl =
min( gl, gers( 2*i - 1))
328 gu =
max( gu, gers(2*i) )
331 tnorm =
max( abs( gl ), abs( gu ) )
332 gl = gl - fudge*tnorm*eps*n - fudge*two*pivmin
333 gu = gu + fudge*tnorm*eps*n + fudge*two*pivmin
339 atoli = fudge*two*uflow + fudge*two*pivmin
341 IF( irange.EQ.3 )
THEN
346 itmax = int( ( log( tnorm+pivmin )-log( pivmin ) ) /
361 CALL slaebz( 3, itmax, n, 2, 2, nb, atoli, rtoli, pivmin,
362 $ d, e, e2, iwork( 5 ), work( n+1 ), work( n+5 ), iout,
363 $ iwork, w, iblock, iinfo )
364 IF( iinfo .NE. 0 )
THEN
369 IF( iwork( 6 ).EQ.iu )
THEN
386 IF( nwl.LT.0 .OR. nwl.GE.n .OR. nwu.LT.1 .OR. nwu.GT.n )
THEN
391 ELSEIF( irange.EQ.2 )
THEN
395 ELSEIF( irange.EQ.1 )
THEN
411 DO 70 jblk = 1, nsplit
414 iend = isplit( jblk )
417 IF( irange.EQ.1 )
THEN
418 IF( (iend.LT.dol).OR.(ibegin.GT.dou) )
THEN
432 IF( wl.GE.d( ibegin )-pivmin )
434 IF( wu.GE.d( ibegin )-pivmin )
436 IF( irange.EQ.1 .OR. ( wl.LT.d( ibegin )-pivmin .AND. wu.GE.
437 $ d( ibegin )-pivmin ) )
THEN
454 DO 40 j = ibegin, iend
455 gl =
min( gl, gers( 2*j - 1))
456 gu =
max( gu, gers(2*j) )
459 gl = gl - fudge*tnorm*eps*in - fudge*pivmin
460 gu = gu + fudge*tnorm*eps*in + fudge*pivmin
462 IF( irange.GT.1 )
THEN
479 CALL slaebz( 1, 0, in, in, 1, nb, atoli, rtoli, pivmin,
480 $ d( ibegin ), e( ibegin ), e2( ibegin ),
481 $ idumma, work( n+1 ), work( n+2*in+1 ), im,
482 $ iwork, w( m+1 ), iblock( m+1 ), iinfo )
483 IF( iinfo .NE. 0 )
THEN
488 nwl = nwl + iwork( 1 )
489 nwu = nwu + iwork( in+1 )
490 iwoff = m - iwork( 1 )
493 itmax = int( ( log( gu-gl+pivmin )-log( pivmin ) ) /
495 CALL slaebz( 2, itmax, in, in, 1, nb, atoli, rtoli, pivmin,
496 $ d( ibegin ), e( ibegin ), e2( ibegin ),
497 $ idumma, work( n+1 ), work( n+2*in+1 ), iout,
498 $ iwork, w( m+1 ), iblock( m+1 ), iinfo )
499 IF( iinfo .NE. 0 )
THEN
509 tmp1 = half*( work( j+n )+work( j+in+n ) )
511 tmp2 = half*abs( work( j+n )-work( j+in+n ) )
512 IF( j.GT.iout-iinfo )
THEN
519 DO 50 je = iwork( j ) + 1 + iwoff,
520 $ iwork( j+in ) + iwoff
523 indexw( je ) = je - iwoff
534 IF( irange.EQ.3 )
THEN
535 idiscl = il - 1 - nwl
538 IF( idiscl.GT.0 )
THEN
543 IF( w( je ).LE.wlu .AND. idiscl.GT.0 )
THEN
548 werr( im ) = werr( je )
549 indexw( im ) = indexw( je )
550 iblock( im ) = iblock( je )
555 IF( idiscu.GT.0 )
THEN
560 IF( w( je ).GE.wul .AND. idiscu.GT.0 )
THEN
565 werr( im ) = werr( je )
566 indexw( im ) = indexw( je )
567 iblock( im ) = iblock( je )
574 werr( jee ) = werr( je )
575 indexw( jee ) = indexw( je )
576 iblock( jee ) = iblock( je )
581 IF( idiscl.GT.0 .OR. idiscu.GT.0 )
THEN
588 IF( idiscl.GT.0 )
THEN
590 DO 100 jdisc = 1, idiscl
593 IF( iblock( je ).NE.0 .AND.
594 $ ( w( je ).LT.wkill .OR. iw.EQ.0 ) )
THEN
602 IF( idiscu.GT.0 )
THEN
604 DO 120 jdisc = 1, idiscu
607 IF( iblock( je ).NE.0 .AND.
608 $ ( w( je ).GE.wkill .OR. iw.EQ.0 ) )
THEN
619 IF( iblock( je ).NE.0 )
THEN
622 werr( im ) = werr( je )
623 indexw( im ) = indexw( je )
624 iblock( im ) = iblock( je )
629 IF( idiscl.LT.0 .OR. idiscu.LT.0 )
THEN
634 IF(( irange.EQ.1 .AND. m.NE.n ).OR.
635 $ ( irange.EQ.3 .AND. m.NE.iu-il+1 ) )
THEN
643 IF( iorder.EQ.1 .AND. nsplit.GT.1 )
THEN
648 IF( w( j ).LT.tmp1 )
THEN
658 werr( ie ) = werr( je )
659 iblock( ie ) = iblock( je )
660 indexw( ie ) = indexw( je )