Public Types | Public Member Functions | Static Public Attributes
RealSchur< _MatrixType > Class Template Reference

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

#include <RealSchur.h>

List of all members.

Public Types

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

Public Member Functions

RealSchurcompute (const MatrixType &matrix, bool computeU=true)
 Computes Schur decomposition of given matrix.
ComputationInfo info () const
 Reports whether previous computation was successful.
const MatrixTypematrixT () const
 Returns the quasi-triangular matrix in the Schur decomposition.
const MatrixTypematrixU () const
 Returns the orthogonal matrix in the Schur decomposition.
 RealSchur (Index size=RowsAtCompileTime==Dynamic?1:RowsAtCompileTime)
 Default constructor.
 RealSchur (const MatrixType &matrix, bool computeU=true)
 Constructor; computes real Schur decomposition of given matrix.

Static Public Attributes

static const int m_maxIterations
 Maximum number of iterations.

Detailed Description

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

Performs a real Schur decomposition of a square matrix.

This is defined in the Eigenvalues module.

#include <Eigen/Eigenvalues>
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

Member Typedef Documentation

typedef std::complex<typename NumTraits<Scalar>::Real> ComplexScalar
typedef MatrixType::Index Index
typedef _MatrixType MatrixType
typedef MatrixType::Scalar Scalar

Member Enumeration Documentation

anonymous enum
Enumerator:
RowsAtCompileTime 
ColsAtCompileTime 
Options 
MaxRowsAtCompileTime 
MaxColsAtCompileTime 

Constructor & Destructor Documentation

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

MatrixXd A = MatrixXd::Random(6,6);
cout << "Here is a random 6x6 matrix, A:" << endl << A << endl << endl;
RealSchur<MatrixXd> schur(A);
cout << "The orthogonal matrix U is:" << endl << schur.matrixU() << endl;
cout << "The quasi-triangular matrix T is:" << endl << schur.matrixT() << endl << endl;
MatrixXd U = schur.matrixU();
MatrixXd T = schur.matrixT();
cout << "U * T * U^T = " << endl << U * T * U.transpose() << endl;

Output:

Here is a random 6x6 matrix, A:
   0.68   -0.33   -0.27  -0.717  -0.687  0.0259
 -0.211   0.536  0.0268   0.214  -0.198   0.678
  0.566  -0.444   0.904  -0.967   -0.74   0.225
  0.597   0.108   0.832  -0.514  -0.782  -0.408
  0.823 -0.0452   0.271  -0.726   0.998   0.275
 -0.605   0.258   0.435   0.608  -0.563  0.0486

The orthogonal matrix U is:
  0.348  -0.754 0.00435  -0.351  0.0146   0.432
  -0.16  -0.266  -0.747   0.457  -0.366  0.0571
  0.505  -0.157  0.0746   0.644   0.518  -0.177
  0.703   0.324  -0.409  -0.349  -0.187  -0.275
  0.296   0.372    0.24   0.324  -0.379   0.684
 -0.126   0.305   -0.46  -0.161   0.647   0.485
The quasi-triangular matrix T is:
   -0.2   -1.83   0.864   0.271    1.09   0.139
  0.647   0.298 -0.0536   0.676  -0.288  0.0231
      0       0   0.967  -0.201  -0.429   0.847
      0       0       0   0.353   0.603   0.694
      0       0       0       0   0.572   -1.03
      0       0       0       0  0.0184   0.664

U * T * U^T = 
   0.68   -0.33   -0.27  -0.717  -0.687  0.0259
 -0.211   0.536  0.0268   0.214  -0.198   0.678
  0.566  -0.444   0.904  -0.967   -0.74   0.225
  0.597   0.108   0.832  -0.514  -0.782  -0.408
  0.823 -0.0452   0.271  -0.726   0.998   0.275
 -0.605   0.258   0.435   0.608  -0.563  0.0486

Member Function Documentation

RealSchur< MatrixType > & compute ( const MatrixType matrix,
bool  computeU = true 
)

Computes Schur decomposition of given matrix.

   \param[in]  matrix    Square matrix whose Schur decomposition is to be computed.
   \param[in]  computeU  If true, both T and U are computed; if false, only T is computed.
   \returns    Reference to \c *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 \form#46 flops if \a computeU is true and

$10n^3$ flops if computeU is false.

   Example: \include RealSchur_compute.cpp
   Output: \verbinclude RealSchur_compute.out

References RealSchur< _MatrixType >::compute(), Eigen::NoConvergence, and Eigen::Success.

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

ComputationInfo info ( ) const
inline

Reports whether previous computation was successful.

Returns:
Success if computation was succesful, NoConvergence otherwise.

Referenced by EigenSolver< CompanionMatrixType >::info().

const 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
const 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

Member Data Documentation

const int m_maxIterations
static

Maximum number of iterations.

Maximum number of iterations allowed for an eigenvalue to converge.


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