Shapeworks Studio  2.1
Shape analysis software suite
List of all members | Public Types | Public Member Functions | Static Public Attributes
Eigen::RealSchur< _MatrixType > Class Template Reference

Performs a real Schur decomposition of a square matrix. More...

#include <RealSchur.h>

Public Types

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

Public Member Functions

 RealSchur (Index size=RowsAtCompileTime==Dynamic?1:RowsAtCompileTime)
 Default constructor. More...
 
 RealSchur (const MatrixType &matrix, bool computeU=true)
 Constructor; computes real Schur decomposition of given matrix. More...
 
const MatrixType & matrixU () const
 Returns the orthogonal matrix in the Schur decomposition. More...
 
const MatrixType & matrixT () const
 Returns the quasi-triangular matrix in the Schur decomposition. More...
 
RealSchurcompute (const MatrixType &matrix, bool computeU=true)
 Computes Schur decomposition of given matrix. More...
 
template<typename HessMatrixType , typename OrthMatrixType >
RealSchurcomputeFromHessenberg (const HessMatrixType &matrixH, const OrthMatrixType &matrixQ, bool computeU)
 Computes Schur decomposition of a Hessenberg matrix H = Z T Z^T. More...
 
ComputationInfo info () const
 Reports whether previous computation was successful. More...
 
RealSchursetMaxIterations (Index maxIters)
 Sets the maximum number of iterations allowed. More...
 
Index getMaxIterations ()
 Returns the maximum number of iterations.
 
template<typename HessMatrixType , typename OrthMatrixType >
RealSchur< MatrixType > & computeFromHessenberg (const HessMatrixType &matrixH, const OrthMatrixType &matrixQ, bool computeU)
 

Static Public Attributes

static const int m_maxIterationsPerRow = 40
 Maximum number of iterations per row. More...
 

Detailed Description

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

Performs a real Schur decomposition of a square matrix.

Template Parameters
_MatrixTypethe type of the matrix of which we are computing the real Schur decomposition; this is expected to be an instantiation of the Matrix class template.

Given a real square matrix A, this class computes the real Schur decomposition: $ A = U T U^T $ where U is a real orthogonal matrix and T is a real 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 with complex eigenvalues. The eigenvalues of the blocks on the diagonal of T are the same as the eigenvalues of the matrix A, and thus the real Schur decomposition is used in EigenSolver to compute the eigendecomposition of a matrix.

Call the function compute() to compute the real Schur decomposition of a given matrix. Alternatively, you can use the RealSchur(const MatrixType&, bool) constructor which computes the real Schur decomposition at construction time. Once the decomposition is computed, you can use the matrixU() and matrixT() functions to retrieve the matrices U and T in the decomposition.

The documentation of RealSchur(const MatrixType&, bool) contains an example of the typical use of this class.

Note
The implementation is adapted from JAMA (public domain). Their code is based on EISPACK.
See also
class ComplexSchur, class EigenSolver, class ComplexEigenSolver

Definition at line 54 of file RealSchur.h.

Constructor & Destructor Documentation

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

Default constructor.

Parameters
[in]sizePositive integer, size of the matrix whose Schur 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 83 of file RealSchur.h.

83  : RowsAtCompileTime)
84  : m_matT(size, size),
85  m_matU(size, size),
86  m_workspaceVector(size),
87  m_hess(size),
88  m_isInitialized(false),
89  m_matUisUptodate(false),
90  m_maxIters(-1)
91  { }
template<typename _MatrixType>
Eigen::RealSchur< _MatrixType >::RealSchur ( const MatrixType &  matrix,
bool  computeU = true 
)
inline

Constructor; computes real Schur decomposition of given matrix.

Parameters
[in]matrixSquare matrix whose Schur decomposition is to be computed.
[in]computeUIf true, both T and U are computed; if false, only T is computed.

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

Example:

Output:

 

Definition at line 103 of file RealSchur.h.

104  : m_matT(matrix.rows(),matrix.cols()),
105  m_matU(matrix.rows(),matrix.cols()),
106  m_workspaceVector(matrix.rows()),
107  m_hess(matrix.rows()),
108  m_isInitialized(false),
109  m_matUisUptodate(false),
110  m_maxIters(-1)
111  {
112  compute(matrix, computeU);
113  }
Definition: math3d.h:219
RealSchur & compute(const MatrixType &matrix, bool computeU=true)
Computes Schur decomposition of given matrix.
Definition: RealSchur.h:246

Member Function Documentation

template<typename MatrixType >
RealSchur< MatrixType > & Eigen::RealSchur< MatrixType >::compute ( const MatrixType &  matrix,
bool  computeU = true 
)

Computes Schur decomposition of given matrix.

Parameters
[in]matrixSquare matrix whose Schur decomposition is to be computed.
[in]computeUIf true, both T and U are computed; if false, only T is computed.
Returns
Reference to *this

The Schur decomposition is computed by first reducing the matrix to Hessenberg form using the class HessenbergDecomposition. The Hessenberg matrix is then reduced to triangular form by performing Francis QR iterations with implicit double shift. The cost of computing the Schur decomposition depends on the number of iterations; as a rough guide, it may be taken to be $25n^3$ flops if computeU is true and $10n^3$ flops if computeU is false.

Example:

Output:

See also
compute(const MatrixType&, bool, Index)

Definition at line 246 of file RealSchur.h.

247 {
248  eigen_assert(matrix.cols() == matrix.rows());
249  Index maxIters = m_maxIters;
250  if (maxIters == -1)
251  maxIters = m_maxIterationsPerRow * matrix.rows();
252 
253  // Step 1. Reduce to Hessenberg form
254  m_hess.compute(matrix);
255 
256  // Step 2. Reduce to real Schur form
257  computeFromHessenberg(m_hess.matrixH(), m_hess.matrixQ(), computeU);
258 
259  return *this;
260 }
HouseholderSequenceType matrixQ() const
Reconstructs the orthogonal matrix Q in the decomposition.
static const int m_maxIterationsPerRow
Maximum number of iterations per row.
Definition: RealSchur.h:221
Definition: math3d.h:219
MatrixHReturnType matrixH() const
Constructs the Hessenberg matrix H in the decomposition.
HessenbergDecomposition & compute(const MatrixType &matrix)
Computes Hessenberg decomposition of given matrix.
RealSchur & computeFromHessenberg(const HessMatrixType &matrixH, const OrthMatrixType &matrixQ, bool computeU)
Computes Schur decomposition of a Hessenberg matrix H = Z T Z^T.
template<typename _MatrixType>
template<typename HessMatrixType , typename OrthMatrixType >
RealSchur& Eigen::RealSchur< _MatrixType >::computeFromHessenberg ( const HessMatrixType &  matrixH,
const OrthMatrixType &  matrixQ,
bool  computeU 
)

Computes Schur decomposition of a Hessenberg matrix H = Z T Z^T.

Parameters
[in]matrixHMatrix in Hessenberg form H
[in]matrixQorthogonal matrix Q that transform a matrix A to H : A = Q H Q^T
computeUComputes the matriX U of the Schur vectors
Returns
Reference to *this

This routine assumes that the matrix is already reduced in Hessenberg form matrixH using either the class HessenbergDecomposition or another mean. It computes the upper quasi-triangular matrix T of the Schur decomposition of H When computeU is true, this routine computes the matrix U such that A = U T U^T = (QZ) T (QZ)^T = Q H Q^T where A is the initial matrix

NOTE Q is referenced if computeU is true; so, if the initial orthogonal matrix is not available, the user should give an identity matrix (Q.setIdentity())

See also
compute(const MatrixType&, bool)
template<typename _MatrixType>
ComputationInfo Eigen::RealSchur< _MatrixType >::info ( ) const
inline

Reports whether previous computation was successful.

Returns
Success if computation was succesful, NoConvergence otherwise.

Definition at line 193 of file RealSchur.h.

194  {
195  eigen_assert(m_isInitialized && "RealSchur is not initialized.");
196  return m_info;
197  }
template<typename _MatrixType>
const MatrixType& Eigen::RealSchur< _MatrixType >::matrixT ( ) const
inline

Returns the quasi-triangular matrix in the Schur decomposition.

Returns
A const reference to the matrix T.
Precondition
Either the constructor RealSchur(const MatrixType&, bool) or the member function compute(const MatrixType&, bool) has been called before to compute the Schur decomposition of a matrix.
See also
RealSchur(const MatrixType&, bool) for an example

Definition at line 143 of file RealSchur.h.

144  {
145  eigen_assert(m_isInitialized && "RealSchur is not initialized.");
146  return m_matT;
147  }
template<typename _MatrixType>
const MatrixType& Eigen::RealSchur< _MatrixType >::matrixU ( ) const
inline

Returns the orthogonal matrix in the Schur decomposition.

Returns
A const reference to the matrix U.
Precondition
Either the constructor RealSchur(const MatrixType&, bool) or the member function compute(const MatrixType&, bool) has been called before to compute the Schur decomposition of a matrix, and computeU was set to true (the default value).
See also
RealSchur(const MatrixType&, bool) for an example

Definition at line 126 of file RealSchur.h.

127  {
128  eigen_assert(m_isInitialized && "RealSchur is not initialized.");
129  eigen_assert(m_matUisUptodate && "The matrix U has not been computed during the RealSchur decomposition.");
130  return m_matU;
131  }
template<typename _MatrixType>
RealSchur& Eigen::RealSchur< _MatrixType >::setMaxIterations ( Index  maxIters)
inline

Sets the maximum number of iterations allowed.

If not specified by the user, the maximum number of iterations is m_maxIterationsPerRow times the size of the matrix.

Definition at line 204 of file RealSchur.h.

205  {
206  m_maxIters = maxIters;
207  return *this;
208  }

Member Data Documentation

template<typename _MatrixType>
const int Eigen::RealSchur< _MatrixType >::m_maxIterationsPerRow = 40
static

Maximum number of iterations per row.

If not otherwise specified, the maximum number of iterations is this number times the size of the matrix. It is currently set to 40.

Definition at line 221 of file RealSchur.h.


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