![]() |
Eigen
3.4.90 (git rev 9589cc4e7fd8e4538bedef80dd36c7738977a8be)
|
#include <Eigen/src/Eigenvalues/Tridiagonalization.h>
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 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, internal::remove_all_t< typename CoeffVectorType::ConjugateReturnType > > | 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. | |
DiagonalReturnType | diagonal () const |
Returns the diagonal of the tridiagonal matrix T in the decomposition. | |
CoeffVectorType | householderCoefficients () const |
Returns the Householder coefficients. | |
HouseholderSequenceType | matrixQ () const |
Returns the unitary matrix Q in the decomposition. | |
MatrixTReturnType | matrixT () const |
Returns an expression of the tridiagonal matrix T in the decomposition. | |
const MatrixType & | packedMatrix () const |
Returns the internal representation of the decomposition. | |
SubDiagonalReturnType | subDiagonal () const |
Returns the subdiagonal of the tridiagonal matrix T in the decomposition. | |
template<typename InputType> | |
Tridiagonalization (const EigenBase< InputType > &matrix) | |
Constructor; computes tridiagonal decomposition of given matrix. | |
Tridiagonalization (Index size=Size==Dynamic ? 2 :Size) | |
Default constructor. | |
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: 1.39 1.13 0.0173 -0.164 -0.686 1.13 0.89 -0.679 -0.703 0.925 0.0173 -0.679 0.268 0.581 0.825 -0.164 -0.703 0.581 -1.51 -0.0932 -0.686 0.925 0.825 -0.0932 -1.56 The orthogonal matrix Q is: 1 0 0 0 0 0 -0.849 0.401 -0.326 0.109 0 -0.013 -0.549 -0.396 0.736 0 0.123 -0.215 -0.778 -0.577 0 0.514 0.701 -0.363 0.337 The tridiagonal matrix T is: 1.39 -1.33 0 0 0 -1.33 -0.492 -1.93 0 0 0 -1.93 -0.138 0.171 0 0 0 0.171 -0.755 -1.14 0 0 0 -1.14 -0.526 Q * T * Q^T = 1.39 1.13 0.0173 -0.164 -0.686 1.13 0.89 -0.679 -0.703 0.925 0.0173 -0.679 0.268 0.581 0.825 -0.164 -0.703 0.581 -1.51 -0.0932 -0.686 0.925 0.825 -0.0932 -1.56
|
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
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: -1.65 -1.16 0 0 -1.16 -0.814 1.45 0 0 1.45 -0.842 1.19 0 0 1.19 0.986 The matrix T in the tridiagonal decomposition of 2A is: -3.3 -2.32 0 0 -2.32 -1.63 2.89 0 0 2.89 -1.68 2.38 0 0 2.38 1.97
Tridiagonalization< MatrixType >::DiagonalReturnType Eigen::Tridiagonalization< MatrixType >::diagonal | ( | ) | const |
Returns the diagonal of the tridiagonal matrix T in the decomposition.
Example:
Output:
Here is a random self-adjoint 4x4 matrix: (0.41,0) (0.406,0.439) (1.67,-0.258) (-1.39,-1.22) (0.406,-0.439) (-0.092,0) (0.581,-0.891) (-0.965,-0.701) (1.67,0.258) (0.581,0.891) (1.7,0) (-0.614,-0.827) (-1.39,1.22) (-0.965,0.701) (-0.614,0.827) (-0.633,0) The tridiagonal matrix T is: 0.41 -2.58 0 0 -2.58 1.99 1.66 0 0 1.66 -0.794 -0.463 0 0 -0.463 -0.215 We can also extract the diagonals of T directly ... The diagonal is: 0.41 1.99 -0.794 -0.215 The subdiagonal is: -2.58 1.66 -0.463
|
inline |
Returns the Householder coefficients.
The Householder coefficients allow the reconstruction of the matrix
Example:
Output:
Here is a random symmetric 4x4 matrix: 1.39 -0.264 -0.391 0.468 -0.264 1.86 0.517 -0.792 -0.391 0.517 0.864 -0.0559 0.468 -0.792 -0.0559 -0.996 The vector of Householder coefficients is: 1.4 1.17 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: 1.39 -0.264 -0.391 0.468 -0.264 1.86 0.517 -0.792 -0.391 0.517 0.864 -0.0559 0.468 -0.792 -0.0559 -0.996 The packed matrix M is: 1.39 -0.264 -0.391 0.468 0.665 0.829 0.517 -0.792 0.421 -1.6 0.238 -0.0559 -0.504 -0.844 -0.581 0.656 The diagonal and subdiagonal corresponds to the matrix T, which is: 1.39 0.665 0 0 0.665 0.829 -1.6 0 0 -1.6 0.238 -0.581 0 0 -0.581 0.656
Tridiagonalization< MatrixType >::SubDiagonalReturnType Eigen::Tridiagonalization< MatrixType >::subDiagonal | ( | ) | const |
Returns the subdiagonal of the tridiagonal matrix T in the decomposition.