![]() |
Eigen
3.4.90 (git rev a4098ac676528a83cfb73d4d26ce1b42ec05f47c)
|
Tridiagonal decomposition of a selfadjoint matrix.
This is defined in the Eigenvalues module.
MatrixType_ | the type of the matrix of which we are computing the tridiagonal decomposition; this is expected to be an instantiation of the Matrix class template. |
This class performs a tridiagonal decomposition of a selfadjoint matrix \( A \) such that: \( A = Q T Q^* \) where \( Q \) is unitary and \( T \) a real symmetric tridiagonal matrix.
A tridiagonal matrix is a matrix which has nonzero elements only on the main diagonal and the first diagonal below and above it. The Hessenberg decomposition of a selfadjoint matrix is in fact a tridiagonal decomposition. This class is used in SelfAdjointEigenSolver to compute the eigenvalues and eigenvectors of a selfadjoint matrix.
Call the function compute() to compute the tridiagonal decomposition of a given matrix. Alternatively, you can use the Tridiagonalization(const MatrixType&) constructor which computes the tridiagonal Schur decomposition at construction time. Once the decomposition is computed, you can use the matrixQ() and matrixT() functions to retrieve the matrices Q and T in the decomposition.
The documentation of Tridiagonalization(const MatrixType&) contains an example of the typical use of this class.
Public Types | |
typedef HouseholderSequence< MatrixType, typename internal::remove_all< typename CoeffVectorType::ConjugateReturnType >::type > | HouseholderSequenceType |
Return type of matrixQ() | |
typedef Eigen::Index | Index |
typedef MatrixType_ | MatrixType |
Synonym for the template parameter MatrixType_ . | |
Public Member Functions | |
template<typename InputType > | |
Tridiagonalization & | compute (const EigenBase< InputType > &matrix) |
Computes tridiagonal decomposition of given matrix. More... | |
DiagonalReturnType | diagonal () const |
Returns the diagonal of the tridiagonal matrix T in the decomposition. More... | |
CoeffVectorType | householderCoefficients () const |
Returns the Householder coefficients. More... | |
HouseholderSequenceType | matrixQ () const |
Returns the unitary matrix Q in the decomposition. More... | |
MatrixTReturnType | matrixT () const |
Returns an expression of the tridiagonal matrix T in the decomposition. More... | |
const MatrixType & | packedMatrix () const |
Returns the internal representation of the decomposition. More... | |
SubDiagonalReturnType | subDiagonal () const |
Returns the subdiagonal of the tridiagonal matrix T in the decomposition. More... | |
template<typename InputType > | |
Tridiagonalization (const EigenBase< InputType > &matrix) | |
Constructor; computes tridiagonal decomposition of given matrix. More... | |
Tridiagonalization (Index size=Size==Dynamic ? 2 :Size) | |
Default constructor. More... | |
typedef Eigen::Index Eigen::Tridiagonalization< MatrixType_ >::Index |
|
inlineexplicit |
Default constructor.
[in] | size | Positive integer, size of the matrix whose tridiagonal 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.
|
inlineexplicit |
Constructor; computes tridiagonal decomposition of given matrix.
[in] | matrix | Selfadjoint matrix whose tridiagonal decomposition is to be computed. |
This constructor calls compute() to compute the tridiagonal decomposition.
Example:
Output:
Here is a random symmetric 5x5 matrix: -2 -1.3 0.278 -0.0233 -0.0995 -1.3 -1.81 0.397 0.701 1.24 0.278 0.397 1.32 -1.92 -0.715 -0.0233 0.701 -1.92 -0.466 -0.00544 -0.0995 1.24 -0.715 -0.00544 1.38 The orthogonal matrix Q is: 1 0 0 0 0 0 -0.975 -0.105 -0.189 0.0521 0 0.209 -0.156 -0.883 0.391 0 -0.0175 0.561 -0.419 -0.713 0 -0.0747 0.806 0.0966 0.579 The tridiagonal matrix T is: -2 1.33 0 0 0 1.33 -1.58 -1.96 0 0 0 -1.96 0.994 1.51 0 0 0 1.51 -0.199 -1.15 0 0 0 -1.15 1.21 Q * T * Q^T = -2 -1.3 0.278 -0.0233 -0.0995 -1.3 -1.81 0.397 0.701 1.24 0.278 0.397 1.32 -1.92 -0.715 -0.0233 0.701 -1.92 -0.466 -0.00544 -0.0995 1.24 -0.715 -0.00544 1.38
|
inline |
Computes tridiagonal decomposition of given matrix.
[in] | matrix | Selfadjoint matrix whose tridiagonal decomposition is to be computed. |
*this
The tridiagonal decomposition is computed by bringing the columns of the matrix successively in the required form using Householder reflections. The cost is \( 4n^3/3 \) flops, where \( n \) denotes the size of the given matrix.
This method reuses of the allocated data in the Tridiagonalization object, if the size of the matrix does not change.
Example:
Output:
The matrix T in the tridiagonal decomposition of A is: -2 1.24 0 0 1.24 -0.772 0.232 0 0 0.232 0.502 0.78 0 0 0.78 -1.2 The matrix T in the tridiagonal decomposition of 2A is: -4 2.48 0 0 2.48 -1.54 0.463 0 0 0.463 1 1.56 0 0 1.56 -2.4
Tridiagonalization< MatrixType >::DiagonalReturnType Eigen::Tridiagonalization< MatrixType >::diagonal |
Returns the diagonal of the tridiagonal matrix T in the decomposition.
Example:
Output:
Here is a random self-adjoint 4x4 matrix: (-2,0) (0.87,0.952) (0.408,-0.423) (-0.214,-0.304) (0.87,-0.952) (-0.466,0) (0.429,0.0645) (-1.71,0.248) (0.408,0.423) (0.429,-0.0645) (-0.33,0) (0.00995,-0.458) (-0.214,0.304) (-1.71,-0.248) (0.00995,0.458) (1.64,0) The tridiagonal matrix T is: -2 -1.46 0 0 -1.46 0.461 2.1 0 0 2.1 0.601 -0.426 0 0 -0.426 -0.218 We can also extract the diagonals of T directly ... The diagonal is: -2 0.461 0.601 -0.218 The subdiagonal is: -1.46 2.1 -0.426
|
inline |
Returns the Householder coefficients.
The Householder coefficients allow the reconstruction of the matrix \( Q \) in the tridiagonal decomposition from the packed data.
Example:
Output:
Here is a random symmetric 4x4 matrix: -2 -0.671 0.87 0.579 -0.671 -1.12 -0.0365 -0.573 0.87 -0.0365 -0.466 -0.854 0.579 -0.573 -0.854 0.119 The vector of Householder coefficients is: 1.54 1.91 0
|
inline |
Returns the unitary matrix Q in the decomposition.
This function returns a light-weight object of template class HouseholderSequence. You can either apply it directly to a matrix or you can convert it to a matrix of type MatrixType.
|
inline |
Returns an expression of the tridiagonal matrix T in the decomposition.
Currently, this function can be used to extract the matrix T from internal data and copy it to a dense matrix object. In most cases, it may be sufficient to directly use the packed matrix or the vector expressions returned by diagonal() and subDiagonal() instead of creating a new dense copy matrix with this function.
|
inline |
Returns the internal representation of the decomposition.
The returned matrix contains the following information:
See LAPACK for further details on this packed storage.
Example:
Output:
Here is a random symmetric 4x4 matrix: -2 -0.671 0.87 0.579 -0.671 -1.12 -0.0365 -0.573 0.87 -0.0365 -0.466 -0.854 0.579 -0.573 -0.854 0.119 The packed matrix M is: -2 -0.671 0.87 0.579 1.24 -0.772 -0.0365 -0.573 -0.455 0.232 0.502 -0.854 -0.303 -0.217 0.78 -1.2 The diagonal and subdiagonal corresponds to the matrix T, which is: -2 1.24 0 0 1.24 -0.772 0.232 0 0 0.232 0.502 0.78 0 0 0.78 -1.2
Tridiagonalization< MatrixType >::SubDiagonalReturnType Eigen::Tridiagonalization< MatrixType >::subDiagonal |
Returns the subdiagonal of the tridiagonal matrix T in the decomposition.