311 SUBROUTINE sstemr( JOBZ, RANGE, N, D, E, VL, VU, IL, IU,
312 $ m, w, z, ldz, nzc, isuppz, tryrac, work, lwork,
313 $ iwork, liwork, info )
321 CHARACTER jobz, range
323 INTEGER il, info, iu, ldz, nzc, liwork, lwork, m, n
327 INTEGER isuppz( * ), iwork( * )
328 REAL d( * ), e( * ), w( * ), work( * )
335 REAL zero, one, four, minrgp
336 parameter( zero = 0.0e0, one = 1.0e0,
341 LOGICAL alleig, indeig, lquery, valeig, wantz, zquery
342 INTEGER i, ibegin, iend, ifirst, iil, iindbl, iindw,
343 $ iindwk, iinfo, iinspl, iiu, ilast, in, indd,
344 $ inde2, inderr, indgp, indgrs, indwrk, itmp,
345 $ itmp2, j, jblk, jj, liwmin, lwmin, nsplit,
346 $ nzcmin, offset, wbegin, wend
347 REAL bignum, cs, eps, pivmin, r1, r2, rmax, rmin,
348 $ rtol1, rtol2, safmin, scale, smlnum, sn,
349 $ thresh, tmp, tnrm, wl, wu
362 INTRINSIC max, min, sqrt
368 wantz =
lsame( jobz,
'V' )
369 alleig =
lsame( range,
'A' )
370 valeig =
lsame( range,
'V' )
371 indeig =
lsame( range,
'I' )
373 lquery = ( ( lwork.EQ.-1 ).OR.( liwork.EQ.-1 ) )
374 zquery = ( nzc.EQ.-1 )
399 elseif( indeig )
THEN
406 IF( .NOT.( wantz .OR.
lsame( jobz,
'N' ) ) )
THEN
408 ELSE IF( .NOT.( alleig .OR. valeig .OR. indeig ) )
THEN
410 ELSE IF( n.LT.0 )
THEN
412 ELSE IF( valeig .AND. n.GT.0 .AND. wu.LE.wl )
THEN
414 ELSE IF( indeig .AND. ( iil.LT.1 .OR. iil.GT.n ) )
THEN
416 ELSE IF( indeig .AND. ( iiu.LT.iil .OR. iiu.GT.n ) )
THEN
418 ELSE IF( ldz.LT.1 .OR. ( wantz .AND. ldz.LT.n ) )
THEN
420 ELSE IF( lwork.LT.lwmin .AND. .NOT.lquery )
THEN
422 ELSE IF( liwork.LT.liwmin .AND. .NOT.lquery )
THEN
428 safmin =
slamch(
'Safe minimum' )
429 eps =
slamch(
'Precision' )
430 smlnum = safmin / eps
431 bignum = one / smlnum
432 rmin = sqrt( smlnum )
433 rmax = min( sqrt( bignum ), one / sqrt( sqrt( safmin ) ) )
439 IF( wantz .AND. alleig )
THEN
441 ELSE IF( wantz .AND. valeig )
THEN
442 CALL
slarrc(
'T', n, vl, vu, d, e, safmin,
443 $ nzcmin, itmp, itmp2, info )
444 ELSE IF( wantz .AND. indeig )
THEN
450 IF( zquery .AND. info.EQ.0 )
THEN
452 ELSE IF( nzc.LT.nzcmin .AND. .NOT.zquery )
THEN
459 CALL
xerbla(
'SSTEMR', -info )
462 ELSE IF( lquery .OR. zquery )
THEN
473 IF( alleig .OR. indeig )
THEN
477 IF( wl.LT.d( 1 ) .AND. wu.GE.d( 1 ) )
THEN
482 IF( wantz.AND.(.NOT.zquery) )
THEN
491 IF( .NOT.wantz )
THEN
492 CALL
slae2( d(1), e(1), d(2), r1, r2 )
493 ELSE IF( wantz.AND.(.NOT.zquery) )
THEN
494 CALL
slaev2( d(1), e(1), d(2), r1, r2, cs, sn )
497 $ (valeig.AND.(r2.GT.wl).AND.
499 $ (indeig.AND.(iil.EQ.1)) )
THEN
502 IF( wantz.AND.(.NOT.zquery) )
THEN
521 $ (valeig.AND.(r1.GT.wl).AND.
523 $ (indeig.AND.(iiu.EQ.2)) )
THEN
526 IF( wantz.AND.(.NOT.zquery) )
THEN
567 tnrm =
slanst(
'M', n, d, e )
568 IF( tnrm.GT.zero .AND. tnrm.LT.rmin )
THEN
570 ELSE IF( tnrm.GT.rmax )
THEN
573 IF( scale.NE.one )
THEN
574 CALL
sscal( n, scale, d, 1 )
575 CALL
sscal( n-1, scale, e, 1 )
595 CALL
slarrr( n, d, e, iinfo )
611 CALL
scopy(n,d,1,work(indd),1)
615 work( inde2+j-1 ) = e(j)**2
619 IF( .NOT.wantz )
THEN
628 rtol1 = max( sqrt(eps)*5.0e-2, four * eps )
629 rtol2 = max( sqrt(eps)*5.0e-3, four * eps )
631 CALL
slarre( range, n, wl, wu, iil, iiu, d, e,
632 $ work(inde2), rtol1, rtol2, thresh, nsplit,
633 $ iwork( iinspl ), m, w, work( inderr ),
634 $ work( indgp ), iwork( iindbl ),
635 $ iwork( iindw ), work( indgrs ), pivmin,
636 $ work( indwrk ), iwork( iindwk ), iinfo )
637 IF( iinfo.NE.0 )
THEN
638 info = 10 + abs( iinfo )
651 CALL
slarrv( n, wl, wu, d, e,
652 $ pivmin, iwork( iinspl ), m,
653 $ 1, m, minrgp, rtol1, rtol2,
654 $ w, work( inderr ), work( indgp ), iwork( iindbl ),
655 $ iwork( iindw ), work( indgrs ), z, ldz,
656 $ isuppz, work( indwrk ), iwork( iindwk ), iinfo )
657 IF( iinfo.NE.0 )
THEN
658 info = 20 + abs( iinfo )
668 itmp = iwork( iindbl+j-1 )
669 w( j ) = w( j ) + e( iwork( iinspl+itmp-1 ) )
679 DO 39 jblk = 1, iwork( iindbl+m-1 )
680 iend = iwork( iinspl+jblk-1 )
681 in = iend - ibegin + 1
686 IF( iwork( iindbl+wend ).EQ.jblk )
THEN
691 IF( wend.LT.wbegin )
THEN
696 offset = iwork(iindw+wbegin-1)-1
697 ifirst = iwork(iindw+wbegin-1)
698 ilast = iwork(iindw+wend-1)
701 $ work(indd+ibegin-1), work(inde2+ibegin-1),
702 $ ifirst, ilast, rtol2, offset, w(wbegin),
703 $ work( inderr+wbegin-1 ),
704 $ work( indwrk ), iwork( iindwk ), pivmin,
713 IF( scale.NE.one )
THEN
714 CALL
sscal( m, one / scale, w, 1 )
721 IF( nsplit.GT.1 .OR. n.EQ.2 )
THEN
722 IF( .NOT. wantz )
THEN
723 CALL
slasrt(
'I', m, w, iinfo )
724 IF( iinfo.NE.0 )
THEN
733 IF( w( jj ).LT.tmp )
THEN
742 CALL
sswap( n, z( 1, i ), 1, z( 1, j ), 1 )
743 itmp = isuppz( 2*i-1 )
744 isuppz( 2*i-1 ) = isuppz( 2*j-1 )
745 isuppz( 2*j-1 ) = itmp
747 isuppz( 2*i ) = isuppz( 2*j )