Previous Next Contents Generated Index Doc Set Home



Eigenvalues and Eigenvectors of a General Matrix (Simple Driver)

The subroutines described in this section compute the eigenvalues of a square general matrix A and, optionally, the normalized left and/or right eigenvectors of A. The left eigenvectors of A are the same as the right eigenvectors of AT or AH. The eigenvectors are normalized to have a Euclidian norm of 1 and a largest component that is real. Note that the expert driver xGEEVX is also available.

Calling Sequence

CALL DGEEV 
(JOBVL, JOBVR, N, DA, LDA, DWR, DWI, DVL, LDVL, DVR, 
LDVR, DWORK, LDWORK, INFO)
CALL SGEEV 
(JOBVL, JOBVR, N, SA, LDA, SWR, SWI, SVL, LDVL, SVR, 
LDVR, SWORK, LDWORK, INFO)
CALL ZGEEV 
(JOBVL, JOBVR, N, ZA, LDA, ZW, ZVL, LDVL, ZVR, LDVR, 
ZWORK, LDWORK, DWORK2, INFO)
CALL CGEEV 
(JOBVL, JOBVR, N, CA, LDA, CW, CVL, LDVL, CVR, LDVR, 
CWORK, LDWORK, SWORK2, INFO)






void dgeev 
(char jobvl, char jobvr, int n, double *da, int lda, 
double *dwr, double *dwi, double *dvl, int ldvl, double 
*dvr, int ldvr, int *info)
void sgeev 
(char jobvl, char jobvr, int n, float *sa, int lda, 
float *swr, float *swi, float *svl, int ldvl, float 
*svr, int ldvr, int *info)
void zgeev 
(char jobvl, char jobvr, int n, doublecomplex *za, int 
lda, doublecomplex *zw, doublecomplex *vl, int ldvl, 
doublecomplex *zvr, int ldvr, int *info)
void cgeev 
(char jobvl, char jobvr, int n, complex *ca, int lda, 
complex *cw, complex *vl, int ldvl, complex *cvr, int 
ldvr, int *info)

Arguments

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.

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.

N

Order of the matrix A. N 0.

xA

On entry, the matrix A.
On exit, A has been overwritten.

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 computed eigenvalues. Complex conjugate pairs of eigenvalues 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
(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).

xWORK

Scratch array with a dimension of LDWORK.

LDWORK

Leading dimension of the array WORK as specified in a dimension or type statement.

For real subroutines:

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

For complex subroutines:

LDWORK max(1, 2 × N).

xWORK2

Scratch array with a dimension of 2 × N for complex subroutines.

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 have been computed. Elements i+1 through N of WR and WI (or W), where i = INFO, contain those eigenvalues that have converged.

Sample Program




      PROGRAM TEST
      IMPLICIT NONE
C
      INTEGER           LDA, LDVR, LDWORK, N
      PARAMETER        (N = 2)
      PARAMETER        (LDA = N)
      PARAMETER        (LDVR = 2 * N)
      PARAMETER        (LDWORK = 4 * N)
C
      DOUBLE PRECISION  A(LDA,N), SCRATCH, VR(LDVR,N)
      DOUBLE PRECISION  WORK(LDWORK), WR(N), WI(N)
      INTEGER           I, ICOL, INFO, IROW
C
      EXTERNAL          DGEEV
      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 DGEEV ('NO LEFT EIGENVECTORS', 'VRIGHT', N, A, LDA, WR,
     $            WI, SCRATCH, 1, VR, LDVR, WORK, LDWORK, 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 DGEEV, 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