328 SUBROUTINE cstemr( JOBZ, RANGE, N, D, E, VL, VU, IL, IU,
329 $ m, w, z, ldz, nzc, isuppz, tryrac, work, lwork,
330 $ iwork, liwork, info )
338 CHARACTER jobz, range
340 INTEGER il, info, iu, ldz, nzc, liwork, lwork, m, n
344 INTEGER isuppz( * ), iwork( * )
345 REAL d( * ), e( * ), w( * ), work( * )
352 REAL zero, one, four, minrgp
353 parameter( zero = 0.0e0, one = 1.0e0,
358 LOGICAL alleig, indeig, lquery, valeig, wantz, zquery
359 INTEGER i, ibegin, iend, ifirst, iil, iindbl, iindw,
360 $ iindwk, iinfo, iinspl, iiu, ilast, in, indd,
361 $ inde2, inderr, indgp, indgrs, indwrk, itmp,
362 $ itmp2, j, jblk, jj, liwmin, lwmin, nsplit,
363 $ nzcmin, offset, wbegin, wend
364 REAL bignum, cs, eps, pivmin, r1, r2, rmax, rmin,
365 $ rtol1, rtol2, safmin, scale, smlnum, sn,
366 $ thresh, tmp, tnrm, wl, wu
379 INTRINSIC max, min, sqrt
387 wantz =
lsame( jobz,
'V' )
388 alleig =
lsame( range,
'A' )
389 valeig =
lsame( range,
'V' )
390 indeig =
lsame( range,
'I' )
392 lquery = ( ( lwork.EQ.-1 ).OR.( liwork.EQ.-1 ) )
393 zquery = ( nzc.EQ.-1 )
418 elseif( indeig )
THEN
425 IF( .NOT.( wantz .OR.
lsame( jobz,
'N' ) ) )
THEN
427 ELSE IF( .NOT.( alleig .OR. valeig .OR. indeig ) )
THEN
429 ELSE IF( n.LT.0 )
THEN
431 ELSE IF( valeig .AND. n.GT.0 .AND. wu.LE.wl )
THEN
433 ELSE IF( indeig .AND. ( iil.LT.1 .OR. iil.GT.n ) )
THEN
435 ELSE IF( indeig .AND. ( iiu.LT.iil .OR. iiu.GT.n ) )
THEN
437 ELSE IF( ldz.LT.1 .OR. ( wantz .AND. ldz.LT.n ) )
THEN
439 ELSE IF( lwork.LT.lwmin .AND. .NOT.lquery )
THEN
441 ELSE IF( liwork.LT.liwmin .AND. .NOT.lquery )
THEN
447 safmin =
slamch(
'Safe minimum' )
448 eps =
slamch(
'Precision' )
449 smlnum = safmin / eps
450 bignum = one / smlnum
451 rmin = sqrt( smlnum )
452 rmax = min( sqrt( bignum ), one / sqrt( sqrt( safmin ) ) )
458 IF( wantz .AND. alleig )
THEN
460 ELSE IF( wantz .AND. valeig )
THEN
461 CALL
slarrc(
'T', n, vl, vu, d, e, safmin,
462 $ nzcmin, itmp, itmp2, info )
463 ELSE IF( wantz .AND. indeig )
THEN
469 IF( zquery .AND. info.EQ.0 )
THEN
471 ELSE IF( nzc.LT.nzcmin .AND. .NOT.zquery )
THEN
478 CALL
xerbla(
'CSTEMR', -info )
481 ELSE IF( lquery .OR. zquery )
THEN
492 IF( alleig .OR. indeig )
THEN
496 IF( wl.LT.d( 1 ) .AND. wu.GE.d( 1 ) )
THEN
501 IF( wantz.AND.(.NOT.zquery) )
THEN
510 IF( .NOT.wantz )
THEN
511 CALL
slae2( d(1), e(1), d(2), r1, r2 )
512 ELSE IF( wantz.AND.(.NOT.zquery) )
THEN
513 CALL
slaev2( d(1), e(1), d(2), r1, r2, cs, sn )
516 $ (valeig.AND.(r2.GT.wl).AND.
518 $ (indeig.AND.(iil.EQ.1)) )
THEN
521 IF( wantz.AND.(.NOT.zquery) )
THEN
540 $ (valeig.AND.(r1.GT.wl).AND.
542 $ (indeig.AND.(iiu.EQ.2)) )
THEN
545 IF( wantz.AND.(.NOT.zquery) )
THEN
586 tnrm =
slanst(
'M', n, d, e )
587 IF( tnrm.GT.zero .AND. tnrm.LT.rmin )
THEN
589 ELSE IF( tnrm.GT.rmax )
THEN
592 IF( scale.NE.one )
THEN
593 CALL
sscal( n, scale, d, 1 )
594 CALL
sscal( n-1, scale, e, 1 )
614 CALL
slarrr( n, d, e, iinfo )
630 CALL
scopy(n,d,1,work(indd),1)
634 work( inde2+j-1 ) = e(j)**2
638 IF( .NOT.wantz )
THEN
647 rtol1 = max( sqrt(eps)*5.0e-2, four * eps )
648 rtol2 = max( sqrt(eps)*5.0e-3, four * eps )
650 CALL
slarre( range, n, wl, wu, iil, iiu, d, e,
651 $ work(inde2), rtol1, rtol2, thresh, nsplit,
652 $ iwork( iinspl ), m, w, work( inderr ),
653 $ work( indgp ), iwork( iindbl ),
654 $ iwork( iindw ), work( indgrs ), pivmin,
655 $ work( indwrk ), iwork( iindwk ), iinfo )
656 IF( iinfo.NE.0 )
THEN
657 info = 10 + abs( iinfo )
670 CALL
clarrv( n, wl, wu, d, e,
671 $ pivmin, iwork( iinspl ), m,
672 $ 1, m, minrgp, rtol1, rtol2,
673 $ w, work( inderr ), work( indgp ), iwork( iindbl ),
674 $ iwork( iindw ), work( indgrs ), z, ldz,
675 $ isuppz, work( indwrk ), iwork( iindwk ), iinfo )
676 IF( iinfo.NE.0 )
THEN
677 info = 20 + abs( iinfo )
687 itmp = iwork( iindbl+j-1 )
688 w( j ) = w( j ) + e( iwork( iinspl+itmp-1 ) )
698 DO 39 jblk = 1, iwork( iindbl+m-1 )
699 iend = iwork( iinspl+jblk-1 )
700 in = iend - ibegin + 1
705 IF( iwork( iindbl+wend ).EQ.jblk )
THEN
710 IF( wend.LT.wbegin )
THEN
715 offset = iwork(iindw+wbegin-1)-1
716 ifirst = iwork(iindw+wbegin-1)
717 ilast = iwork(iindw+wend-1)
720 $ work(indd+ibegin-1), work(inde2+ibegin-1),
721 $ ifirst, ilast, rtol2, offset, w(wbegin),
722 $ work( inderr+wbegin-1 ),
723 $ work( indwrk ), iwork( iindwk ), pivmin,
732 IF( scale.NE.one )
THEN
733 CALL
sscal( m, one / scale, w, 1 )
740 IF( nsplit.GT.1 .OR. n.EQ.2 )
THEN
741 IF( .NOT. wantz )
THEN
742 CALL
slasrt(
'I', m, w, iinfo )
743 IF( iinfo.NE.0 )
THEN
752 IF( w( jj ).LT.tmp )
THEN
761 CALL
cswap( n, z( 1, i ), 1, z( 1, j ), 1 )
762 itmp = isuppz( 2*i-1 )
763 isuppz( 2*i-1 ) = isuppz( 2*j-1 )
764 isuppz( 2*j-1 ) = itmp
766 isuppz( 2*i ) = isuppz( 2*j )