|
|
◆ Dgeevx()
| Sub Dgeevx |
( |
Balanc As |
String, |
|
|
Jobvl As |
String, |
|
|
Jobvr As |
String, |
|
|
Sense As |
String, |
|
|
N As |
Long, |
|
|
A() As |
Double, |
|
|
Wr() As |
Double, |
|
|
Wi() As |
Double, |
|
|
Vl() As |
Double, |
|
|
Vr() As |
Double, |
|
|
Ilo As |
Long, |
|
|
Ihi As |
Long, |
|
|
Scal() As |
Double, |
|
|
AbNrm As |
Double, |
|
|
RConde() As |
Double, |
|
|
RCondv() As |
Double, |
|
|
Info As |
Long |
|
) |
| |
(Expert driver) Eigenvalues and left and/or right eigenvectors of a general matrix
- Purpose
- This routine computes for an n x n real nonsymmetric matrix A, the eigenvalues and, optionally, the left and/or right eigenvectors.
Optionally also, it computes a balancing transformation to improve the conditioning of the eigenvalues and eigenvectors (Ilo, Ihi, Scal, and AbNrm), reciprocal condition numbers for the eigenvalues (RConde), and reciprocal condition numbers for the right eigenvectors (RCondv).
The right eigenvector v(j) of A satisfies where λ(j) is its eigenvalue.
The left eigenvector u(j) of A satisfies u(j)^H * A = λ(j) * u(j)^H
where u(j)^H denotes the conjugate transpose of u(j).
The computed eigenvectors are normalized to have Euclidean norm equal to 1 and largest component real.
Balancing a matrix means permuting the rows and columns to make it more nearly upper triangular, and applying a diagonal similarity transformation D*A*D^(-1), where D is a diagonal matrix, to make its rows and columns closer in norm and the condition numbers of its eigenvalues and eigenvectors smaller. The computed reciprocal condition numbers correspond to the balanced matrix. Permuting rows and columns will not change the condition numbers (in exact arithmetic) but diagonal scaling will. For further explanation of balancing, see Section 4.8.1 of the LAPACK Users' Guide Third Edition.
- Parameters
-
| [in] | Balanc | Indicates how the input matrix should be diagonally scaled and/or permuted to improve the conditioning of its eigenvalues.
= "N": Do not diagonally scale or permute.
= "P": Perform permutations to make the matrix more nearly upper triangular. Do not diagonally scale.
= "S": Diagonally scale the matrix, i.e. replace A by D*A*D^(-1), where D is a diagonal matrix chosen to make the rows and columns of A more equal in norm. Do not permute.
= "B": Both diagonally scale and permute A. |
| [in] | JobVl | = "N": Left eigenvectors of A are not computed.
= "V": Left eigenvectors of A are computed.
If Sense = "E" or "B", Jobvl must = "V". |
| [in] | JobVr | = "N": Right eigenvectors of A are not computed.
= "V": Right eigenvectors of A are computed.
If Sense = "E" or "B", Jobvr must = "V". |
| [in] | Sense | Determines which reciprocal condition numbers are computed.
= "N": None are computed.
= "E": Computed for eigenvalues only.
= "V": Computed for right eigenvectors only.
= "B": Computed for eigenvalues and right eigenvectors.
If Sense = "E" or "B", both left and right eigenvectors must also be computed (Jobvl = "V" and Jobvr = "V"). |
| [in] | N | Order of the matrix A. (N >= 0) (If N = 0, returns without computation) |
| [in,out] | A() | Array A(LA1 - 1, LA2 - 1) (LA1 >= N, LA2 >= N)
[in] N x N matrix A.
[out] A() has been overwritten. If Jobvl = "V" or Jobvr = "V", A() contains the real Schur form of the balanced version of the input matrix A. |
| [out] | Wr() | Array Wr(LWr - 1) (LWr >= N) |
| [out] | Wi() | Array Wi(LWi - 1) (LWi >= N)
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. |
| [out] | Vl() | Array Vl(LVl1 - 1, LVl2 - 1) (LVl1 >= N, LVl2 >= N)
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 the j-th eigenvalue is real, then u(j) = (j-th column of Vl()).
If the j-th and (j+1)-st eigenvalues form a complex conjugate pair, then u(j) = (j-th column of Vl()) + i*((j+1)-th column of Vl()) and u(j+1) = (j-th column of Vl()) - i*((j+1)-st column of Vl()).
jobvl = "N": Vl() is not referenced. |
| [out] | Vr() | Array Vr(LVr1 - 1, LVr2 - 1) (LVr1 >= N, LVr2 >= N)
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 the j-th eigenvalue is real, then v(j) = (j-th column of Vr())
If the j-th and (j+1)-st eigenvalues form a complex conjugate pair, then v(j) = (j-th column of Vr()) + i*((j+1)-st column of Vr()) and v(j+1) = (j-th column of Vr()) - i*((j+1)-st column of Vr()).
jobvr = "N": Vr() is not referenced. |
| [out] | Ilo | |
| [out] | Ihi | Ilo and Ihi are integer values determined when A was balanced. The balanced A(i, j) = 0 if i > j and j = 0, ..., Ilo-2 or i = Ihi, ..., N-1. |
| [out] | Scal() | Array Scal(LScal - 1) (LScal >= N)
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
Scal[j] = p(j), for j = 0 to Ilo-2
= d(j), for j = Ilo-1 to Ihi-1
= p(j), for j = Ihi to N-1
The order in which the interchanges are made is N-1 to Ihi, then 0 to Ilo-2. |
| [out] | AbNrm | The one-norm of the balanced matrix (the maximum of the sum of absolute values of elements of any column). |
| [out] | RConde() | Array RConde(LRConde - 1) (LRConde >= N)
RConde(j) is the reciprocal condition number of the j-th eigenvalue.
Not referenced if sense = "N" or "V". |
| [out] | RCondv() | Array RCondv(LRCondv - 1) (LRCondv >= N)
RCondv(j) is the reciprocal condition number of the j-th right eigenvector.
Not referenced if sense = "N" or "E". |
| [out] | Info | = 0: Successful exit.
= -1: The argument Balanc had an illegal value. (Balanc <> "N", "P", "S" nor "B")
= -2: The argument Jobvl had an illegal value. (Jobvl <> "V" nor "N")
= -3: The argument Jobvr had an illegal value. (Jobvr <> "V" nor "N")
= -4: The argument Sense had an illegal value. (Sense <> "N", "E", "V" nor "B")
= -5: The argument N had an illegal value. (N < 0)
= -6: The argument A() is invalid.
= -7: The argument Wr() is invalid.
= -8: The argument Wi() is invalid.
= -9: The argument Vl() is invalid.
= -10: The argument Vr() is invalid.
= -13: The argument Scal() is invalid.
= -15: The argument RConde() is invalid.
= -16: The argument RCondv() is invalid.
= i > 0: The QR algorithm failed to compute all the eigenvalues, and no eigenvectors or condition numbers have been computed. Elements 0 to Ilo-2 and i to N-1 of Wr() and Wi() contain eigenvalues which have converged. |
- Reference
- LAPACK
- Example Program
- Compute all eigenvalues and eigenvectors of the general matrix A, where
( 0.20 -0.11 -0.93 )
A = ( -0.32 0.81 0.37 )
( -0.80 -0.92 -0.29 )
Sub Ex_Dgeevx()
Const N = 3
Dim A(N - 1, N - 1) As Double, Wr(N - 1) As Double, Wi(N - 1) As Double
Dim Vl(N - 1, N - 1) As Double, Vr(N - 1, N - 1) As Double, Info As Long
Dim Ilo As Long, Ihi As Long, Scal(N - 1) As Double, AbNrm As Double
Dim RConde(N - 1) As Double, RCondv(N - 1) As Double
A(0, 0) = 0.2: A(0, 1) = -0.11: A(0, 2) = -0.93
A(1, 0) = -0.32: A(1, 1) = 0.81: A(1, 2) = 0.37
A(2, 0) = -0.8: A(2, 1) = -0.92: A(2, 2) = -0.29
Call Dgeevx("N", "V", "V", "N", N, A(), Wr(), Wi(), Vl(), Vr(), Ilo, Ihi, Scal(), AbNrm, RConde(), RCondv(), Info)
Debug.Print "Eigenvalues (r) =", Wr(0), Wr(1), Wr(2)
Debug.Print "Eigenvalues (i) =", Wi(0), Wi(1), Wi(2)
Debug.Print "Eigenvectors (L) ="
Debug.Print Vl(0, 0), Vl(0, 1), Vl(0, 2)
Debug.Print Vl(1, 0), Vl(1, 1), Vl(1, 2)
Debug.Print Vl(2, 0), Vl(2, 1), Vl(2, 2)
Debug.Print "Eigenvectors (R) ="
Debug.Print Vr(0, 0), Vr(0, 1), Vr(0, 2)
Debug.Print Vr(1, 0), Vr(1, 1), Vr(1, 2)
Debug.Print Vr(2, 0), Vr(2, 1), Vr(2, 2)
Debug.Print "Info =", Info
End Sub
Sub Dgeevx(Balanc As String, Jobvl As String, Jobvr As String, Sense As String, N As Long, A() As Double, Wr() As Double, Wi() As Double, Vl() As Double, Vr() As Double, Ilo As Long, Ihi As Long, Scal() As Double, AbNrm As Double, RConde() As Double, RCondv() As Double, Info As Long) (Expert driver) Eigenvalues and left and/or right eigenvectors of a general matrix
- Example Results
Eigenvalues (r) = -0.904130023851345 0.812065011925673 0.812065011925673
Eigenvalues (i) = 0 0.48915757543818 -0.48915757543818
Eigenvectors (L) =
-0.610555216308549 6.20242550062375E-02 -0.532191939813679
-0.404592057902723 0.7174496715502 0
-0.680828608770563 -9.02631541142068E-03 0.445094625232521
Eigenvectors (R) =
-0.640873419668578 -0.22876069887917 -0.504184181286349
4.57634889263765E-02 0.671832713345003 0
-0.766281255834689 -0.194097516422216 0.45214357607639
Info = 0
|