![]() |
Eigen
3.4.0
|
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. | |
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: 0.392 -0.257 0.345 0.41 0.223 -0.257 1.19 0.379 -0.578 -1.05 0.345 0.379 0.216 0.859 0.472 0.41 -0.578 0.859 1.66 -0.696 0.223 -1.05 0.472 -0.696 -1.03 The orthogonal matrix Q is: 1 0 0 0 0 0 -0.405 -0.34 -0.398 -0.75 0 0.543 -0.269 0.619 -0.499 0 0.646 0.441 -0.573 -0.245 0 0.352 -0.786 -0.362 0.358 The tridiagonal matrix T is: 0.392 0.635 0 0 0 0.635 1.73 0.941 0 0 0 0.941 0.00453 -1.11 0 0 0 -1.11 -1.18 0.501 0 0 0 0.501 1.49 Q * T * Q^T = 0.392 -0.257 0.345 0.41 0.223 -0.257 1.19 0.379 -0.578 -1.05 0.345 0.379 0.216 0.859 0.472 0.41 -0.578 0.859 1.66 -0.696 0.223 -1.05 0.472 -0.696 -1.03
|
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: 0.392 1.53 0 0 1.53 0.414 1.14 0 0 1.14 0.151 -0.287 0 0 -0.287 1.1 The matrix T in the tridiagonal decomposition of 2A is: 0.784 3.05 0 0 3.05 0.828 2.27 0 0 2.27 0.301 -0.573 0 0 -0.573 2.2
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: (-1.65,0) (0.351,-0.413) (1.47,0.238) (0.0978,-1.11) (0.351,0.413) (-0.889,0) (0.226,0.724) (-0.957,0.351) (1.47,-0.238) (0.226,-0.724) (-1.43,0) (-1.71,-0.412) (0.0978,1.11) (-0.957,-0.351) (-1.71,0.412) (2,0) The tridiagonal matrix T is: -1.65 -1.94 0 0 -1.94 0.218 -2.21 0 0 -2.21 0.586 1.55 0 0 1.55 -1.13 We can also extract the diagonals of T directly ... The diagonal is: -1.65 0.218 0.586 -1.13 The subdiagonal is: -1.94 -2.21 1.55
|
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: 0.392 -1.03 -0.797 0.788 -1.03 1.13 0.267 0.778 -0.797 0.267 1.07 -0.187 0.788 0.778 -0.187 -0.541 The vector of Householder coefficients is: 1.68 1.49 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: 0.392 -1.03 -0.797 0.788 -1.03 1.13 0.267 0.778 -0.797 0.267 1.07 -0.187 0.788 0.778 -0.187 -0.541 The packed matrix M is: 0.392 -1.03 -0.797 0.788 1.53 0.414 0.267 0.778 0.311 1.14 0.151 -0.187 -0.308 0.588 -0.287 1.1 The diagonal and subdiagonal corresponds to the matrix T, which is: 0.392 1.53 0 0 1.53 0.414 1.14 0 0 1.14 0.151 -0.287 0 0 -0.287 1.1
Tridiagonalization< MatrixType >::SubDiagonalReturnType Eigen::Tridiagonalization< MatrixType >::subDiagonal | ( | ) | const |
Returns the subdiagonal of the tridiagonal matrix T in the decomposition.