|
|
◆ Dggesx()
| Sub Dggesx |
( |
Jobvsl As |
String, |
|
|
Jobvsr As |
String, |
|
|
Sort As |
String, |
|
|
Selctg As |
LongPtr, |
|
|
Sense As |
String, |
|
|
N As |
Long, |
|
|
A() As |
Double, |
|
|
B() As |
Double, |
|
|
Sdim As |
Long, |
|
|
Alphar() As |
Double, |
|
|
Alphai() As |
Double, |
|
|
Beta() As |
Double, |
|
|
Vsl() As |
Double, |
|
|
Vsr() As |
Double, |
|
|
RConde() As |
Double, |
|
|
RCondv() As |
Double, |
|
|
Info As |
Long |
|
) |
| |
(Expert driver) Generalized Schur factorization of general matrices
- Purpose
- This routine computes for a pair of n x n real nonsymmetric matrices (A, B), the generalized eigenvalues, the generalized real Schur form (S, T), and optionally the left and/or right matrices of Schur vectors (VSL and VSR). This gives the generalized Schur factorization
(A, B) = ((VSL)*S*(VSR)^T, (VSL)*T*(VSR)^T)
Optionally, it also orders the eigenvalues so that a selected cluster of eigenvalues appear in the leading diagonal blocks of the upper quasi-triangular matrix S and the upper triangular matrix T; computes a reciprocal condition number for the average of the selected eigenvalues (RConde); and computes a reciprocal condition number for the right and left deflating subspaces corresponding to the selected eigenvalues (RCondv). The leading columns of VSL and VSR then form an orthonormal basis for the corresponding left and right eigenspaces (deflating subspaces).
A generalized eigenvalue for a pair of matrices (A, B) is a scalar w or a ratio α/β = w, such that A - w*B is singular. It is usually represented as the pair (α, β), as there is a reasonable interpretation for β=0 or both being zero.
A pair of matrices (S, T) is in generalized real Schur form if T is upper triangular with non-negative diagonal and S is block upper triangular with 1 x 1 and 2 x 2 blocks. 1 x 1 blocks correspond to real generalized eigenvalues, while 2 x 2 blocks of S will be "standardized" by making the corresponding elements of T have the form and the pair of corresponding 2 x 2 blocks in S and T will have a complex conjugate pair of generalized eigenvalues.
- Parameters
-
| [in] | Jobvsl | = "N": Do not compute the left Schur vectors.
= "V": Compute the left Schur vectors. |
| [in] | Jobvsr | = "N": Do not compute the right Schur vectors.
= "V": Compute the right Schur vectors. |
| [in] | Sort | Specifies whether or not to order the eigenvalues on the diagonal of the generalized Schur form.
= "N": Eigenvalues are not ordered.
= "S": Eigenvalues are ordered (see selctg). |
| [in] | Selctg | Sort = "S": Selctg is used to select eigenvalues to sort to the top left of the Schur form.
An eigenvalue (Alphar(j)+-Alphai(j)*i)/Beta(j) is selected if Selctg(Alphar(j), Alphai(j), Beta(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 Selctg(Alphar(j), Alphai(j), Beta(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.
Sort = "N": Selctg is not referenced. |
| [in] | Sense | Determines which reciprocal condition numbers are computed.
= "N": None are computed.
= "E": Computed for average of selected eigenvalues only.
= "V": Computed for selected deflating subspaces only.
= "B": Computed for both.
If Sense = "E", "V", or "B", Sort must equal "S". |
| [in] | N | Order of the matrices A, B, VSL and VSR. (N >= 0) (If N = 0, returns without computation) |
| [in,out] | A() | Array A(LA1 - 1, LA2 - 1) (LA1 >= N, LA2 >= N)
[in] The first of the pair of matrices.
[out] A() has been overwritten by its generalized Schur form S. |
| [in,out] | B() | Array B(LB1 - 1, LB2 - 1) (LB1 >= N, LB2 >= N)
[in] The second of the pair of matrices.
[out] B() has been overwritten by its generalized Schur form T. |
| [in] | Sdim | Sort = "N": Sdim = 0.
Sort = "S": Sdim = number of eigenvalues (after sorting) for which Selctg is true. (Complex conjugate pairs for which Selctg is true for either eigenvalue count as 2) |
| [out] | Alphar() | Array Alphar(LAlphar - 1) (LAlphar >= N) |
| [out] | Alphai() | Array Alphai(LAlphai - 1) (LAlphai >= N) |
| [out] | Beta() | Array Beta(LBeta - 1) (LBeta >= N)
(Alphar(j) + Alphai(j)*i)/Beta(j), j = 0, ..., N-1, will be the generalized eigenvalues. Alphar(j) + Alphai(j)*i and Beta(j), j = 0, ..., N-1 are the diagonals of the complex Schur form (S, T) that would result if the 2 x 2 diagonal blocks of the real Schur form of (A, B) were further reduced to triangular form using 2 x 2 complex unitary transformations.
If Alphai(j) is zero, then the j-th eigenvalue is real. If positive, then the j-th and (j+1)-st eigenvalues are a complex conjugate pair, with Alphai(j+1) negative.
Note: The quotients Alphar(j)/Beta(j) and Alphai(j)/Beta(j) may easily over- or underflow, and Beta(j) may even be zero. Thus, the user should avoid naively computing the ratio α/β. However, Alphar and Alphai will be always less than and usually comparable with norm(A) in magnitude, and Beta always less than and usually comparable with norm(B). |
| [out] | Vsl() | Array Vsl(LVsl1 - 1, LVsl2 - 1) (LVsl1 >= N, LVsl2 >= N)
Jobvsl = "V": Vsl() will contain the left Schur vectors.
Jobvsl = "N": Not referenced. |
| [out] | Vsr() | Array Vsr(LVsr1 - 1, LVsr2 - 1) (LVsr1 >= N, LVsr2 >= N)
Jobvsr = "V": Vsr() will contain the right Schur vectors.
Jobvsr = "N": Not referenced. |
| [out] | RConde() | Array RConde(LRConde - 1) (LRConde >= 2)
Sense = "E" or "B": RConde(0) and RConde(1) contain the reciprocal condition numbers for the average of the selected eigenvalues.
Sense = "N" or "V": Not referenced. |
| [out] | RCondv() | Array RCondv(LRCondv - 1) (LRCondv >= 2)
Sense = "V" or "B": RCondv(0) and RCondv(1) contain the reciprocal condition numbers for the selected deflating subspaces.
Sense = "N" or "E": Not referenced. |
| [out] | Info | = 0: Successful exit.
= -1: The argument Jobvsl had an illegal value. (Jobvsl <> "V" nor "N")
= -2: The argument Jobvsr had an illegal value. (Jobvsr <> "V" nor "N")
= -3: The argument Sort had an illegal value. (Sort <> "S" nor "N")
= -5: The argument Sense had an illegal value. (Sense <> "E", "V", "B" nor "N")
= -6: The argument N had an illegal value. (N < 0)
= -7: The argument A() is invalid.
= -8: The argument B() is invalid.
= -10: The argument Alphar() is invalid.
= -11: The argument Alphai() is invalid.
= -12: The argument Beta() is invalid.
= -13: The argument Vsl() is invalid.
= -14: The argument Vsr() is invalid.
= -15: The argument RConde() is invalid.
= -16: The argument RCondv() is invalid.
= i (0 < i <= N): The QZ iteration failed. (A, B) are not in Schur form, but Alphar(j), Alphai(j), and Beta(j) should be correct for j = i, ..., N-1.
= N+1: Other than QZ iteration failed in Dhgeqz.
= N+2: After reordering, roundoff changed values of some complex eigenvalues so that leading eigenvalues in the generalized Schur form no longer satisfy Selctg = true. This could also be caused due to scaling.
= N+3: Reordering failed in Dtgsen. |
- Reference
- LAPACK
- Example Program
- Compute for a pair of matrices (A, B), the generalized eigenvalues, the generalized Schur form (S, T), and the left and right matrices of Schur vectors, where
( 0.20 -0.11 -0.93 ) ( -0.58 -0.79 0.82 )
A = ( -0.32 0.81 0.37 ), B = ( 0.77 0.71 -0.55 )
( -0.80 -0.92 -0.29 ) ( -1.36 -1.22 1.66 )
Sub Ex_Dggesx()
Const N = 3
Dim A(N - 1, N - 1) As Double, B(N - 1, N - 1) As Double
Dim Alphar(N - 1) As Double, Alphai(N - 1) As Double, Beta(N - 1) As Double
Dim Sdim As Long, Vsl(N - 1, N - 1) As Double, Vsr(N - 1, N - 1) As Double
Dim RConde(1) As Double, RCondv(1) 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
B(0, 0) = -0.58: B(0, 1) = -0.79: B(0, 2) = 0.82
B(1, 0) = 0.77: B(1, 1) = 0.71: B(1, 2) = -0.55
B(2, 0) = -1.36: B(2, 1) = -1.22: B(2, 2) = 1.66
Call Dggesx("V", "V", "S", AddressOf Selctg, "B", N, A(), B(), Sdim, Alphar(), Alphai(), Beta(), Vsl(), Vsr(), RConde(), RCondv(), Info)
Debug.Print "Eigenvalues ="
Debug.Print " (r)", Alphar(0) / Beta(0), Alphar(1) / Beta(1), Alphar(2) / Beta(2)
Debug.Print " (i)", Alphai(0) / Beta(0), Alphai(1) / Beta(1), Alphai(2) / Beta(2)
Debug.Print "Schur form S ="
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 form T ="
Debug.Print B(0, 0), B(0, 1), B(0, 2)
Debug.Print B(1, 0), B(1, 1), B(1, 2)
Debug.Print B(2, 0), B(2, 1), B(2, 2)
Debug.Print "Left Schur vectors ="
Debug.Print Vsl(0, 0), Vsl(0, 1), Vsl(0, 2)
Debug.Print Vsl(1, 0), Vsl(1, 1), Vsl(1, 2)
Debug.Print Vsl(2, 0), Vsl(2, 1), Vsl(2, 2)
Debug.Print "Right Schur vectors ="
Debug.Print Vsr(0, 0), Vsr(0, 1), Vsr(0, 2)
Debug.Print Vsr(1, 0), Vsr(1, 1), Vsr(1, 2)
Debug.Print Vsr(2, 0), Vsr(2, 1), Vsr(2, 2)
Debug.Print "Rconde =", RConde(0), RConde(1)
Debug.Print "Rcondv =", RCondv(0), RCondv(1)
Debug.Print "Sdim =", Sdim, "Info =", Info
End Sub
Function Selctg(Alphar As Double, Alphai As Double, Beta As Double) As Long
Selctg = 0
If Alphai <> 0 Then Selctg = 1
End Function
Function Beta(A As Double, B As Double, Optional Info As Long) As Double Beta function B(a, b)
Sub Dggesx(Jobvsl As String, Jobvsr As String, Sort As String, Selctg As LongPtr, Sense As String, N As Long, A() As Double, B() As Double, Sdim As Long, Alphar() As Double, Alphai() As Double, Beta() As Double, Vsl() As Double, Vsr() As Double, RConde() As Double, RCondv() As Double, Info As Long) (Expert driver) Generalized Schur factorization of general matrices
- Example Results
Eigenvalues =
(r) 1.10765548065266 1.10765548065266 -1.74329621491312
(i) 1.40252005479606 -1.40252005479606 0
Schur form S =
0.61463908695189 -1.30352251020676 6.87282197451471E-02
0.715639689206334 0.422919612615492 0.382300104551802
0 0 -0.681226655778666
Schur form T =
1.62147306790067 -0 2.50284121079862
0 0.230317162252267 0.163903374557831
0 0 0.390769308136549
Left Schur vectors =
-0.352844167536935 0.427271157509602 -0.832430388318189
0.480836332469667 -0.680393780608842 -0.553046765369735
-0.802681390597968 -0.595402100491098 3.46254807692483E-02
Right Schur vectors =
0.988795256019328 0.1471244329068 2.52654490465408E-02
0.106663051199989 -0.814736341679618 0.569936564062371
0.104436273307598 -0.560855680891587 -0.821300170479256
Rconde = 0.633219382771826 0.547225257604206
Rcondv = 0.306813246166952 0.400117332298039
Sdim = 2 Info = 0
|