Computes the eigenvalues and left and right eigenvectors of a general matrix.
FORTRAN 77:
call sgeev(jobvl, jobvr, n, a, lda, wr, wi, vl, ldvl, vr, ldvr, work, lwork, info)
call dgeev(jobvl, jobvr, n, a, lda, wr, wi, vl, ldvl, vr, ldvr, work, lwork, info)
call cgeev(jobvl, jobvr, n, a, lda, w, vl, ldvl, vr, ldvr, work, lwork, rwork, info)
call zgeev(jobvl, jobvr, n, a, lda, w, vl, ldvl, vr, ldvr, work, lwork, rwork, info)
FORTRAN 95:
call geev(a, wr, wi [,vl] [,vr] [,info])
call geev(a, w [,vl] [,vr] [,info])
C:
lapack_int LAPACKE_sgeev( int matrix_order, char jobvl, char jobvr, lapack_int n, float* a, lapack_int lda, float* wr, float* wi, float* vl, lapack_int ldvl, float* vr, lapack_int ldvr );
lapack_int LAPACKE_dgeev( int matrix_order, char jobvl, char jobvr, lapack_int n, double* a, lapack_int lda, double* wr, double* wi, double* vl, lapack_int ldvl, double* vr, lapack_int ldvr );
lapack_int LAPACKE_cgeev( int matrix_order, char jobvl, char jobvr, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_complex_float* w, lapack_complex_float* vl, lapack_int ldvl, lapack_complex_float* vr, lapack_int ldvr );
lapack_int LAPACKE_zgeev( int matrix_order, char jobvl, char jobvr, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_complex_double* w, lapack_complex_double* vl, lapack_int ldvl, lapack_complex_double* vr, lapack_int ldvr );
The routine computes for an n-by-n real/complex nonsymmetric matrix A, the eigenvalues and, optionally, the left and/or right eigenvectors. The right eigenvector v(j) of A satisfies
A*v(j)= λ(j)*v(j)
where λ(j) is its eigenvalue.
The left eigenvector u(j) of A satisfies
u(j)T*A = λ(j)*u(j)T
where u(j)T denotes the transpose of u(j). The computed eigenvectors are normalized to have Euclidean norm equal to 1 and largest component real.
The data types are given for the Fortran interface. A <datatype> placeholder, if present, is used for the C interface data types in the C interface section above. See C Interface Conventions for the C interface principal conventions and type definitions.
CHARACTER*1. Must be 'N' or 'V'.
If jobvl = 'N', then left eigenvectors of A are not computed.
If jobvl = 'V', then left eigenvectors of A are computed.
CHARACTER*1. Must be 'N' or 'V'.
If jobvr = 'N', then right eigenvectors of A are not computed.
If jobvr = 'V', then right eigenvectors of A are computed.
INTEGER. The order of the matrix A (n ≥ 0).
REAL for sgeev
DOUBLE PRECISION for dgeev
COMPLEX for cgeev
DOUBLE COMPLEX for zgeev.
Arrays:
a(lda,*) is an array containing the n-by-n matrix A.
The second dimension of a must be at least max(1, n).
work is a workspace array, its dimension max(1, lwork).
INTEGER. The leading dimension of the array a. Must be at least max(1, n).
INTEGER. The leading dimensions of the output arrays vl and vr, respectively.
Constraints:
ldvl ≥ 1; ldvr ≥ 1.
If jobvl = 'V', ldvl ≥ max(1, n);
If jobvr = 'V', ldvr ≥ max(1, n).
INTEGER.
The dimension of the array work.
Constraint:
lwork ≥ max(1, 3n), and if jobvl = 'V' or jobvr = 'V', lwork < max(1, 4n) (for real flavors);
lwork < max(1, 2n) (for complex flavors).
For good performance, lwork must generally be larger.
If lwork = -1, then a workspace query is assumed; the routine only calculates the optimal size of the work array, returns this value as the first entry of the work array, and no error message related to lwork is issued by xerbla.
REAL for cgeev
DOUBLE PRECISION for zgeev
Workspace array, DIMENSION at least max(1, 2n). Used in complex flavors only.
On exit, this array is overwritten by intermediate results.
REAL for sgeev
DOUBLE PRECISION for dgeev
Arrays, DIMENSION at least max (1, n) each.
Contain the real and imaginary parts, respectively, of the computed eigenvalues. Complex conjugate pairs of eigenvalues appear consecutively with the eigenvalue having positive imaginary part first.
COMPLEX for cgeev
DOUBLE COMPLEX for zgeev.
Array, DIMENSION at least max(1, n).
Contains the computed eigenvalues.
REAL for sgeev
DOUBLE PRECISION for dgeev
COMPLEX for cgeev
DOUBLE COMPLEX for zgeev.
Arrays:
vl(ldvl,*);the second dimension of vl must be at least max(1, n).
If jobvl = 'V', the left eigenvectors u(j) are stored one after another in the columns of vl, in the same order as their eigenvalues.
If jobvl = 'N', vl is not referenced.
For real flavors:
If the j-th eigenvalue is real, then u(j) = vl(:,j), the j-th column of vl.
If the j-th and (j+1)-st 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), where i = sqrt(-1).
For complex flavors:
u(j) = vl(:,j), the j-th column of vl.
vr(ldvr,*); the second dimension of vr must be at least max(1, n).
If jobvr = 'V', the right eigenvectors v(j) are stored one after another in the columns of vr, in the same order as their eigenvalues.
If jobvr = 'N', vr is not referenced.
For real flavors:
If the j-th eigenvalue is real, then v(j) = vr(:,j), the j-th column of vr.
If the j-th and (j+1)-st 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), where i = sqrt(-1).
For complex flavors:
v(j) = vr(:,j), the j-th column of vr.
On exit, if info = 0, then work(1) returns the required minimal size of lwork.
INTEGER.
If info = 0, the execution is successful.
If info = -i, the ith parameter had an illegal value.
If info = i, the QR algorithm failed to compute all the eigenvalues, and no eigenvectors have been computed; elements i+1:n of wr and wi (for real flavors) or w (for complex flavors) contain those eigenvalues which have converged.
Routines in Fortran 95 interface have fewer arguments in the calling sequence than their FORTRAN 77 counterparts. For general conventions applied to skip redundant or restorable arguments, see Fortran 95 Interface Conventions.
Specific details for the routine geev interface are the following:
Holds the matrix A of size (n, n).
Holds the vector of length n. Used in real flavors only.
Holds the vector of length n. Used in real flavors only.
Holds the vector of length n. Used in complex flavors only.
Holds the matrix VL of size (n, n).
Holds the matrix VR of size (n, n).
Restored based on the presence of the argument vl as follows:
jobvl = 'V', if vl is present,
jobvl = 'N', if vl is omitted.
Restored based on the presence of the argument vr as follows:
jobvr = 'V', if vr is present,
jobvr = 'N', if vr is omitted.
If you are in doubt how much workspace to supply, use a generous value of lwork for the first run or set lwork = -1.
If you choose the first option and set any of admissible lwork sizes, which is no less than the minimal value described, the routine completes the task, though probably not so fast as with a recommended workspace, and provides the recommended workspace in the first element of the corresponding array work on exit. Use this value (work(1)) for subsequent runs.
If you set lwork = -1, the routine returns immediately and provides the recommended workspace in the first element of the corresponding array (work). This operation is called a workspace query.
Note that if you set lwork to less than the minimal required value and not -1, the routine returns immediately with an error exit and does not provide any information on the recommended workspace.