268 SUBROUTINE sstebz( RANGE, ORDER, N, VL, VU, IL, IU, ABSTOL, D,
270 $ M, NSPLIT, W, IBLOCK, ISPLIT, WORK, IWORK,
278 CHARACTER ORDER, RANGE
279 INTEGER IL, INFO, IU, M, N, NSPLIT
283 INTEGER IBLOCK( * ), ISPLIT( * ), IWORK( * )
284 REAL D( * ), E( * ), W( * ), WORK( * )
290 REAL ZERO, ONE, TWO, HALF
291 PARAMETER ( ZERO = 0.0e0, one = 1.0e0, two = 2.0e0,
292 $ half = 1.0e0 / two )
294 parameter( fudge = 2.1e0, relfac = 2.0e0 )
297 LOGICAL NCNVRG, TOOFEW
298 INTEGER IB, IBEGIN, IDISCL, IDISCU, IE, IEND, IINFO,
299 $ IM, IN, IOFF, IORDER, IOUT, IRANGE, ITMAX,
300 $ itmp1, iw, iwoff, j, jb, jdisc, je, nb, nwl,
302 REAL ATOLI, BNORM, GL, GU, PIVMIN, RTOLI, SAFEMN,
303 $ TMP1, TMP2, TNORM, ULP, WKILL, WL, WLU, WU, WUL
312 EXTERNAL lsame, ilaenv, slamch
318 INTRINSIC abs, int, log, max, min, sqrt
326 IF( lsame( range,
'A' ) )
THEN
328 ELSE IF( lsame( range,
'V' ) )
THEN
330 ELSE IF( lsame( range,
'I' ) )
THEN
338 IF( lsame( order,
'B' ) )
THEN
340 ELSE IF( lsame( order,
'E' ) )
THEN
348 IF( irange.LE.0 )
THEN
350 ELSE IF( iorder.LE.0 )
THEN
352 ELSE IF( n.LT.0 )
THEN
354 ELSE IF( irange.EQ.2 )
THEN
355 IF( vl.GE.vu ) info = -5
356 ELSE IF( irange.EQ.3 .AND. ( il.LT.1 .OR. il.GT.max( 1, n ) ) )
359 ELSE IF( irange.EQ.3 .AND. ( iu.LT.min( n, il ) .OR. iu.GT.n ) )
365 CALL xerbla(
'SSTEBZ', -info )
383 IF( irange.EQ.3 .AND. il.EQ.1 .AND. iu.EQ.n )
390 safemn = slamch(
'S' )
393 nb = ilaenv( 1,
'SSTEBZ',
' ', n, -1, -1, -1 )
402 IF( irange.EQ.2 .AND. ( vl.GE.d( 1 ) .OR. vu.LT.d( 1 ) ) )
THEN
420 IF( abs( d( j )*d( j-1 ) )*ulp**2+safemn.GT.tmp1 )
THEN
421 isplit( nsplit ) = j - 1
426 pivmin = max( pivmin, tmp1 )
430 pivmin = pivmin*safemn
434 IF( irange.EQ.3 )
THEN
447 tmp2 = sqrt( work( j ) )
448 gu = max( gu, d( j )+tmp1+tmp2 )
449 gl = min( gl, d( j )-tmp1-tmp2 )
453 gu = max( gu, d( n )+tmp1 )
454 gl = min( gl, d( n )-tmp1 )
455 tnorm = max( abs( gl ), abs( gu ) )
456 gl = gl - fudge*tnorm*ulp*real( n ) - fudge*two*pivmin
457 gu = gu + fudge*tnorm*ulp*real( n ) + fudge*pivmin
461 itmax = int( ( log( tnorm+pivmin )-log( pivmin ) ) /
463 IF( abstol.LE.zero )
THEN
482 CALL slaebz( 3, itmax, n, 2, 2, nb, atoli, rtoli, pivmin, d,
484 $ work, iwork( 5 ), work( n+1 ), work( n+5 ), iout,
485 $ iwork, w, iblock, iinfo )
487 IF( iwork( 6 ).EQ.iu )
THEN
503 IF( nwl.LT.0 .OR. nwl.GE.n .OR. nwu.LT.1 .OR. nwu.GT.n )
THEN
511 tnorm = max( abs( d( 1 ) )+abs( e( 1 ) ),
512 $ abs( d( n ) )+abs( e( n-1 ) ) )
515 tnorm = max( tnorm, abs( d( j ) )+abs( e( j-1 ) )+
519 IF( abstol.LE.zero )
THEN
525 IF( irange.EQ.2 )
THEN
554 IF( irange.EQ.1 .OR. wl.GE.d( ibegin )-pivmin )
556 IF( irange.EQ.1 .OR. wu.GE.d( ibegin )-pivmin )
558 IF( irange.EQ.1 .OR. ( wl.LT.d( ibegin )-pivmin .AND. wu.GE.
559 $ d( ibegin )-pivmin ) )
THEN
575 DO 40 j = ibegin, iend - 1
577 gu = max( gu, d( j )+tmp1+tmp2 )
578 gl = min( gl, d( j )-tmp1-tmp2 )
582 gu = max( gu, d( iend )+tmp1 )
583 gl = min( gl, d( iend )-tmp1 )
584 bnorm = max( abs( gl ), abs( gu ) )
585 gl = gl - fudge*bnorm*ulp*real( in ) - fudge*pivmin
586 gu = gu + fudge*bnorm*ulp*real( in ) + fudge*pivmin
590 IF( abstol.LE.zero )
THEN
591 atoli = ulp*max( abs( gl ), abs( gu ) )
596 IF( irange.GT.1 )
THEN
612 CALL slaebz( 1, 0, in, in, 1, nb, atoli, rtoli, pivmin,
613 $ d( ibegin ), e( ibegin ), work( ibegin ),
614 $ idumma, work( n+1 ), work( n+2*in+1 ), im,
615 $ iwork, w( m+1 ), iblock( m+1 ), iinfo )
617 nwl = nwl + iwork( 1 )
618 nwu = nwu + iwork( in+1 )
619 iwoff = m - iwork( 1 )
623 itmax = int( ( log( gu-gl+pivmin )-log( pivmin ) ) /
625 CALL slaebz( 2, itmax, in, in, 1, nb, atoli, rtoli,
627 $ d( ibegin ), e( ibegin ), work( ibegin ),
628 $ idumma, work( n+1 ), work( n+2*in+1 ), iout,
629 $ iwork, w( m+1 ), iblock( m+1 ), iinfo )
635 tmp1 = half*( work( j+n )+work( j+in+n ) )
639 IF( j.GT.iout-iinfo )
THEN
645 DO 50 je = iwork( j ) + 1 + iwoff,
646 $ iwork( j+in ) + iwoff
659 IF( irange.EQ.3 )
THEN
661 idiscl = il - 1 - nwl
664 IF( idiscl.GT.0 .OR. idiscu.GT.0 )
THEN
666 IF( w( je ).LE.wlu .AND. idiscl.GT.0 )
THEN
668 ELSE IF( w( je ).GE.wul .AND. idiscu.GT.0 )
THEN
673 iblock( im ) = iblock( je )
678 IF( idiscl.GT.0 .OR. idiscu.GT.0 )
THEN
690 IF( idiscl.GT.0 )
THEN
692 DO 100 jdisc = 1, idiscl
695 IF( iblock( je ).NE.0 .AND.
696 $ ( w( je ).LT.wkill .OR. iw.EQ.0 ) )
THEN
704 IF( idiscu.GT.0 )
THEN
707 DO 120 jdisc = 1, idiscu
710 IF( iblock( je ).NE.0 .AND.
711 $ ( w( je ).GT.wkill .OR. iw.EQ.0 ) )
THEN
721 IF( iblock( je ).NE.0 )
THEN
724 iblock( im ) = iblock( je )
729 IF( idiscl.LT.0 .OR. idiscu.LT.0 )
THEN
738 IF( iorder.EQ.1 .AND. nsplit.GT.1 )
THEN
743 IF( w( j ).LT.tmp1 )
THEN
752 iblock( ie ) = iblock( je )