354 SUBROUTINE cheevr( JOBZ, RANGE, UPLO, N, A, LDA, VL, VU, IL, IU,
355 $ ABSTOL, M, W, Z, LDZ, ISUPPZ, WORK, LWORK,
356 $ RWORK, LRWORK, IWORK, LIWORK, INFO )
363 CHARACTER JOBZ, RANGE, UPLO
364 INTEGER IL, INFO, IU, LDA, LDZ, LIWORK, LRWORK, LWORK,
369 INTEGER ISUPPZ( * ), IWORK( * )
370 REAL RWORK( * ), W( * )
371 COMPLEX A( LDA, * ), WORK( * ), Z( LDZ, * )
378 PARAMETER ( ZERO = 0.0e+0, one = 1.0e+0, two = 2.0e+0 )
381 LOGICAL ALLEIG, INDEIG, LOWER, LQUERY, TEST, VALEIG,
384 INTEGER I, IEEEOK, IINFO, IMAX, INDIBL, INDIFL, INDISP,
385 $ indiwo, indrd, indrdd, indre, indree, indrwk,
386 $ indtau, indwk, indwkn, iscale, itmp1, j, jj,
387 $ liwmin, llwork, llrwork, llwrkn, lrwmin,
388 $ lwkopt, lwmin, nb, nsplit
389 REAL ABSTLL, ANRM, BIGNUM, EPS, RMAX, RMIN, SAFMIN,
390 $ SIGMA, SMLNUM, TMP1, VLL, VUU
395 REAL CLANSY, SLAMCH, SROUNDUP_LWORK
396 EXTERNAL lsame, ilaenv, clansy, slamch, sroundup_lwork
403 INTRINSIC max, min, real, sqrt
409 ieeeok = ilaenv( 10,
'CHEEVR',
'N', 1, 2, 3, 4 )
411 lower = lsame( uplo,
'L' )
412 wantz = lsame( jobz,
'V' )
413 alleig = lsame( range,
'A' )
414 valeig = lsame( range,
'V' )
415 indeig = lsame( range,
'I' )
417 lquery = ( ( lwork.EQ.-1 ) .OR. ( lrwork.EQ.-1 ) .OR.
420 lrwmin = max( 1, 24*n )
421 liwmin = max( 1, 10*n )
422 lwmin = max( 1, 2*n )
425 IF( .NOT.( wantz .OR. lsame( jobz,
'N' ) ) )
THEN
427 ELSE IF( .NOT.( alleig .OR. valeig .OR. indeig ) )
THEN
429 ELSE IF( .NOT.( lower .OR. lsame( uplo,
'U' ) ) )
THEN
431 ELSE IF( n.LT.0 )
THEN
433 ELSE IF( lda.LT.max( 1, n ) )
THEN
437 IF( n.GT.0 .AND. vu.LE.vl )
439 ELSE IF( indeig )
THEN
440 IF( il.LT.1 .OR. il.GT.max( 1, n ) )
THEN
442 ELSE IF( iu.LT.min( n, il ) .OR. iu.GT.n )
THEN
448 IF( ldz.LT.1 .OR. ( wantz .AND. ldz.LT.n ) )
THEN
454 nb = ilaenv( 1,
'CHETRD', uplo, n, -1, -1, -1 )
455 nb = max( nb, ilaenv( 1,
'CUNMTR', uplo, n, -1, -1, -1 ) )
456 lwkopt = max( ( nb+1 )*n, lwmin )
457 work( 1 ) = sroundup_lwork(lwkopt)
461 IF( lwork.LT.lwmin .AND. .NOT.lquery )
THEN
463 ELSE IF( lrwork.LT.lrwmin .AND. .NOT.lquery )
THEN
465 ELSE IF( liwork.LT.liwmin .AND. .NOT.lquery )
THEN
471 CALL xerbla(
'CHEEVR', -info )
473 ELSE IF( lquery )
THEN
487 IF( alleig .OR. indeig )
THEN
489 w( 1 ) = real( a( 1, 1 ) )
491 IF( vl.LT.real( a( 1, 1 ) ) .AND. vu.GE.real( a( 1, 1 ) ) )
494 w( 1 ) = real( a( 1, 1 ) )
507 safmin = slamch(
'Safe minimum' )
508 eps = slamch(
'Precision' )
509 smlnum = safmin / eps
510 bignum = one / smlnum
511 rmin = sqrt( smlnum )
512 rmax = min( sqrt( bignum ), one / sqrt( sqrt( safmin ) ) )
522 anrm = clansy(
'M', uplo, n, a, lda, rwork )
523 IF( anrm.GT.zero .AND. anrm.LT.rmin )
THEN
526 ELSE IF( anrm.GT.rmax )
THEN
530 IF( iscale.EQ.1 )
THEN
533 CALL csscal( n-j+1, sigma, a( j, j ), 1 )
537 CALL csscal( j, sigma, a( 1, j ), 1 )
541 $ abstll = abstol*sigma
557 llwork = lwork - indwk + 1
574 llrwork = lrwork - indrwk + 1
593 CALL chetrd( uplo, n, a, lda, rwork( indrd ), rwork( indre ),
594 $ work( indtau ), work( indwk ), llwork, iinfo )
601 IF( il.EQ.1 .AND. iu.EQ.n )
THEN
605 IF( ( alleig.OR.test ) .AND. ( ieeeok.EQ.1 ) )
THEN
606 IF( .NOT.wantz )
THEN
607 CALL scopy( n, rwork( indrd ), 1, w, 1 )
608 CALL scopy( n-1, rwork( indre ), 1, rwork( indree ), 1 )
609 CALL ssterf( n, w, rwork( indree ), info )
611 CALL scopy( n-1, rwork( indre ), 1, rwork( indree ), 1 )
612 CALL scopy( n, rwork( indrd ), 1, rwork( indrdd ), 1 )
614 IF (abstol .LE. two*n*eps)
THEN
619 CALL cstemr( jobz,
'A', n, rwork( indrdd ),
620 $ rwork( indree ), vl, vu, il, iu, m, w,
621 $ z, ldz, n, isuppz, tryrac,
622 $ rwork( indrwk ), llrwork,
623 $ iwork, liwork, info )
628 IF( wantz .AND. info.EQ.0 )
THEN
630 llwrkn = lwork - indwkn + 1
631 CALL cunmtr(
'L', uplo,
'N', n, m, a, lda,
632 $ work( indtau ), z, ldz, work( indwkn ),
654 CALL sstebz( range, order, n, vll, vuu, il, iu, abstll,
655 $ rwork( indrd ), rwork( indre ), m, nsplit, w,
656 $ iwork( indibl ), iwork( indisp ), rwork( indrwk ),
657 $ iwork( indiwo ), info )
660 CALL cstein( n, rwork( indrd ), rwork( indre ), m, w,
661 $ iwork( indibl ), iwork( indisp ), z, ldz,
662 $ rwork( indrwk ), iwork( indiwo ), iwork( indifl ),
669 llwrkn = lwork - indwkn + 1
670 CALL cunmtr(
'L', uplo,
'N', n, m, a, lda, work( indtau ), z,
671 $ ldz, work( indwkn ), llwrkn, iinfo )
677 IF( iscale.EQ.1 )
THEN
683 CALL sscal( imax, one / sigma, w, 1 )
694 IF( w( jj ).LT.tmp1 )
THEN
701 itmp1 = iwork( indibl+i-1 )
703 iwork( indibl+i-1 ) = iwork( indibl+j-1 )
705 iwork( indibl+j-1 ) = itmp1
706 CALL cswap( n, z( 1, i ), 1, z( 1, j ), 1 )
713 work( 1 ) = sroundup_lwork(lwkopt)
subroutine xerbla(srname, info)
subroutine scopy(n, sx, incx, sy, incy)
SCOPY
subroutine cheevr(jobz, range, uplo, n, a, lda, vl, vu, il, iu, abstol, m, w, z, ldz, isuppz, work, lwork, rwork, lrwork, iwork, liwork, info)
CHEEVR computes the eigenvalues and, optionally, the left and/or right eigenvectors for HE matrices
subroutine chetrd(uplo, n, a, lda, d, e, tau, work, lwork, info)
CHETRD
subroutine csscal(n, sa, cx, incx)
CSSCAL
subroutine sscal(n, sa, sx, incx)
SSCAL
subroutine sstebz(range, order, n, vl, vu, il, iu, abstol, d, e, m, nsplit, w, iblock, isplit, work, iwork, info)
SSTEBZ
subroutine cstein(n, d, e, m, w, iblock, isplit, z, ldz, work, iwork, ifail, info)
CSTEIN
subroutine cstemr(jobz, range, n, d, e, vl, vu, il, iu, m, w, z, ldz, nzc, isuppz, tryrac, work, lwork, iwork, liwork, info)
CSTEMR
subroutine ssterf(n, d, e, info)
SSTERF
subroutine cswap(n, cx, incx, cy, incy)
CSWAP
subroutine cunmtr(side, uplo, trans, m, n, a, lda, tau, c, ldc, work, lwork, info)
CUNMTR