Eigen  3.4.90 (git rev a4098ac676528a83cfb73d4d26ce1b42ec05f47c)
Eigen::RealQZ< MatrixType_ > Class Template Reference

Detailed Description

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 a 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 matrixes, 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& B, 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:

MatrixXf A = MatrixXf::Random(4,4);
MatrixXf B = MatrixXf::Random(4,4);
RealQZ<MatrixXf> qz(4); // preallocate space for 4x4 matrices
qz.compute(A,B); // A = Q S Z, B = Q T Z
// print original matrices and result of decomposition
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";
// verify precision
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";
static const RandomReturnType Random()
Definition: Random.h:115
static const IdentityReturnType Identity()
Definition: CwiseNullaryOp.h:801

Output:

A:
-1 0.0655 0.359 0.662
-0.737 -0.562 0.869 -0.931
0.511 -0.906 -0.233 -0.893
-0.0827 0.358 0.0388 0.0594
B:
0.342 -0.165 0.692 -0.168
-0.985 0.374 0.0539 0.402
-0.233 0.178 -0.816 0.821
-0.866 0.861 0.308 0.524
S:
0.819 0.956 0.457 -0.529
0 0.509 1.01 0.228
0 0 -0.613 -1.38
0 -0 -0.444 -0.485
T:
0.289 0.00263 0.342 -0.186
0 0.857 -0.742 -1.21
0 0 1.22 0
0 0 0 -0.856
Q:
0.783 -0.403 0.104 0.462
0.567 0.773 -0.0202 -0.283
0.0429 -0.00387 -0.988 0.146
-0.251 0.49 0.109 0.828
Z:
-0.229 -0.75 0.38 0.491
-0.888 -0.09 -0.178 -0.414
0.157 -0.0874 0.747 -0.64
0.366 -0.65 -0.515 -0.423
Errors:
|A-QSZ|: 2.77e-06, |B-QTZ|: 2.82e-06
|QQ* - I|: 6.78e-07, |ZZ* - I|: 1.55e-06
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

Public Types

typedef Eigen::Index Index
 

Public Member Functions

RealQZcompute (const MatrixType &A, const MatrixType &B, bool computeQZ=true)
 Computes QZ decomposition of given matrix. More...
 
ComputationInfo info () const
 Reports whether previous computation was successful. More...
 
Index iterations () const
 Returns number of performed QR-like iterations.
 
const MatrixType & matrixQ () const
 Returns matrix Q in the QZ decomposition. More...
 
const MatrixType & matrixS () const
 Returns matrix S in the QZ decomposition. More...
 
const MatrixType & matrixT () const
 Returns matrix S in the QZ decomposition. More...
 
const MatrixType & matrixZ () const
 Returns matrix Z in the QZ decomposition. More...
 
 RealQZ (const MatrixType &A, const MatrixType &B, bool computeQZ=true)
 Constructor; computes real QZ decomposition of given matrices. More...
 
 RealQZ (Index size=RowsAtCompileTime==Dynamic ? 1 :RowsAtCompileTime)
 Default constructor. More...
 
RealQZsetMaxIterations (Index maxIters)
 

Member Typedef Documentation

◆ Index

template<typename MatrixType_ >
typedef Eigen::Index Eigen::RealQZ< MatrixType_ >::Index
Deprecated:
since Eigen 3.3

Constructor & Destructor Documentation

◆ RealQZ() [1/2]

template<typename MatrixType_ >
Eigen::RealQZ< MatrixType_ >::RealQZ ( Index  size = RowsAtCompileTime==Dynamic ? 1 : RowsAtCompileTime)
inlineexplicit

Default constructor.

Parameters
[in]sizePositive integer, size of the matrix whose QZ decomposition will be computed.

The default constructor is useful in cases in which the user intends to perform decompositions via compute(). The size parameter is only used as a hint. It is not an error to give a wrong size, but it may impair performance.

See also
compute() for an example.

◆ RealQZ() [2/2]

template<typename MatrixType_ >
Eigen::RealQZ< MatrixType_ >::RealQZ ( const MatrixType &  A,
const MatrixType &  B,
bool  computeQZ = true 
)
inline

Constructor; computes real QZ decomposition of given matrices.

Parameters
[in]AMatrix A.
[in]BMatrix B.
[in]computeQZIf false, A and Z are not computed.

This constructor calls compute() to compute the QZ decomposition.

Member Function Documentation

◆ compute()

template<typename MatrixType >
RealQZ< MatrixType > & Eigen::RealQZ< MatrixType >::compute ( const MatrixType &  A,
const MatrixType &  B,
bool  computeQZ = true 
)

Computes QZ decomposition of given matrix.

Parameters
[in]AMatrix A.
[in]BMatrix B.
[in]computeQZIf false, A and Z are not computed.
Returns
Reference to *this

◆ info()

template<typename MatrixType_ >
ComputationInfo Eigen::RealQZ< MatrixType_ >::info ( ) const
inline

Reports whether previous computation was successful.

Returns
Success if computation was successful, NoConvergence otherwise.

◆ matrixQ()

template<typename MatrixType_ >
const MatrixType & Eigen::RealQZ< MatrixType_ >::matrixQ ( ) const
inline

Returns matrix Q in the QZ decomposition.

Returns
A const reference to the matrix Q.

◆ matrixS()

template<typename MatrixType_ >
const MatrixType & Eigen::RealQZ< MatrixType_ >::matrixS ( ) const
inline

Returns matrix S in the QZ decomposition.

Returns
A const reference to the matrix S.

◆ matrixT()

template<typename MatrixType_ >
const MatrixType & Eigen::RealQZ< MatrixType_ >::matrixT ( ) const
inline

Returns matrix S in the QZ decomposition.

Returns
A const reference to the matrix S.

◆ matrixZ()

template<typename MatrixType_ >
const MatrixType & Eigen::RealQZ< MatrixType_ >::matrixZ ( ) const
inline

Returns matrix Z in the QZ decomposition.

Returns
A const reference to the matrix Z.

◆ setMaxIterations()

template<typename MatrixType_ >
RealQZ & Eigen::RealQZ< MatrixType_ >::setMaxIterations ( Index  maxIters)
inline

Sets the maximal number of iterations allowed to converge to one eigenvalue or decouple the problem.


The documentation for this class was generated from the following file: