311 SUBROUTINE dstemr( 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
324 DOUBLE PRECISION vl, vu
327 INTEGER isuppz( * ), iwork( * )
328 DOUBLE PRECISION d( * ), e( * ), w( * ), work( * )
329 DOUBLE PRECISION z( ldz, * )
335 DOUBLE PRECISION zero, one, four, minrgp
336 parameter( zero = 0.0d0, one = 1.0d0,
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 DOUBLE PRECISION 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
370 wantz =
lsame( jobz,
'V' )
371 alleig =
lsame( range,
'A' )
372 valeig =
lsame( range,
'V' )
373 indeig =
lsame( range,
'I' )
375 lquery = ( ( lwork.EQ.-1 ).OR.( liwork.EQ.-1 ) )
376 zquery = ( nzc.EQ.-1 )
401 elseif( indeig )
THEN
408 IF( .NOT.( wantz .OR.
lsame( jobz,
'N' ) ) )
THEN
410 ELSE IF( .NOT.( alleig .OR. valeig .OR. indeig ) )
THEN
412 ELSE IF( n.LT.0 )
THEN
414 ELSE IF( valeig .AND. n.GT.0 .AND. wu.LE.wl )
THEN
416 ELSE IF( indeig .AND. ( iil.LT.1 .OR. iil.GT.n ) )
THEN
418 ELSE IF( indeig .AND. ( iiu.LT.iil .OR. iiu.GT.n ) )
THEN
420 ELSE IF( ldz.LT.1 .OR. ( wantz .AND. ldz.LT.n ) )
THEN
422 ELSE IF( lwork.LT.lwmin .AND. .NOT.lquery )
THEN
424 ELSE IF( liwork.LT.liwmin .AND. .NOT.lquery )
THEN
430 safmin =
dlamch(
'Safe minimum' )
431 eps =
dlamch(
'Precision' )
432 smlnum = safmin / eps
433 bignum = one / smlnum
434 rmin = sqrt( smlnum )
435 rmax = min( sqrt( bignum ), one / sqrt( sqrt( safmin ) ) )
441 IF( wantz .AND. alleig )
THEN
443 ELSE IF( wantz .AND. valeig )
THEN
444 CALL
dlarrc(
'T', n, vl, vu, d, e, safmin,
445 $ nzcmin, itmp, itmp2, info )
446 ELSE IF( wantz .AND. indeig )
THEN
452 IF( zquery .AND. info.EQ.0 )
THEN
454 ELSE IF( nzc.LT.nzcmin .AND. .NOT.zquery )
THEN
461 CALL
xerbla(
'DSTEMR', -info )
464 ELSE IF( lquery .OR. zquery )
THEN
475 IF( alleig .OR. indeig )
THEN
479 IF( wl.LT.d( 1 ) .AND. wu.GE.d( 1 ) )
THEN
484 IF( wantz.AND.(.NOT.zquery) )
THEN
493 IF( .NOT.wantz )
THEN
494 CALL
dlae2( d(1), e(1), d(2), r1, r2 )
495 ELSE IF( wantz.AND.(.NOT.zquery) )
THEN
496 CALL
dlaev2( d(1), e(1), d(2), r1, r2, cs, sn )
499 $ (valeig.AND.(r2.GT.wl).AND.
501 $ (indeig.AND.(iil.EQ.1)) )
THEN
504 IF( wantz.AND.(.NOT.zquery) )
THEN
523 $ (valeig.AND.(r1.GT.wl).AND.
525 $ (indeig.AND.(iiu.EQ.2)) )
THEN
528 IF( wantz.AND.(.NOT.zquery) )
THEN
570 tnrm =
dlanst(
'M', n, d, e )
571 IF( tnrm.GT.zero .AND. tnrm.LT.rmin )
THEN
573 ELSE IF( tnrm.GT.rmax )
THEN
576 IF( scale.NE.one )
THEN
577 CALL
dscal( n, scale, d, 1 )
578 CALL
dscal( n-1, scale, e, 1 )
598 CALL
dlarrr( n, d, e, iinfo )
614 CALL
dcopy(n,d,1,work(indd),1)
618 work( inde2+j-1 ) = e(j)**2
622 IF( .NOT.wantz )
THEN
632 rtol2 = max( sqrt(eps)*5.0d-3, four * eps )
634 CALL
dlarre( range, n, wl, wu, iil, iiu, d, e,
635 $ work(inde2), rtol1, rtol2, thresh, nsplit,
636 $ iwork( iinspl ), m, w, work( inderr ),
637 $ work( indgp ), iwork( iindbl ),
638 $ iwork( iindw ), work( indgrs ), pivmin,
639 $ work( indwrk ), iwork( iindwk ), iinfo )
640 IF( iinfo.NE.0 )
THEN
641 info = 10 + abs( iinfo )
654 CALL
dlarrv( n, wl, wu, d, e,
655 $ pivmin, iwork( iinspl ), m,
656 $ 1, m, minrgp, rtol1, rtol2,
657 $ w, work( inderr ), work( indgp ), iwork( iindbl ),
658 $ iwork( iindw ), work( indgrs ), z, ldz,
659 $ isuppz, work( indwrk ), iwork( iindwk ), iinfo )
660 IF( iinfo.NE.0 )
THEN
661 info = 20 + abs( iinfo )
671 itmp = iwork( iindbl+j-1 )
672 w( j ) = w( j ) + e( iwork( iinspl+itmp-1 ) )
682 DO 39 jblk = 1, iwork( iindbl+m-1 )
683 iend = iwork( iinspl+jblk-1 )
684 in = iend - ibegin + 1
689 IF( iwork( iindbl+wend ).EQ.jblk )
THEN
694 IF( wend.LT.wbegin )
THEN
699 offset = iwork(iindw+wbegin-1)-1
700 ifirst = iwork(iindw+wbegin-1)
701 ilast = iwork(iindw+wend-1)
704 $ work(indd+ibegin-1), work(inde2+ibegin-1),
705 $ ifirst, ilast, rtol2, offset, w(wbegin),
706 $ work( inderr+wbegin-1 ),
707 $ work( indwrk ), iwork( iindwk ), pivmin,
716 IF( scale.NE.one )
THEN
717 CALL
dscal( m, one / scale, w, 1 )
726 IF( nsplit.GT.1 .OR. n.EQ.2 )
THEN
727 IF( .NOT. wantz )
THEN
728 CALL
dlasrt(
'I', m, w, iinfo )
729 IF( iinfo.NE.0 )
THEN
738 IF( w( jj ).LT.tmp )
THEN
747 CALL
dswap( n, z( 1, i ), 1, z( 1, j ), 1 )
748 itmp = isuppz( 2*i-1 )
749 isuppz( 2*i-1 ) = isuppz( 2*j-1 )
750 isuppz( 2*j-1 ) = itmp
752 isuppz( 2*i ) = isuppz( 2*j )