Previous Next Contents Generated Index Doc Set Home



Eigenvalues, Eigenvectors, and Reciprocal Condition Numbers of a General Matrix (Expert Driver)

The subroutines described in this section compute the eigenvalues of a general matrix A. They can also compute normalized left and/or right eigenvectors, reciprocal condition numbers for the eigenvalues, and reciprocal condition numbers for the right eigenvectors. The left eigenvectors of A are the same as the right eigenvectors of AT or AH. The eigenvectors are normalized to have a Euclidean norm of 1 and a largest component that is real.

The computations of eigenvalues, eigenvectors, and condition numbers may be done with an optional balancing tranformation which often improves the condition and accuracy. Note that the simple driver xGEEV is also available.

Calling Sequence

CALL DGEEVX 
(BALANC, JOBVL, JOBVR, SENSE, N, DA, LDA, DWR, DWI, 
DVL, LDVL, DVR, LDVR, ILO, IHI, DSCALE, DABNRM, DRCONE, 
DRCONV, DWORK, LDWORK, IWORK2, INFO)
CALL SGEEVX
(BALANC, JOBVL, JOBVR, SENSE, N, SA, LDA, SWR, SWI, 
SVL, LDVL, SVR, LDVR, ILO, IHI, SSCALE, SABNRM, SRCONE, 
SRCONV, SWORK, LDWORK, IWORK2, INFO)
CALL ZGEEVX 
(BALANC, JOBVL, JOBVR, SENSE, N, ZA, LDA, ZW, ZVL, 
LDVL, ZVR, LDVR, ILO, IHI, DSCALE, DABNRM, DRCONE, 
DRCONV, ZWORK, LDWORK, DWORK2, INFO)
CALL CGEEVX 
(BALANC, JOBVL, JOBVR, SENSE, N, CA, LDA, CW, CVL, 
LDVL, CVR, LDVR, ILO, IHI, SSCALE, SABNRM, SRCONE, 
SRCONV, CWORK, LDWORK, SWORK2, INFO)






void dgeevx 
(char balanc, char jobvl, char jobvr, char sense, int 
n, double *da, int lda, double *dwr, double *dwi, 
double *dvl, int ldvl, double *dvr, int ldvr, int *ilo, 
int *ihi, double *dscale, double *dabnrm, double 
*drcone, double *drconv, int *info)
void sgeevx 
(char balanc, char jobvl, char jobvr, char sense, int 
n, float *sa, int lda, float *swr, float *swi, float 
*svl, int ldvl, float *svr, int ldvr, int *ilo, int 
*ihi, float *sscale, float *sabnrm, float *srcone, 
float *srconv, int *info)
void zgeevx 
(char balanc, char jobvl, char jobvr, char sense, int 
n, doublecomplex *za, int lda, doublecomplex *zw, 
doublecomplex *vl, int ldvl, doublecomplex *zvr, int 
ldvr, int *ilo, int *ihi, double *dscale, double 
*dabnrm, double *drcone, double *drconv, int *info)
void cgeevx 
(char balanc, char jobvl, char jobvr, char sense, int 
n, complex *ca, int lda, complex *cw, complex *vl, int 
ldvl, complex *cvr, int ldvr, int *ilo, int *ihi, float 
*sscale, float *sabnrm, float *srcone, float *srconv, 
int *info)

Arguments

BALANC

Indicates how the input matrix will be diagonally scaled and/or permuted to try to improve the conditioning of its eigenvalues. The legal values for BALANC are listed below. Any values not listed below are illegal.

'N' or 'n'

Do not diagonally scale or permute A.

'P' or 'p'

Permute A to make it more nearly upper triangular, but do not diagonally scale A.

'S' or 's'

Diagonally scale A, i.e. replace A by DAD-1 for a diagonal matrix D chosen to make the rows and columns of A more equal in norm.

'B' or 'b'

Both diagonally scale and permute A.

Computed reciprocal condition numbers will be for the matrix after balancing and/or permuting. Permuting does not change the condition number (in exact arithmetic), but balancing does.

JOBVL

Indicates whether or not the left eigenvectors will be computed. The legal values for JOBVL are listed below. Any values not listed below are illegal.

'N' or 'n'

Left eigenvectors will not be computed.

'V' or 'v'

Left eigenvectors will be computed.

If SENSE = 'E', 'e', 'B', or 'b' then JOBVL must be 'V' or 'v'.

JOBVR

Indicates whether or not the right eigenvectors will be computed. The legal values for JOBVR are listed below. Any values not listed below are illegal.

'N' or 'n'

Right eigenvectors will not be computed.

'V' or 'v'

Right eigenvectors will be computed.

If SENSE = 'E', 'e', 'B', or 'b' then JOBVR must be 'V' or 'v'.

SENSE

Indicates which reciprocal condition numbers will be computed, if any. The legal values for SENSE are shown below. Any values not listed below are illegal.

'N' or 'n'

None computed.

'E' or 'e'

Computed for eigenvalues only.

'V' or 'v'

Computed for right eigenvectors only.

'B' or 'b'

Computed for eigenvalues and right eigenvectors.

If SENSE = 'E', 'e', 'B', or 'b' then both left and right eigenvectors must be computed, so both JOBVL and JOBVR must be set to 'V' or 'v'.

N

Order of the matrix A. N 0.

xA

On entry, the matrix A.
On exit, xA has been overwritten. If either JOBVL or JOBVR contain 'V' or 'v' then xA contains the Schur form of the balanced A.

LDA

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

xWR, xWI

(For real subroutines)
On exit, WR and WI contain the real and imaginary parts, respectively, of the N computed eigenvalues. Complex conjugate pairs of eigenvalues will appear consecutively with the eigenvalue having the positive imaginary part first.

xW

(For complex subroutines)
Computed eigenvalues of A.

xVL

On exit, if JOBVL = 'V' or 'v' then the left eigenvectors u(j) are stored one after another in the columns of VL, in the same order as their eigenvalues. If the jth eigenvalue is real, then u(j) = VL(*, j). If the jth and (j+1)th eigenvalues form a complex conjugate pair, then
u(j) = VL(*, j) + i × VL(*, j+1) and u(j+1) = VL(*, j) + i × VL(*, j+1).
If JOBVL = 'N' or 'n' then VL is not used.

LDVL

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

xVR

On exit, if JOBVR = 'V' or 'v' then the right eigenvectors v(j) are stored one after another in the columns of VR, in the same order as their eigenvalues. If the jth eigenvalue is real, then

v(j) = VR(*, j). If the jth and (j+1)th eigenvalues form a complex conjugate pair, then v(j) = VR(*, j) + i × VR(*, j+1) and
v(j+1) = VR(*, j) + i × VR(*, j+1).
If JOBVR = 'N' or 'n' then VR is not used.

LDVR

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

ILO, IHI

On exit, ILO and IHI contain integer values determined when A was balanced. The balanced A(i,j) = 0 for i > j, 1 j ILO-1, and
IHI+1 i N.

xSCALE

On exit, details of the permutations and scaling factors applied when balancing A. If P(j) is the index of the row and column interchanged with row and column j, and D(j) is the scaling factor applied to row and column j, then

SCALE(j) = P(j)

for 1 j ILO-1

SCALE(j) = D(j)

for ILO j IHI

SCALE(j) = P(j)

for IHI+1 j N

The order in which the interchanges are made is N through IHI+1, then 1 through ILO-1.

xABNRM

On exit, the 1-norm of the balanced matrix.

xRCONE

On exit, if SENSE = 'E', 'e', 'B', or 'b', then RCONE(j) for 1 j N is the reciprocal condition number of the jth eigenvalue. Otherwise RCONE is not used.

xRCONV

On exit, if SENSE = 'E', 'e', 'B', or 'b', then RCONV(j) for 1 j N is the reciprocal condition number of the jth right eigenvector. Otherwise RCONV is not used.

xWORK

Scratch array with a dimension of LDWORK.

LDWORK

Leading dimension of the array WORK as specified in a dimension or type statement. If SENSE = 'N', 'n', 'E', or 'e', then LDWORK max(1, 2 × N). Otherwise:

For real subroutines:

If JOBVL = 'V' or 'v', then LDWORK max(1, 3 × N).

If SENSE = 'V', 'v', 'B', or 'b' then LDWORK N × (N + 6).

For complex subroutines:

If SENSE = 'V', 'v', 'B', or 'b' then LDWORK N × N + 2 × N.

xWORK2

Scratch array with the following dimension:

For real subroutines: 2 × N - 2. If SENSE = 'N', 'n', 'E', or 'e' then WORK2 is not used.

For complex subroutines: 2 × N.

INFO

On exit:

INFO = 0

Subroutine completed normally.

INFO < 0

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

INFO > 0

The QR algorithm failed to compute all the eigenvalues, and no eigenvectors or condition numbers have been computed. Elements 1 through ILO-1 and i+1 through N of WR and WI (or of W), where i = INFO contain eigenvalues that have converged.

Sample Program




      PROGRAM TEST
      IMPLICIT NONE
C
      INTEGER           LDA, LDIWRK, LDVR, LDWORK, N
      PARAMETER        (N = 2)
      PARAMETER        (LDA = N)
      PARAMETER        (LDIWRK = 2 * N - 2)
      PARAMETER        (LDVR = 3 * N)
      PARAMETER        (LDWORK = 3 * N)
C
      DOUBLE PRECISION  A(LDA,N), BALNRM, SCALE(N), TEMP
      DOUBLE PRECISION  VR(LDVR,N), WORK(LDWORK), WR(N), WI(N)
      INTEGER           I, ICOL, IHI, ILO, INFO, IROW
      INTEGER           IWORK(LDIWRK)
C
      EXTERNAL          DGEEVX
      INTRINSIC         ABS
C
C     Initialize the array A to store the matrix A shown below.
C
C     A = 0  1
C        -6  5
C
      DATA A / 0.0D0, -6.0D0, 1.0D0, 5.0D0 /
C
C     Print the initial value of A.
C
      PRINT 1000
      PRINT 1010, ((A(IROW,ICOL), ICOL = 1, N), IROW = 1, N)
C
C     Compute the eigenvalues and right eigenvectors of A.
C
      CALL DGEEVX ('BOTH PERMUTE AND SCALE A',
     $             'NO LEFT EIGENVECTORS', 'VRIGHT',
     $             'NO CONDITION NUMBERS', N, A, LDA, WR, WI,
     $             TEMP, 1, VR, LDVR, ILO, IHI, SCALE, BALNRM,
     $             TEMP, TEMP, WORK, LDWORK, IWORK, INFO)
      IF (INFO .NE. 0) THEN
        IF (INFO .LT. 0) THEN
          PRINT 1020, ABS(INFO)
          STOP 1
        ELSE
          PRINT 1030, INFO
          STOP 2
        END IF
      END IF
C
C     Print the eigenvalues and eigenvectors.
C
      PRINT 1040
      DO 120, IROW = 1, N
        PRINT 1050, WR(IROW), (VR(I,IROW), I = 1, N)
  120 CONTINUE
C
 1000 FORMAT (1X, 'A:')
 1010 FORMAT (2(3X, F4.1))
 1020 FORMAT (/1X, 'Illegal argument to DGEEVX, argument = ', I2)
 1030 FORMAT (/1X, 'QR failed to converge, INFO = ', I2)
 1040 FORMAT (/1X, 'Eigenvalue', 4X, 'Eigenvector**T')
 1050 FORMAT (1X, F5.2, 10X, '[', F4.2, ', ', F4.2, ']')
C
      END
 

Sample Output

 
 A:
    0.0    1.0
   -6.0    5.0



 Eigenvalue    Eigenvector**T
  2.00          [0.45, 0.89]
  3.00          [0.32, 0.95]






Previous Next Contents Generated Index Doc Set Home