Previous Next Contents Generated Index Doc Set Home



Eigenvalues and Eigenvectors of a Hermitian Matrix (Expert Driver)

The subroutines described in this section compute all eigenvalues and, optionally, eigenvectors of a Hermitian matrix A. The eigenvectors are normalized to have a Euclidean norm of 1. Eigenvalues and eigenvectors can be selected by specifying either a range of values or a range of indices for the desired eigenvalues. Note that the simple driver xHEEV is also available.

Calling Sequence

CALL ZHEEVX 
(JOBZ, RANGE, UPLO, N, ZA, LDA, DVL, DVU, IL, IU, 
DABTOL, NFOUND, DW, ZZ, LDZ, ZWORK, LDWORK, DWORK2, 
IWORK3, IFAIL, INFO)
CALL CHEEVX 
(JOBZ, RANGE, UPLO, N, CA, LDA, SVL, SVU, IL, IU, 
SABTOL, NFOUND, SW, CZ, LDZ, CWORK, LDWORK, SWORK2, 
IWORK3, IFAIL, INFO)






void zheevx 
(char jobz, char range, char uplo, int n, doublecomplex 
*za, int lda, double dvl, double dvu, int il, int iu, 
double dabtol, int *nfound, double *dw, doublecomplex 
*zz, int ldz, int *ifail, int *info)
void cheevx 
(char jobz, char range, char uplo, int n, complex *ca, 
int lda, float svl, float svu, int il, int iu, float 
sabtol, int *nfound, float *sw, complex *cz, int ldz, 
int *ifail, int *info)

Arguments

JOBZ

Indicates whether to compute eigenvalues only or to compute both eigenvalues and eigenvectors. The legal values for JOBZ are listed below. Any values not listed below are illegal.

'N' or 'n'

Compute eigenvalues only.

'V' or 'v'

Compute both eigenvalues and eigenvectors.

RANGE

Indicates whether to compute all eigenvalues or some subset. Legal values for RANGE are shown below. Any values not shown below are illegal.

'A' or 'a'

All eigenvalues will be computed.

'I' or 'i'

The ILth through IUth eigenvalues will be computed; see the descriptions of theIL and IU arguments below.

'V' or 'v'

All eigenvalues in the half-open interval (VL,VU] will be computed; see the descriptions of the VL and VU arguments below.

UPLO

Indicates whether xA contains the upper or lower triangle of the matrix. The legal values for UPLO are listed below. Any values not listed below are illegal.

'U' or 'u'

xA contains the upper triangle.

'L' or 'l'

xA contains the lower triangle.

N

Order of the matrix A. N 0.

xA

On entry, the upper or lower triangle of the matrix A.
On exit, the upper or lower triangle of A, including the diagonal, is overwritten.

LDA

Leading dimension of the array A as specified in a dimension or type statement. LDA max(1, N).

xVL, xVU

If RANGE = 'V' or 'v' then only eigenvalues in the half-open interval (VL,VU] will be computed. Otherwise not used.

IL, IU

If RANGE = 'I' or 'i' then only the ILth through IUth eigenvalues will be computed. Otherwise not used. 1 IL IU N.

xABTOL

The absolute error tolerance for the eigenvalues. An approximate eigenvalue is considered to have converged when it lies in an interval [a,b] of width less than or equal to ABTOL + × max(|a|, |b|) where is machine precision. If ABTOL 0 then × ||T||1 will be used in its place, where ||T||1 is the 1-norm of the tridiagonal matrix obtained by reducing A to tridiagonal form.

NFOUND

On exit, the total number of eigenvalues found. 0 NFOUND N.
If RANGE = 'A' or 'a' then NFOUND = N. If RANGE = 'I' or 'i' then NFOUND = IU - IL + 1.

xW

On exit, W(1:NFOUND) contains the computed eigenvalues in ascending order.

xZ

On exit, if JOBZ = 'V' or 'v' then the first NFOUND columns of Z contain the orthonormal eigenvectors corresponding to the selected eigenvalues. If an eigenvector fails to converge then the corresponding column of Z contains an approximation to that eigenvector and its index is returned in IFAIL. If JOBZ = 'N' or 'n' then Z is not used.

Note that Z must have at least NFOUND columns. If RANGE = 'V' or 'v' then NFOUND may not be known in advance and an upper bound must be used. For A(LDZ,K) where NFOUND > K, the eigenvectors will be stored into memory with unpredictable results.

LDZ

Leading dimension of the array Z as specified in a dimension or type statement. LDZ 1. If JOBZ = 'V' or 'v' then LDZ max(1, N).

xWORK

Scratch array with a dimension of LDWORK.

LDWORK

Leading dimension of the array WORK as specified in a dimension or type statement. LDWORK 2 × N - 1.

xWORK2

Scratch array with a dimension of 7 × N.

IWORK3

Scratch array with a dimension of 5 × N.

IFAIL

On exit, an N-element array that indicates which eigenvectors that failed to converge. If JOBZ = 'V' or 'v' and INFO = 0 then all N elements contain zero. If INFO > 0 then IFAIL contains the indices of the eigenvectors that failed to converge. If JOBZ = 'N' or 'n' then IFAIL is not used.

INFO

On exit:

INFO = 0

Subroutine completed normally.

INFO < 0

The ith argument, where i = |INFO|, had an illegal value.

INFO > 0

There were i eigenvectors, where i = INFO, that failed to converge. Their indices are stored in IFAIL.

Sample Program




      PROGRAM TEST
      IMPLICIT NONE
C
      DOUBLE PRECISION  ZERO
      INTEGER           LDA, LDEVAL, LDEVEC, LDIWRK, LDWORK
      INTEGER           LDWRK2, N
      PARAMETER        (N = 3)
      PARAMETER        (LDA = N)
      PARAMETER        (LDEVAL = N)
      PARAMETER        (LDEVEC = N)
      PARAMETER        (LDIWRK = 5 * N)
      PARAMETER        (LDWORK = 2 * N - 1)
      PARAMETER        (LDWRK2 = 7 * N)
      PARAMETER        (ZERO = 0.0D0)
C
      DOUBLE PRECISION  EVALS(LDEVAL), TEMP, WORK2(LDWRK2)
      COMPLEX*16        A(LDA,N), EVECS(LDEVEC,N), WORK(LDWORK)
      INTEGER           ICOL, IFAIL(N), INFO, IROW, ITEMP
      INTEGER           IWORK(LDIWRK), NFOUND
C
      EXTERNAL          ZHEEVX
      INTRINSIC         ABS, CMPLX, CONJG, DBLE
C
C     Initialize the array A to store the coefficient array A
C     shown below.
C
C          4     4-4i    0
C     A = 4+4i    0     4-4i
C          0     4+4i    0
C
      DATA A / (4.0D0,8D8),    (8D8,8D8),      (8D8,8D8),
     $         (4.0D0,-4.0D0), (4.0D0,8D8),    (8D8,8D8),
     $         (0.0D0,0.0D0),  (4.0D0,-4.0D0), (4.0D0,8D8) /
C
C     Print the initial value of A.
C
      PRINT 1000
      DO 100, IROW = 1, N
        PRINT 1010, (CONJG(A(ICOL,IROW)), ICOL = 1, IROW - 1),
     $              CMPLX(DBLE(A(IROW,IROW)),ZERO),
     $              (A(IROW,ICOL), ICOL = IROW + 1, N)
  100 CONTINUE
      PRINT 1020
      DO 110, IROW = 1, N
        PRINT 1010, (A(IROW,ICOL), ICOL = 1, N)
  110 CONTINUE
      CALL ZHEEVX ('VALUES AND VECTORS', 'ALL VALUES',
     $             'UPPER TRIANGLE OF A STORED', N, A, LDA, TEMP,
     $             TEMP, ITEMP, ITEMP, ZERO, NFOUND, EVALS,
     $             EVECS, LDEVEC, WORK, LDWORK, WORK2, IWORK,
     $             IFAIL, INFO)
      IF (INFO .LT. 0) THEN
        PRINT 1040, ABS(INFO)
        STOP 1
      ELSE IF (INFO .GT. 0) THEN
        PRINT 1050
        STOP 2
      END IF
C
C     Print the eigenvalues and eigenvectors.
C
      PRINT 1060
      DO 200, IROW = 1, N
        PRINT 1070, EVALS(IROW), (EVECS(IROW,ICOL), ICOL = 1, N)
  200 CONTINUE
C
 1000 FORMAT (1X, 'A in full form:')
 1010 FORMAT (1X, 10(: 2X, '(', F5.1, ',', F5.1, ')'))
 1020 FORMAT (/1X, 'A in Hermitian form:  (* in unused entries)')
 1030 FORMAT (/1X, 'b:')
 1040 FORMAT (1X, 'Illegal argument to ZHEEVX, argument #', I2)
 1050 FORMAT (1X, 'Convergence failure, INFO = ', I2)
 1060 FORMAT (/1X, 'Eigenvalue', 16X, 'Eigenvector**T')
 1070 FORMAT (1X, F8.3, 6X, '[', 3('(', F4.1, ',', F4.1, ')  '),
     $        ']')
C
      END
 

Sample Output

 
 A in full form:
   (  4.0,  0.0)  (  4.0, -4.0)  (  0.0,  0.0)
   (  4.0,  4.0)  (  4.0,  0.0)  (  4.0, -4.0)
   (  0.0,  0.0)  (  4.0,  4.0)  (  4.0,  0.0)



 A in Hermitian form:  (* in unused entries)
   (  4.0,*****)  (  4.0, -4.0)  (  0.0,  0.0)
   (*****,*****)  (  4.0,*****)  (  4.0, -4.0)
   (*****,*****)  (*****,*****)  (  4.0,*****)



 Eigenvalue                Eigenvector**T
   -4.000      [( 0.0, 0.5)  ( 0.0, 0.7)  ( 0.0, 0.5)  ]
    4.000      [( 0.5,-0.5)  ( 0.0, 0.0)  (-0.5, 0.5)  ]
   12.000      [(-0.5, 0.0)  ( 0.7, 0.0)  (-0.5, 0.0)  ]






Previous Next Contents Generated Index Doc Set Home