369 SUBROUTINE zheevr( 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,
382 DOUBLE PRECISION ABSTOL, VL, VU
385 INTEGER ISUPPZ( * ), IWORK( * )
386 DOUBLE PRECISION RWORK( * ), W( * )
387 COMPLEX*16 A( LDA, * ), WORK( * ), Z( LDZ, * )
393 DOUBLE PRECISION ZERO, ONE, TWO
394 PARAMETER ( ZERO = 0.0d+0, one = 1.0d+0, two = 2.0d+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 DOUBLE PRECISION ABSTLL, ANRM, BIGNUM, EPS, RMAX, RMIN, SAFMIN,
406 $ SIGMA, SMLNUM, TMP1, VLL, VUU
411 DOUBLE PRECISION DLAMCH, ZLANSY
412 EXTERNAL lsame, ilaenv, dlamch, zlansy
420 INTRINSIC dble, max, min, sqrt
426 ieeeok = ilaenv( 10,
'ZHEEVR',
'N', 1, 2, 3, 4 )
428 lower = lsame( uplo,
'L' )
429 wantz = lsame( jobz,
'V' )
430 alleig = lsame( range,
'A' )
431 valeig = lsame( range,
'V' )
432 indeig = lsame( range,
'I' )
434 lquery = ( ( lwork.EQ.-1 ) .OR. ( lrwork.EQ.-1 ) .OR.
448 IF( .NOT.( wantz .OR. lsame( jobz,
'N' ) ) )
THEN
450 ELSE IF( .NOT.( alleig .OR. valeig .OR. indeig ) )
THEN
452 ELSE IF( .NOT.( lower .OR. lsame( uplo,
'U' ) ) )
THEN
454 ELSE IF( n.LT.0 )
THEN
456 ELSE IF( lda.LT.max( 1, n ) )
THEN
460 IF( n.GT.0 .AND. vu.LE.vl )
462 ELSE IF( indeig )
THEN
463 IF( il.LT.1 .OR. il.GT.max( 1, n ) )
THEN
465 ELSE IF( iu.LT.min( n, il ) .OR. iu.GT.n )
THEN
471 IF( ldz.LT.1 .OR. ( wantz .AND. ldz.LT.n ) )
THEN
477 nb = ilaenv( 1,
'ZHETRD', uplo, n, -1, -1, -1 )
478 nb = max( nb, ilaenv( 1,
'ZUNMTR', uplo, n, -1, -1, -1 ) )
479 lwkopt = max( ( nb+1 )*n, lwmin )
481 rwork( 1 ) = real( lrwmin )
484 IF( lwork.LT.lwmin .AND. .NOT.lquery )
THEN
486 ELSE IF( lrwork.LT.lrwmin .AND. .NOT.lquery )
THEN
488 ELSE IF( liwork.LT.liwmin .AND. .NOT.lquery )
THEN
494 CALL xerbla(
'ZHEEVR', -info )
496 ELSE IF( lquery )
THEN
510 IF( alleig .OR. indeig )
THEN
512 w( 1 ) = dble( a( 1, 1 ) )
514 IF( vl.LT.dble( a( 1, 1 ) ) .AND. vu.GE.dble( a( 1, 1 ) ) )
517 w( 1 ) = dble( a( 1, 1 ) )
530 safmin = dlamch(
'Safe minimum' )
531 eps = dlamch(
'Precision' )
532 smlnum = safmin / eps
533 bignum = one / smlnum
534 rmin = sqrt( smlnum )
535 rmax = min( sqrt( bignum ), one / sqrt( sqrt( safmin ) ) )
545 anrm = zlansy(
'M', uplo, n, a, lda, rwork )
546 IF( anrm.GT.zero .AND. anrm.LT.rmin )
THEN
549 ELSE IF( anrm.GT.rmax )
THEN
553 IF( iscale.EQ.1 )
THEN
556 CALL zdscal( n-j+1, sigma, a( j, j ), 1 )
560 CALL zdscal( j, sigma, a( 1, j ), 1 )
564 $ abstll = abstol*sigma
580 llwork = lwork - indwk + 1
597 llrwork = lrwork - indrwk + 1
616 CALL zhetrd( uplo, n, a, lda, rwork( indrd ), rwork( indre ),
617 $ work( indtau ), work( indwk ), llwork, iinfo )
624 IF( il.EQ.1 .AND. iu.EQ.n )
THEN
628 IF( ( alleig.OR.test ) .AND. ( ieeeok.EQ.1 ) )
THEN
629 IF( .NOT.wantz )
THEN
630 CALL dcopy( n, rwork( indrd ), 1, w, 1 )
631 CALL dcopy( n-1, rwork( indre ), 1, rwork( indree ), 1 )
632 CALL dsterf( n, w, rwork( indree ), info )
634 CALL dcopy( n-1, rwork( indre ), 1, rwork( indree ), 1 )
635 CALL dcopy( n, rwork( indrd ), 1, rwork( indrdd ), 1 )
637 IF (abstol .LE. two*n*eps)
THEN
642 CALL zstemr( jobz,
'A', n, rwork( indrdd ),
643 $ rwork( indree ), vl, vu, il, iu, m, w,
644 $ z, ldz, n, isuppz, tryrac,
645 $ rwork( indrwk ), llrwork,
646 $ iwork, liwork, info )
651 IF( wantz .AND. info.EQ.0 )
THEN
653 llwrkn = lwork - indwkn + 1
654 CALL zunmtr(
'L', uplo,
'N', n, m, a, lda,
655 $ work( indtau ), z, ldz, work( indwkn ),
677 CALL dstebz( range, order, n, vll, vuu, il, iu, abstll,
678 $ rwork( indrd ), rwork( indre ), m, nsplit, w,
679 $ iwork( indibl ), iwork( indisp ), rwork( indrwk ),
680 $ iwork( indiwo ), info )
683 CALL zstein( n, rwork( indrd ), rwork( indre ), m, w,
684 $ iwork( indibl ), iwork( indisp ), z, ldz,
685 $ rwork( indrwk ), iwork( indiwo ), iwork( indifl ),
692 llwrkn = lwork - indwkn + 1
693 CALL zunmtr(
'L', uplo,
'N', n, m, a, lda, work( indtau ),
695 $ ldz, work( indwkn ), llwrkn, iinfo )
701 IF( iscale.EQ.1 )
THEN
707 CALL dscal( imax, one / sigma, w, 1 )
718 IF( w( jj ).LT.tmp1 )
THEN
725 itmp1 = iwork( indibl+i-1 )
727 iwork( indibl+i-1 ) = iwork( indibl+j-1 )
729 iwork( indibl+j-1 ) = itmp1
730 CALL zswap( n, z( 1, i ), 1, z( 1, j ), 1 )
738 rwork( 1 ) = real( lrwmin )