Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
Eigen::RealQZ< _MatrixType > Class Template Reference

Performs a real QZ decomposition of a pair of square matrices. More...

#include <RealQZ.h>

Public Types

enum  {
  RowsAtCompileTime = MatrixType::RowsAtCompileTime, ColsAtCompileTime = MatrixType::ColsAtCompileTime, Options = MatrixType::Options, MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime,
  MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime
}
 
typedef Matrix< Scalar, ColsAtCompileTime, 1, Options &~RowMajor, MaxColsAtCompileTime, 1 > ColumnVectorType
 
typedef std::complex< typename NumTraits< Scalar >::RealComplexScalar
 
typedef Matrix< ComplexScalar, ColsAtCompileTime, 1, Options &~RowMajor, MaxColsAtCompileTime, 1 > EigenvalueType
 
typedef Eigen::Index Index
 
typedef _MatrixType MatrixType
 
typedef MatrixType::Scalar Scalar
 

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. More...
 
const MatrixTypematrixQ () const
 Returns matrix Q in the QZ decomposition. More...
 
const MatrixTypematrixS () const
 Returns matrix S in the QZ decomposition. More...
 
const MatrixTypematrixT () const
 Returns matrix S in the QZ decomposition. More...
 
const MatrixTypematrixZ () const
 Returns matrix Z in the QZ decomposition. More...
 
 RealQZ (Index size=RowsAtCompileTime==Dynamic ? 1 :RowsAtCompileTime)
 Default constructor. More...
 
 RealQZ (const MatrixType &A, const MatrixType &B, bool computeQZ=true)
 Constructor; computes real QZ decomposition of given matrices. More...
 
RealQZsetMaxIterations (Index maxIters)
 

Private Types

typedef JacobiRotation< ScalarJRs
 
typedef Matrix< Scalar, 2, 2 > Matrix2s
 
typedef Matrix< Scalar, 2, 1 > Vector2s
 
typedef Matrix< Scalar, 3, 1 > Vector3s
 

Private Member Functions

void computeNorms ()
 
Index findSmallDiagEntry (Index f, Index l)
 
Index findSmallSubdiagEntry (Index iu)
 
void hessenbergTriangular ()
 
void pushDownZero (Index z, Index f, Index l)
 
void splitOffTwoRows (Index i)
 
void step (Index f, Index l, Index iter)
 

Private Attributes

bool m_computeQZ
 
Index m_global_iter
 
ComputationInfo m_info
 
bool m_isInitialized
 
Index m_maxIters
 
Scalar m_normOfS
 
Scalar m_normOfT
 
MatrixType m_Q
 
MatrixType m_S
 
MatrixType m_T
 
Matrix< Scalar, Dynamic, 1 > m_workspace
 
MatrixType m_Z
 

Detailed Description

template<typename _MatrixType>
class Eigen::RealQZ< _MatrixType >

Performs a real QZ decomposition of a pair of square matrices.

Template Parameters
_MatrixTypethe 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";

Output:

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

Definition at line 57 of file RealQZ.h.

Member Typedef Documentation

◆ ColumnVectorType

template<typename _MatrixType>
typedef Matrix<Scalar, ColsAtCompileTime, 1, Options & ~RowMajor, MaxColsAtCompileTime, 1> Eigen::RealQZ< _MatrixType >::ColumnVectorType

Definition at line 73 of file RealQZ.h.

◆ ComplexScalar

template<typename _MatrixType>
typedef std::complex<typename NumTraits<Scalar>::Real> Eigen::RealQZ< _MatrixType >::ComplexScalar

Definition at line 69 of file RealQZ.h.

◆ EigenvalueType

template<typename _MatrixType>
typedef Matrix<ComplexScalar, ColsAtCompileTime, 1, Options & ~RowMajor, MaxColsAtCompileTime, 1> Eigen::RealQZ< _MatrixType >::EigenvalueType

Definition at line 72 of file RealQZ.h.

◆ Index

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

Definition at line 70 of file RealQZ.h.

◆ JRs

template<typename _MatrixType>
typedef JacobiRotation<Scalar> Eigen::RealQZ< _MatrixType >::JRs
private

Definition at line 206 of file RealQZ.h.

◆ Matrix2s

template<typename _MatrixType>
typedef Matrix<Scalar,2,2> Eigen::RealQZ< _MatrixType >::Matrix2s
private

Definition at line 205 of file RealQZ.h.

◆ MatrixType

template<typename _MatrixType>
typedef _MatrixType Eigen::RealQZ< _MatrixType >::MatrixType

Definition at line 60 of file RealQZ.h.

◆ Scalar

template<typename _MatrixType>
typedef MatrixType::Scalar Eigen::RealQZ< _MatrixType >::Scalar

Definition at line 68 of file RealQZ.h.

◆ Vector2s

template<typename _MatrixType>
typedef Matrix<Scalar,2,1> Eigen::RealQZ< _MatrixType >::Vector2s
private

Definition at line 204 of file RealQZ.h.

◆ Vector3s

template<typename _MatrixType>
typedef Matrix<Scalar,3,1> Eigen::RealQZ< _MatrixType >::Vector3s
private

Definition at line 203 of file RealQZ.h.

Member Enumeration Documentation

◆ anonymous enum

template<typename _MatrixType>
anonymous enum
Enumerator
RowsAtCompileTime 
ColsAtCompileTime 
Options 
MaxRowsAtCompileTime 
MaxColsAtCompileTime 

Definition at line 61 of file RealQZ.h.

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.

Definition at line 86 of file RealQZ.h.

◆ 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.

Definition at line 105 of file RealQZ.h.

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

Definition at line 559 of file RealQZ.h.

◆ computeNorms()

template<typename MatrixType >
void Eigen::RealQZ< MatrixType >::computeNorms ( )
inlineprivate

Definition at line 267 of file RealQZ.h.

◆ findSmallDiagEntry()

template<typename MatrixType >
Index Eigen::RealQZ< MatrixType >::findSmallDiagEntry ( Index  f,
Index  l 
)
inlineprivate

Definition at line 300 of file RealQZ.h.

◆ findSmallSubdiagEntry()

template<typename MatrixType >
Index Eigen::RealQZ< MatrixType >::findSmallSubdiagEntry ( Index  iu)
inlineprivate

Definition at line 282 of file RealQZ.h.

◆ hessenbergTriangular()

template<typename MatrixType >
void Eigen::RealQZ< MatrixType >::hessenbergTriangular ( )
private

Definition at line 220 of file RealQZ.h.

◆ 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.

Definition at line 169 of file RealQZ.h.

◆ iterations()

template<typename _MatrixType>
Index Eigen::RealQZ< _MatrixType >::iterations ( ) const
inline

Returns number of performed QR-like iterations.

Definition at line 177 of file RealQZ.h.

◆ 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.

Definition at line 122 of file RealQZ.h.

◆ 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.

Definition at line 142 of file RealQZ.h.

◆ 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.

Definition at line 151 of file RealQZ.h.

◆ 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.

Definition at line 132 of file RealQZ.h.

◆ pushDownZero()

template<typename MatrixType >
void Eigen::RealQZ< MatrixType >::pushDownZero ( Index  z,
Index  f,
Index  l 
)
inlineprivate

Definition at line 364 of file RealQZ.h.

◆ 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.

Definition at line 186 of file RealQZ.h.

◆ splitOffTwoRows()

template<typename MatrixType >
void Eigen::RealQZ< MatrixType >::splitOffTwoRows ( Index  i)
inlineprivate

Definition at line 314 of file RealQZ.h.

◆ step()

template<typename MatrixType >
void Eigen::RealQZ< MatrixType >::step ( Index  f,
Index  l,
Index  iter 
)
inlineprivate

Definition at line 403 of file RealQZ.h.

Member Data Documentation

◆ m_computeQZ

template<typename _MatrixType>
bool Eigen::RealQZ< _MatrixType >::m_computeQZ
private

Definition at line 199 of file RealQZ.h.

◆ m_global_iter

template<typename _MatrixType>
Index Eigen::RealQZ< _MatrixType >::m_global_iter
private

Definition at line 201 of file RealQZ.h.

◆ m_info

template<typename _MatrixType>
ComputationInfo Eigen::RealQZ< _MatrixType >::m_info
private

Definition at line 196 of file RealQZ.h.

◆ m_isInitialized

template<typename _MatrixType>
bool Eigen::RealQZ< _MatrixType >::m_isInitialized
private

Definition at line 198 of file RealQZ.h.

◆ m_maxIters

template<typename _MatrixType>
Index Eigen::RealQZ< _MatrixType >::m_maxIters
private

Definition at line 197 of file RealQZ.h.

◆ m_normOfS

template<typename _MatrixType>
Scalar Eigen::RealQZ< _MatrixType >::m_normOfS
private

Definition at line 200 of file RealQZ.h.

◆ m_normOfT

template<typename _MatrixType>
Scalar Eigen::RealQZ< _MatrixType >::m_normOfT
private

Definition at line 200 of file RealQZ.h.

◆ m_Q

template<typename _MatrixType>
MatrixType Eigen::RealQZ< _MatrixType >::m_Q
private

Definition at line 194 of file RealQZ.h.

◆ m_S

template<typename _MatrixType>
MatrixType Eigen::RealQZ< _MatrixType >::m_S
private

Definition at line 194 of file RealQZ.h.

◆ m_T

template<typename _MatrixType>
MatrixType Eigen::RealQZ< _MatrixType >::m_T
private

Definition at line 194 of file RealQZ.h.

◆ m_workspace

template<typename _MatrixType>
Matrix<Scalar,Dynamic,1> Eigen::RealQZ< _MatrixType >::m_workspace
private

Definition at line 195 of file RealQZ.h.

◆ m_Z

template<typename _MatrixType>
MatrixType Eigen::RealQZ< _MatrixType >::m_Z
private

Definition at line 194 of file RealQZ.h.


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


gtsam
Author(s):
autogenerated on Tue Jul 4 2023 02:43:04