Eigen  3.4.90 (git rev 67eeba6e720c5745abc77ae6c92ce0a44aa7b7ae)
Eigen::ComplexSchur< MatrixType_ > Class Template Reference

Detailed Description

template<typename MatrixType_>
class Eigen::ComplexSchur< MatrixType_ >

Performs a complex Schur decomposition of a real or complex square matrix.

This is defined in the Eigenvalues module.

#include <Eigen/Eigenvalues>
Template Parameters
MatrixType_the type of the matrix of which we are computing the Schur decomposition; this is expected to be an instantiation of the Matrix class template.

Given a real or complex square matrix A, this class computes the Schur decomposition: \( A = U T U^*\) where U is a unitary complex matrix, and T is a complex upper triangular matrix. The diagonal of the matrix T corresponds to the eigenvalues of the matrix A.

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

Note
This code is inspired from Jampack
See also
class RealSchur, class EigenSolver, class ComplexEigenSolver

Public Types

typedef Matrix< ComplexScalar, RowsAtCompileTime, ColsAtCompileTime, Options, MaxRowsAtCompileTime, MaxColsAtCompileTime > ComplexMatrixType
 Type for the matrices in the Schur decomposition. More...
 
typedef std::complex< RealScalar > ComplexScalar
 Complex scalar type for MatrixType_. More...
 
typedef Eigen::Index Index
 
typedef MatrixType::Scalar Scalar
 Scalar type for matrices of type MatrixType_.
 

Public Member Functions

template<typename InputType >
 ComplexSchur (const EigenBase< InputType > &matrix, bool computeU=true)
 Constructor; computes Schur decomposition of given matrix. More...
 
 ComplexSchur (Index size=RowsAtCompileTime==Dynamic ? 1 :RowsAtCompileTime)
 Default constructor. More...
 
template<typename InputType >
ComplexSchurcompute (const EigenBase< InputType > &matrix, bool computeU=true)
 Computes Schur decomposition of given matrix. More...
 
template<typename HessMatrixType , typename OrthMatrixType >
ComplexSchurcomputeFromHessenberg (const HessMatrixType &matrixH, const OrthMatrixType &matrixQ, bool computeU=true)
 Compute Schur decomposition from a given Hessenberg matrix. More...
 
Index getMaxIterations ()
 Returns the maximum number of iterations.
 
ComputationInfo info () const
 Reports whether previous computation was successful. More...
 
const ComplexMatrixTypematrixT () const
 Returns the triangular matrix in the Schur decomposition. More...
 
const ComplexMatrixTypematrixU () const
 Returns the unitary matrix in the Schur decomposition. More...
 
ComplexSchursetMaxIterations (Index maxIters)
 Sets the maximum number of iterations allowed. More...
 

Static Public Attributes

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

Member Typedef Documentation

◆ ComplexMatrixType

template<typename MatrixType_ >
typedef Matrix<ComplexScalar, RowsAtCompileTime, ColsAtCompileTime, Options, MaxRowsAtCompileTime, MaxColsAtCompileTime> Eigen::ComplexSchur< MatrixType_ >::ComplexMatrixType

Type for the matrices in the Schur decomposition.

This is a square matrix with entries of type ComplexScalar. The size is the same as the size of MatrixType_.

◆ ComplexScalar

template<typename MatrixType_ >
typedef std::complex<RealScalar> Eigen::ComplexSchur< MatrixType_ >::ComplexScalar

Complex scalar type for MatrixType_.

This is std::complex<Scalar> if Scalar is real (e.g., float or double) and just Scalar if Scalar is complex.

◆ Index

template<typename MatrixType_ >
typedef Eigen::Index Eigen::ComplexSchur< MatrixType_ >::Index
Deprecated:
since Eigen 3.3

Constructor & Destructor Documentation

◆ ComplexSchur() [1/2]

template<typename MatrixType_ >
Eigen::ComplexSchur< MatrixType_ >::ComplexSchur ( Index  size = RowsAtCompileTime==Dynamic ? 1 : RowsAtCompileTime)
inlineexplicit

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.

◆ ComplexSchur() [2/2]

template<typename MatrixType_ >
template<typename InputType >
Eigen::ComplexSchur< MatrixType_ >::ComplexSchur ( const EigenBase< InputType > &  matrix,
bool  computeU = true 
)
inlineexplicit

Constructor; 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.

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

See also
matrixT() and matrixU() for examples.

Member Function Documentation

◆ compute()

template<typename MatrixType_ >
template<typename InputType >
ComplexSchur& Eigen::ComplexSchur< MatrixType_ >::compute ( const EigenBase< InputType > &  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 QR iterations with a single shift. The cost of computing the Schur decomposition depends on the number of iterations; as a rough guide, it may be taken on the number of iterations; as a rough guide, it may be taken to be \(25n^3\) complex flops, or \(10n^3\) complex flops if computeU is false.

Example:

ComplexSchur<MatrixXcf> schur(4);
schur.compute(A);
cout << "The matrix T in the decomposition of A is:" << endl << schur.matrixT() << endl;
schur.compute(A.inverse());
cout << "The matrix T in the decomposition of A^(-1) is:" << endl << schur.matrixT() << endl;
static const RandomReturnType Random()
Definition: Random.h:114
Matrix< std::complex< float >, Dynamic, Dynamic > MatrixXcf
Dynamic×Dynamic matrix of type std::complex<float>.
Definition: Matrix.h:502

Output:

The matrix T in the decomposition of A is:
 (-0.691,-1.63)  (0.763,-0.144) (-0.104,-0.836) (-0.462,-0.378)
          (0,0)   (-0.758,1.22)  (-0.65,-0.772)  (-0.244,0.113)
          (0,0)           (0,0)   (0.137,0.505) (0.0687,-0.404)
          (0,0)           (0,0)           (0,0)   (1.52,-0.402)
The matrix T in the decomposition of A^(-1) is:
    (0.501,-1.84)    (-1.01,-0.984)       (0.636,1.3)    (-0.676,0.352)
            (0,0)   (-0.369,-0.593)     (0.0733,0.18) (-0.0658,-0.0263)
            (0,0)             (0,0)    (-0.222,0.521)    (-0.191,0.121)
            (0,0)             (0,0)             (0,0)     (0.614,0.162)
See also
compute(const MatrixType&, bool, Index)

◆ computeFromHessenberg()

template<typename MatrixType_ >
template<typename HessMatrixType , typename OrthMatrixType >
ComplexSchur& Eigen::ComplexSchur< MatrixType_ >::computeFromHessenberg ( const HessMatrixType &  matrixH,
const OrthMatrixType &  matrixQ,
bool  computeU = true 
)

Compute Schur decomposition from a given Hessenberg matrix.

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)

◆ info()

template<typename MatrixType_ >
ComputationInfo Eigen::ComplexSchur< MatrixType_ >::info ( ) const
inline

Reports whether previous computation was successful.

Returns
Success if computation was successful, NoConvergence otherwise.

◆ matrixT()

template<typename MatrixType_ >
const ComplexMatrixType& Eigen::ComplexSchur< MatrixType_ >::matrixT ( ) const
inline

Returns the triangular matrix in the Schur decomposition.

Returns
A const reference to the matrix T.

It is assumed that either the constructor ComplexSchur(const MatrixType& matrix, bool computeU) or the member function compute(const MatrixType& matrix, bool computeU) has been called before to compute the Schur decomposition of a matrix.

Note that this function returns a plain square matrix. If you want to reference only the upper triangular part, use:

schur.matrixT().triangularView<Upper>()
@ Upper
Definition: Constants.h:213

Example:

cout << "Here is a random 4x4 matrix, A:" << endl << A << endl << endl;
ComplexSchur<MatrixXcf> schurOfA(A, false); // false means do not compute U
cout << "The triangular matrix T is:" << endl << schurOfA.matrixT() << endl;

Output:

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

The triangular matrix T is:
 (-0.691,-1.63)  (0.763,-0.144) (-0.104,-0.836) (-0.462,-0.378)
          (0,0)   (-0.758,1.22)  (-0.65,-0.772)  (-0.244,0.113)
          (0,0)           (0,0)   (0.137,0.505) (0.0687,-0.404)
          (0,0)           (0,0)           (0,0)   (1.52,-0.402)

◆ matrixU()

template<typename MatrixType_ >
const ComplexMatrixType& Eigen::ComplexSchur< MatrixType_ >::matrixU ( ) const
inline

Returns the unitary matrix in the Schur decomposition.

Returns
A const reference to the matrix U.

It is assumed that either the constructor ComplexSchur(const MatrixType& matrix, bool computeU) or the member function compute(const MatrixType& matrix, bool computeU) has been called before to compute the Schur decomposition of a matrix, and that computeU was set to true (the default value).

Example:

cout << "Here is a random 4x4 matrix, A:" << endl << A << endl << endl;
ComplexSchur<MatrixXcf> schurOfA(A);
cout << "The unitary matrix U is:" << endl << schurOfA.matrixU() << endl;

Output:

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

The unitary matrix U is:
 (-0.122,0.271)   (0.354,0.255)    (-0.7,0.321) (0.0909,-0.346)
   (0.247,0.23)  (0.435,-0.395)   (0.184,-0.38)  (0.492,-0.347)
(0.859,-0.0877)  (0.00469,0.21) (-0.256,0.0163)   (0.133,0.355)
 (-0.116,0.195) (-0.484,-0.432)  (-0.183,0.359)   (0.559,0.231)

◆ setMaxIterations()

template<typename MatrixType_ >
ComplexSchur& Eigen::ComplexSchur< 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.

Member Data Documentation

◆ m_maxIterationsPerRow

template<typename MatrixType_ >
const int Eigen::ComplexSchur< MatrixType_ >::m_maxIterationsPerRow
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 30.


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