369 SUBROUTINE cheevr( JOBZ, RANGE, UPLO, N, A, LDA, VL, VU, IL,
371 $ ABSTOL, M, W, Z, LDZ, ISUPPZ, WORK, LWORK,
372 $ RWORK, LRWORK, IWORK, LIWORK, INFO )
379 CHARACTER JOBZ, RANGE, UPLO
380 INTEGER IL, INFO, IU, LDA, LDZ, LIWORK, LRWORK, LWORK,
385 INTEGER ISUPPZ( * ), IWORK( * )
386 REAL RWORK( * ), W( * )
387 COMPLEX A( LDA, * ), WORK( * ), Z( LDZ, * )
394 PARAMETER ( ZERO = 0.0e+0, one = 1.0e+0, two = 2.0e+0 )
397 LOGICAL ALLEIG, INDEIG, LOWER, LQUERY, TEST, VALEIG,
400 INTEGER I, IEEEOK, IINFO, IMAX, INDIBL, INDIFL, INDISP,
401 $ INDIWO, INDRD, INDRDD, INDRE, INDREE, INDRWK,
402 $ indtau, indwk, indwkn, iscale, itmp1, j, jj,
403 $ liwmin, llwork, llrwork, llwrkn, lrwmin,
404 $ lwkopt, lwmin, nb, nsplit
405 REAL ABSTLL, ANRM, BIGNUM, EPS, RMAX, RMIN, SAFMIN,
406 $ SIGMA, SMLNUM, TMP1, VLL, VUU
411 REAL CLANSY, SLAMCH, SROUNDUP_LWORK
412 EXTERNAL lsame, ilaenv, clansy, slamch,
421 INTRINSIC max, min, real, sqrt
427 ieeeok = ilaenv( 10,
'CHEEVR',
'N', 1, 2, 3, 4 )
429 lower = lsame( uplo,
'L' )
430 wantz = lsame( jobz,
'V' )
431 alleig = lsame( range,
'A' )
432 valeig = lsame( range,
'V' )
433 indeig = lsame( range,
'I' )
435 lquery = ( ( lwork.EQ.-1 ) .OR. ( lrwork.EQ.-1 ) .OR.
449 IF( .NOT.( wantz .OR. lsame( jobz,
'N' ) ) )
THEN
451 ELSE IF( .NOT.( alleig .OR. valeig .OR. indeig ) )
THEN
453 ELSE IF( .NOT.( lower .OR. lsame( uplo,
'U' ) ) )
THEN
455 ELSE IF( n.LT.0 )
THEN
457 ELSE IF( lda.LT.max( 1, n ) )
THEN
461 IF( n.GT.0 .AND. vu.LE.vl )
463 ELSE IF( indeig )
THEN
464 IF( il.LT.1 .OR. il.GT.max( 1, n ) )
THEN
466 ELSE IF( iu.LT.min( n, il ) .OR. iu.GT.n )
THEN
472 IF( ldz.LT.1 .OR. ( wantz .AND. ldz.LT.n ) )
THEN
478 nb = ilaenv( 1,
'CHETRD', uplo, n, -1, -1, -1 )
479 nb = max( nb, ilaenv( 1,
'CUNMTR', uplo, n, -1, -1, -1 ) )
480 lwkopt = max( ( nb+1 )*n, lwmin )
481 work( 1 ) = sroundup_lwork( lwkopt )
482 rwork( 1 ) = sroundup_lwork( lrwmin )
485 IF( lwork.LT.lwmin .AND. .NOT.lquery )
THEN
487 ELSE IF( lrwork.LT.lrwmin .AND. .NOT.lquery )
THEN
489 ELSE IF( liwork.LT.liwmin .AND. .NOT.lquery )
THEN
495 CALL xerbla(
'CHEEVR', -info )
497 ELSE IF( lquery )
THEN
511 IF( alleig .OR. indeig )
THEN
513 w( 1 ) = real( a( 1, 1 ) )
515 IF( vl.LT.real( a( 1, 1 ) ) .AND. vu.GE.real( a( 1, 1 ) ) )
518 w( 1 ) = real( a( 1, 1 ) )
531 safmin = slamch(
'Safe minimum' )
532 eps = slamch(
'Precision' )
533 smlnum = safmin / eps
534 bignum = one / smlnum
535 rmin = sqrt( smlnum )
536 rmax = min( sqrt( bignum ), one / sqrt( sqrt( safmin ) ) )
546 anrm = clansy(
'M', uplo, n, a, lda, rwork )
547 IF( anrm.GT.zero .AND. anrm.LT.rmin )
THEN
550 ELSE IF( anrm.GT.rmax )
THEN
554 IF( iscale.EQ.1 )
THEN
557 CALL csscal( n-j+1, sigma, a( j, j ), 1 )
561 CALL csscal( j, sigma, a( 1, j ), 1 )
565 $ abstll = abstol*sigma
581 llwork = lwork - indwk + 1
598 llrwork = lrwork - indrwk + 1
617 CALL chetrd( uplo, n, a, lda, rwork( indrd ), rwork( indre ),
618 $ work( indtau ), work( indwk ), llwork, iinfo )
625 IF( il.EQ.1 .AND. iu.EQ.n )
THEN
629 IF( ( alleig.OR.test ) .AND. ( ieeeok.EQ.1 ) )
THEN
630 IF( .NOT.wantz )
THEN
631 CALL scopy( n, rwork( indrd ), 1, w, 1 )
632 CALL scopy( n-1, rwork( indre ), 1, rwork( indree ), 1 )
633 CALL ssterf( n, w, rwork( indree ), info )
635 CALL scopy( n-1, rwork( indre ), 1, rwork( indree ), 1 )
636 CALL scopy( n, rwork( indrd ), 1, rwork( indrdd ), 1 )
638 IF (abstol .LE. two*real( n )*eps)
THEN
643 CALL cstemr( jobz,
'A', n, rwork( indrdd ),
644 $ rwork( indree ), vl, vu, il, iu, m, w,
645 $ z, ldz, n, isuppz, tryrac,
646 $ rwork( indrwk ), llrwork,
647 $ iwork, liwork, info )
652 IF( wantz .AND. info.EQ.0 )
THEN
654 llwrkn = lwork - indwkn + 1
655 CALL cunmtr(
'L', uplo,
'N', n, m, a, lda,
656 $ work( indtau ), z, ldz, work( indwkn ),
678 CALL sstebz( range, order, n, vll, vuu, il, iu, abstll,
679 $ rwork( indrd ), rwork( indre ), m, nsplit, w,
680 $ iwork( indibl ), iwork( indisp ), rwork( indrwk ),
681 $ iwork( indiwo ), info )
684 CALL cstein( n, rwork( indrd ), rwork( indre ), m, w,
685 $ iwork( indibl ), iwork( indisp ), z, ldz,
686 $ rwork( indrwk ), iwork( indiwo ), iwork( indifl ),
693 llwrkn = lwork - indwkn + 1
694 CALL cunmtr(
'L', uplo,
'N', n, m, a, lda, work( indtau ),
696 $ ldz, work( indwkn ), llwrkn, iinfo )
702 IF( iscale.EQ.1 )
THEN
708 CALL sscal( imax, one / sigma, w, 1 )
719 IF( w( jj ).LT.tmp1 )
THEN
726 itmp1 = iwork( indibl+i-1 )
728 iwork( indibl+i-1 ) = iwork( indibl+j-1 )
730 iwork( indibl+j-1 ) = itmp1
731 CALL cswap( n, z( 1, i ), 1, z( 1, j ), 1 )
738 work( 1 ) = sroundup_lwork( lwkopt )
739 rwork( 1 ) = sroundup_lwork( lrwmin )