template<typename MatrixType_>
class Eigen::RealQZ< MatrixType_ >
Performs a real QZ decomposition of a pair of square matrices.
This is defined in the Eigenvalues module.
#include <Eigen/Eigenvalues>
- Template Parameters
-
| MatrixType_ | the type of the matrix of which we are computing the real QZ decomposition; this is expected to be an instantiation of the Matrix class template. |
Given real square matrices A and B, this class computes the real QZ decomposition: \( A = Q S Z \), \( B = Q T Z \) where Q and Z are real orthogonal matrices, T is upper-triangular matrix, and S is upper quasi-triangular matrix. An orthogonal matrix is a matrix whose inverse is equal to its transpose, \( U^{-1} = U^T \). A quasi-triangular matrix is a block-triangular matrix whose diagonal consists of 1-by-1 blocks and 2-by-2 blocks where further reduction is impossible due to complex eigenvalues.
The eigenvalues of the pencil \( A - z B \) can be obtained from 1x1 and 2x2 blocks on the diagonals of S and T.
Call the function compute() to compute the real QZ decomposition of a given pair of matrices. Alternatively, you can use the RealQZ(const MatrixType& A, const MatrixType& B, bool computeQZ) constructor which computes the real QZ decomposition at construction time. Once the decomposition is computed, you can use the matrixS(), matrixT(), matrixQ() and matrixZ() functions to retrieve the matrices S, T, Q and Z in the decomposition. If computeQZ==false, some time is saved by not computing matrices Q and Z.
Example:
qz.compute(A, B);
cout << "A:\n"
<< A << "\n"
<< "B:\n"
<< B << "\n";
cout << "S:\n"
<< qz.matrixS() << "\n"
<< "T:\n"
<< qz.matrixT() << "\n";
cout << "Q:\n"
<< qz.matrixQ() << "\n"
<< "Z:\n"
<< qz.matrixZ() << "\n";
cout << "\nErrors:"
<< "\n|A-QSZ|: " << (A - qz.matrixQ() * qz.matrixS() * qz.matrixZ()).norm()
<< ", |B-QTZ|: " << (B - qz.matrixQ() * qz.matrixT() * qz.matrixZ()).norm()
<< "\n|QQ* - I|: " << (qz.matrixQ() * qz.matrixQ().adjoint() - MatrixXf::Identity(4, 4)).norm()
<< ", |ZZ* - I|: " << (qz.matrixZ() * qz.matrixZ().adjoint() - MatrixXf::Identity(4, 4)).norm() << "\n";
RealQZ(Index size=RowsAtCompileTime==Dynamic ? 1 :RowsAtCompileTime)
Default constructor.
Definition RealQZ.h:95
Matrix< float, Dynamic, Dynamic > MatrixXf
Dynamic×Dynamic matrix of type float.
Definition Matrix.h:488
Output:
A:
0.68 0.823 -0.444 -0.27
-0.211 -0.605 0.108 0.0268
0.566 -0.33 -0.0452 0.904
0.597 0.536 0.258 0.832
B:
0.271 -0.967 -0.687 0.998
0.435 -0.514 -0.198 -0.563
-0.717 -0.726 -0.74 0.0259
0.214 0.608 -0.782 0.678
S:
-0.668 1.26 -0.598 0.0941
0.317 -0.27 -0.279 0.64
0 0 -0.398 -0.164
0 0 0 -1.12
T:
-1.55 0 0.342 -0.54
0 1.01 -0.457 0.128
0 0 -1.25 0.438
0 0 0 0.746
Q:
-0.587 -0.138 0.552 0.576
0.19 -0.208 0.761 -0.585
-0.292 0.918 0.152 -0.223
-0.731 -0.31 -0.306 -0.526
Z:
-0.0204 0.213 -0.78 0.588
-0.961 -0.184 -0.14 -0.153
-0.269 0.783 0.462 0.32
-0.0674 -0.555 0.398 0.727
Errors:
|A-QSZ|: 8.44e-07, |B-QTZ|: 1.05e-06
|QQ* - I|: 5.32e-07, |ZZ* - I|: 4.99e-07
- Note
- The implementation is based on the algorithm in "Matrix Computations" by Gene H. Golub and Charles F. Van Loan, and a paper "An algorithm for
generalized eigenvalue problems" by C.B.Moler and G.W.Stewart.
- See also
- class RealSchur, class ComplexSchur, class EigenSolver, class ComplexEigenSolver
|
| template<typename InputTypeA, typename InputTypeB> |
| RealQZ & | compute (const EigenBase< InputTypeA > &A, const EigenBase< InputTypeB > &B, bool computeQZ=true) |
| | Computes QZ decomposition of given matrix.
|
| |
| ComputationInfo | info () const |
| | Reports whether previous computation was successful.
|
| |
|
Index | iterations () const |
| | Returns number of performed QR-like iterations.
|
| |
| const PlainMatrixType & | matrixQ () const |
| | Returns matrix Q in the QZ decomposition.
|
| |
| const MatrixType & | matrixS () const |
| | Returns matrix S in the QZ decomposition.
|
| |
| const MatrixType & | matrixT () const |
| | Returns matrix S in the QZ decomposition.
|
| |
| const PlainMatrixType & | matrixZ () const |
| | Returns matrix Z in the QZ decomposition.
|
| |
| template<typename InputTypeA, typename InputTypeB> |
| | RealQZ (const EigenBase< InputTypeA > &A, const EigenBase< InputTypeB > &B, bool computeQZ=true) |
| | Constructor; computes real QZ decomposition of given matrices.
|
| |
| template<typename InputTypeA, typename InputTypeB> |
| | RealQZ (EigenBase< InputTypeA > &A, EigenBase< InputTypeB > &B, bool computeQZ=true) |
| | Constructor for inplace decomposition .
|
| |
| | RealQZ (Index size=RowsAtCompileTime==Dynamic ? 1 :RowsAtCompileTime) |
| | Default constructor.
|
| |
| RealQZ & | setMaxIterations (Index maxIters) |
| |