XLPack 6.1
Excel VBA Numerical Library Reference Manual
Loading...
Searching...
No Matches

◆ Dgeesx()

Sub Dgeesx ( JobVs As  String,
Sort As  String,
Selct As  LongPtr,
Sense As  String,
N As  Long,
A() As  Double,
Sdim As  Long,
Wr() As  Double,
Wi() As  Double,
Vs() As  Double,
RConde As  Double,
RCondv As  Double,
Info As  Long 
)

(Expert driver) Schur factorization of a general matrix

Purpose
This routine computes for an n x n real nonsymmetric matrix A, the eigenvalues, the real Schur form T, and, optionally, the matrix of Schur vectors Z. This gives the Schur factorization A = Z*T*Z^T.

Optionally, it also orders the eigenvalues on the diagonal of the real Schur form so that selected eigenvalues are at the top left; computes a reciprocal condition number for the average of the selected eigenvalues (rconde); and computes a reciprocal condition number for the right invariant subspace corresponding to the selected eigenvalues (rcondv). The leading columns of Z form an orthonormal basis for this invariant subspace.

For further explanation of the reciprocal condition numbers rconde and rcondv, see Section 4.8.1 of the LAPACK Users' Guide Third Edition (where these quantities are called s and sep respectively).

A real matrix is in real Schur form if it is upper quasi-triangular with 1 x 1 and 2 x 2 blocks. 2 x 2 blocks will be standardized in the form
[ a b ]
[ c a ]
where b*c < 0. The eigenvalues of such a block are a+-sqrt(bc).
Parameters
[in]JobVs= "N": Schur vectors are not computed
= "V": Schur vectors are computed
[in]SortSpecifies whether or not to order the eigenvalues on the diagonal of the Schur form
= "N": Eigenvalues are not ordered
= "S": Eigenvalues are ordered (see Selct)
[in]SelctSort = "S": Selct is used to select eigenvalues to sort to the top left of the Schur form.
  Eigenvalues Wr(j)+-Wi(j)*i are selected if Selct(Wr(j), Wi(j)) is true (= 1); i.e., if either one of a complex conjugate pair of eigenvalues is selected, then both complex eigenvalues are selected.
  Note that a selected complex eigenvalue may no longer satisfy Selct(Wr(j), Wi(j)) = true after ordering, since ordering may change the value of complex eigenvalues (especially if the eigenvalue is ill-conditioned); in this case Info is set to N+2 (see Info below).
Sort = "N": Selct is not referenced.
[in]SenseDetermines which reciprocal condition numbers are computed.
= 'N': None are computed.
= 'E': Computed for average of selected eigenvalues only.
= 'V': Computed for selected right invariant subspace only.
= 'B': Computed for both.
If Sense = "E", "V" or "B", Sort must equal "S"
[in]NOrder 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 by its real Schur form T.
[out]SdimSort = "N": Sdim = 0.
Sort = "S": Sdim = number of eigenvalues (after sorting) for which Selct is true. (Complex conjugate pairs for which Selct is true for either eigenvalue count as 2.)
[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 in the same order that they appear on the diagonal of the output Schur form T. Complex conjugate pairs of eigenvalues will appear consecutively with the eigenvalue having the positive imaginary part first.
[out]Vs()Array Vs(LVs1 - 1, LVs2 - 1) (LVs1 >= N, LVs2 >= N)
Jobvs = "V": Vs() contains the orthogonal matrix Z of Schur vectors.
Jobvs = "N": Vs() is not referenced.
[out]RCondeSense = 'E' or 'B': RConde contains the reciprocal condition number for the average of the selected eigenvalues.
Sense = 'N' or 'V': Not referenced.
[out]RCondvSense = 'V' or 'B': RCondv contains the reciprocal condition number for the selected right invariant subspace.
Sense = 'N' or 'E': Not referenced.
[out]Info= 0: Successful exit.
= -1: The argument Jobvs had an illegal value. (Jobvs <> "V" nor "N")
= -2: The argument Sort had an illegal value. (Sort <> "S" nor "N")
= -4: The argument Sense had an illegal value. (Sense <> "E", "V", "B" nor "N")
= -5: The argument N had an illegal value. (N < 0)
= -6: The argument A() is invalid.
= -8: The argument Wr() is invalid.
= -9: The argument Wi() is invalid.
= -10: The argument Vs() is invalid.
= i (0 < i <= N): The QR algorithm failed to compute all the eigenvalues. Elements 0 to Ilo-2 and i to N-1 of Wr() and Wi() contain those eigenvalues which have converged. If Jobvs = "V", Vs() contains the matrix which reduces A to its partially converged Schur form.
= N+1: The eigenvalues could not be reordered because some eigenvalues were too close to separate (the problem is very ill-conditioned).
= N+2: After reordering, roundoff changed values of some complex eigenvalues so that leading eigenvalues in the Schur form no longer satisfy Selct = true. This could also be caused by underflow due to scaling.
Reference
LAPACK
Example Program
Compute all eigenvalues, Schur form T, and, Schur vectors 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_Dgeesx()
Const N = 3
Dim A(N - 1, N - 1) As Double, Wr(N - 1) As Double, Wi(N - 1) As Double
Dim Sdim As Long, Vs(N - 1, N - 1) As Double
Dim RConde As Double, RCondv As Double, Info As Long
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 Dgeesx("V", "S", AddressOf Selct, "B", N, A(), Sdim, Wr(), Wi(), Vs(), 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 "Schur form T ="
Debug.Print A(0, 0), A(0, 1), A(0, 2)
Debug.Print A(1, 0), A(1, 1), A(1, 2)
Debug.Print A(2, 0), A(2, 1), A(2, 2)
Debug.Print "Schur vectors ="
Debug.Print Vs(0, 0), Vs(0, 1), Vs(0, 2)
Debug.Print Vs(1, 0), Vs(1, 1), Vs(1, 2)
Debug.Print Vs(2, 0), Vs(2, 1), Vs(2, 2)
Debug.Print "Rconde =", RConde, "Rcondv =", RCondv
Debug.Print "Sdim =", Sdim, "Info =", Info
End Sub
Function Selct(Wr As Double, Wi As Double) As Long
Selct = 0
If Wi <> 0 Then Selct = 1
End Function
Example Results
Eigenvalues (r) = 0.812065011925672 0.812065011925672 -0.904130023851345
Eigenvalues (i) = 0.48915757543818 -0.48915757543818 0
Schur form T =
0.812065011925672 0.540472392276116 0.684902131153596
-0.442714812131086 0.812065011925672 -0.537914483752962
0 0 -0.904130023851345
Schur vectors =
-0.492366426634308 -0.620320586279211 0.610555216308549
0.867251026977165 -0.290139488675864 0.404592057902722
-7.38306042939846E-02 0.728712184164039 0.680828608770563
Rconde = 0.894479266547508 Rcondv = 1.47509658058209
Sdim = 2 Info = 0