template<typename _MatrixType>
Eigen::RealQZ class

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

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.

This is defined in the Eigenvalues module. #include <Eigen/Eigenvalues>

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:

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|: 1.36e-06, |B-QTZ|: 1.83e-06
|QQ* - I|: 8.18e-07, |ZZ* - I|: 7.36e-07

Public types

using Index = Eigen::Index deprecated

Constructors, destructors, conversion operators

RealQZ(Index size = RowsAtCompileTime==Dynamic ? 1 :RowsAtCompileTime) explicit
Default constructor.
RealQZ(const MatrixType& A, const MatrixType& B, bool computeQZ = true)
Constructor; computes real QZ decomposition of given matrices.

Public functions

auto compute(const MatrixType& A, const MatrixType& B, bool computeQZ = true) -> RealQZ&
Computes QZ decomposition of given matrix.
auto info() const -> ComputationInfo
Reports whether previous computation was successful.
auto iterations() const -> Index
Returns number of performed QR-like iterations.
auto matrixQ() const -> const MatrixType&
Returns matrix Q in the QZ decomposition.
auto matrixS() const -> const MatrixType&
Returns matrix S in the QZ decomposition.
auto matrixT() const -> const MatrixType&
Returns matrix S in the QZ decomposition.
auto matrixZ() const -> const MatrixType&
Returns matrix Z in the QZ decomposition.
auto setMaxIterations(Index maxIters) -> RealQZ&

Typedef documentation

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

Function documentation

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

Default constructor.

Parameters
size in Positive 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.

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

Constructor; computes real QZ decomposition of given matrices.

Parameters
in Matrix A.
in Matrix B.
computeQZ in If false, A and Z are not computed.

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

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

Computes QZ decomposition of given matrix.

Parameters
in Matrix A.
in Matrix B.
computeQZ in If false, A and Z are not computed.
Returns Reference to *this

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

Reports whether previous computation was successful.

Returns Success if computation was successful, NoConvergence otherwise.

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

Returns matrix Q in the QZ decomposition.

Returns A const reference to the matrix Q.

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

Returns matrix S in the QZ decomposition.

Returns A const reference to the matrix S.

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

Returns matrix S in the QZ decomposition.

Returns A const reference to the matrix S.

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

Returns matrix Z in the QZ decomposition.

Returns A const reference to the matrix Z.

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

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