$treeview $search $mathjax
Eigen  3.2.5
$projectbrief
$projectbrief
$searchbox

RealQZ< _MatrixType > Class Template Reference
[Eigenvalues module]

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

List of all members.

Public Member Functions

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

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";

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.927 -0.928  0.643 -0.227
-0.594   0.36  0.146 -0.606
     0      0 -0.398 -0.164
     0      0      0  -1.12
T:
  1.51  0.278 -0.238  0.501
     0  -1.04  0.519 -0.239
     0      0  -1.25  0.438
     0      0      0  0.746
Q:
 0.603  0.011  0.552  0.576
-0.142  0.243  0.761 -0.585
 0.092 -0.958  0.152 -0.223
  0.78  0.149 -0.306 -0.526
Z:
  0.284    0.26  -0.696   0.606
 -0.918  -0.108   -0.38  0.0406
 -0.269   0.783   0.462    0.32
-0.0674  -0.555   0.398   0.727

Errors:
|A-QSZ|: 1.13e-06, |B-QTZ|: 1.81e-06
|QQ* - I|: 1.01e-06, |ZZ* - I|: 7.02e-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

Constructor & Destructor Documentation

RealQZ ( Index  size = RowsAtCompileTime==Dynamic ? 1 : RowsAtCompileTime  )  [inline]

Default constructor.

Parameters:
[in] size 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.

See also:
compute() for an example.
RealQZ ( const MatrixType &  A,
const MatrixType &  B,
bool  computeQZ = true 
) [inline]

Constructor; computes real QZ decomposition of given matrices.

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

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


Member Function Documentation

RealQZ< MatrixType > & compute ( const MatrixType &  A,
const MatrixType &  B,
bool  computeQZ = true 
) [inline]

Computes QZ decomposition of given matrix.

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

References Eigen::NoConvergence, PlainObjectBase< Derived >::resize(), and Eigen::Success.

Referenced by GeneralizedEigenSolver< _MatrixType >::compute(), and RealQZ< MatrixType >::RealQZ().

ComputationInfo info (  )  const [inline]

Reports whether previous computation was successful.

Returns:
Success if computation was succesful, NoConvergence otherwise.

Referenced by GeneralizedEigenSolver< _MatrixType >::compute().

const MatrixType& matrixQ (  )  const [inline]

Returns matrix Q in the QZ decomposition.

Returns:
A const reference to the matrix Q.
const MatrixType& matrixS (  )  const [inline]

Returns matrix S in the QZ decomposition.

Returns:
A const reference to the matrix S.

Referenced by GeneralizedEigenSolver< _MatrixType >::compute().

const MatrixType& matrixT (  )  const [inline]

Returns matrix S in the QZ decomposition.

Returns:
A const reference to the matrix S.

Referenced by GeneralizedEigenSolver< _MatrixType >::compute().

const MatrixType& matrixZ (  )  const [inline]

Returns matrix Z in the QZ decomposition.

Returns:
A const reference to the matrix Z.

Referenced by GeneralizedEigenSolver< _MatrixType >::compute().

RealQZ& setMaxIterations ( Index  maxIters  )  [inline]

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

Referenced by GeneralizedEigenSolver< _MatrixType >::setMaxIterations().


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