328 SUBROUTINE zstemr( 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
341 DOUBLE PRECISION vl, vu
344 INTEGER isuppz( * ), iwork( * )
345 DOUBLE PRECISION d( * ), e( * ), w( * ), work( * )
346 COMPLEX*16 z( ldz, * )
352 DOUBLE PRECISION zero, one, four, minrgp
353 parameter( zero = 0.0d0, one = 1.0d0,
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 DOUBLE PRECISION 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 =
dlamch(
'Safe minimum' )
448 eps =
dlamch(
'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
dlarrc(
'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(
'ZSTEMR', -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
dlae2( d(1), e(1), d(2), r1, r2 )
512 ELSE IF( wantz.AND.(.NOT.zquery) )
THEN
513 CALL
dlaev2( 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 =
dlanst(
'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
dscal( n, scale, d, 1 )
594 CALL
dscal( n-1, scale, e, 1 )
614 CALL
dlarrr( n, d, e, iinfo )
630 CALL
dcopy(n,d,1,work(indd),1)
634 work( inde2+j-1 ) = e(j)**2
638 IF( .NOT.wantz )
THEN
648 rtol2 = max( sqrt(eps)*5.0d-3, four * eps )
650 CALL
dlarre( 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
zlarrv( 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
dscal( m, one / scale, w, 1 )
740 IF( nsplit.GT.1 .OR. n.EQ.2 )
THEN
741 IF( .NOT. wantz )
THEN
742 CALL
dlasrt(
'I', m, w, iinfo )
743 IF( iinfo.NE.0 )
THEN
752 IF( w( jj ).LT.tmp )
THEN
761 CALL
zswap( 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 )