Class xlifepp::RealSchur#

template<typename _MatrixType>
class RealSchur#

Inheritence diagram for xlifepp::RealSchur:

digraph { graph [bgcolor="#00000000"] node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2] edge [color="#1414CE"] "2" [label="xlifepp::RealSchur< MatrixType >" tooltip="xlifepp::RealSchur< MatrixType >"] "1" [label="xlifepp::RealSchur< _MatrixType >" tooltip="xlifepp::RealSchur< _MatrixType >" fillcolor="#BFBFBF"] "2" -> "1" [dir=forward tooltip="template-instance"] }

Collaboration diagram for xlifepp::RealSchur:

digraph { graph [bgcolor="#00000000"] node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2] edge [color="#1414CE"] "2" [label="xlifepp::HessenbergDecomposition< MatrixType >" tooltip="xlifepp::HessenbergDecomposition< MatrixType >"] "4" [label="xlifepp::Vector< Scalar >" tooltip="xlifepp::Vector< Scalar >"] "3" [label="xlifepp::VectorEigenDense< Scalar >" tooltip="xlifepp::VectorEigenDense< Scalar >"] "6" [label="std::vector< T >" tooltip="std::vector< T >"] "8" [label="std::vector< K >" tooltip="std::vector< K >"] "5" [label="std::vector< Scalar >" tooltip="std::vector< Scalar >"] "11" [label="xlifepp::HessenbergDecomposition< _MatrixType >" tooltip="xlifepp::HessenbergDecomposition< _MatrixType >"] "1" [label="xlifepp::RealSchur< _MatrixType >" tooltip="xlifepp::RealSchur< _MatrixType >" fillcolor="#BFBFBF"] "7" [label="xlifepp::Vector< K >" tooltip="xlifepp::Vector< K >"] "10" [label="xlifepp::Vector< K >" tooltip="xlifepp::Vector< K >"] "9" [label="xlifepp::VectorEigenDense< K >" tooltip="xlifepp::VectorEigenDense< K >"] "2" -> "3" [dir=forward tooltip="usage"] "2" -> "11" [dir=forward tooltip="template-instance"] "4" -> "5" [dir=forward tooltip="public-inheritance"] "4" -> "7" [dir=forward tooltip="template-instance"] "3" -> "4" [dir=forward tooltip="public-inheritance"] "3" -> "9" [dir=forward tooltip="template-instance"] "8" -> "6" [dir=forward tooltip="template-instance"] "5" -> "6" [dir=forward tooltip="template-instance"] "11" -> "3" [dir=forward tooltip="usage"] "1" -> "2" [dir=forward tooltip="usage"] "7" -> "8" [dir=forward tooltip="public-inheritance"] "10" -> "8" [dir=forward tooltip="public-inheritance"] "9" -> "10" [dir=forward tooltip="public-inheritance"] }

Performs a real Schur decomposition of a square matrix.

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.

Template Parameters:

_MatrixType – the 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.

Note

The implementation is adapted from JAMA (public domain). Their code is based on EISPACK.

Public Functions

inline RealSchur(const MatrixType &matrix, bool computeU = true)#

Constructor; computes real Schur decomposition of given matrix.

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

Parameters:
  • matrix[in] Square matrix whose Schur decomposition is to be computed.

  • computeU[in] If true, both T and U are computed; if false, only T is computed.

inline RealSchur(Index size)#

Default constructor.

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.

Parameters:

size[in] Positive integer, size of the matrix whose Schur decomposition will be computed.

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

Computes Schur decomposition of given matrix.

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.

Parameters:
  • matrix[in] Square matrix whose Schur decomposition is to be computed.

  • computeU[in] If true, both T and U are computed; if false, only T is computed.

Returns:

Reference to *this

inline ComputationInfo info() const#

Reports whether previous computation was successful.

Returns:

Success if computation was succesful, NoConvergence otherwise.

inline const MatrixType &matrixT() const#

Returns the quasi-triangular matrix in the Schur decomposition.

Returns:

A const reference to the matrix T.

Pre:

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.

inline const MatrixType &matrixU() const#

Returns the orthogonal matrix in the Schur decomposition.

See also

RealSchur(const MatrixType&, bool) for an example

Returns:

A const reference to the matrix U.

Pre:

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

void swapSchur(unsigned int ifst, unsigned int ilst, bool computeU)#

Reorder block diagonal of quasi-triagular from row ifst to row with index ilst.