Class xlifepp::Tridiagonalization#

template<typename _MatrixType>
class Tridiagonalization#

Collaboration diagram for xlifepp::Tridiagonalization:

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

Tridiagonal decomposition of a selfadjoint matrix.

This class performs a tridiagonal decomposition of a selfadjoint matrix A such that: A=QTQ 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.

Template Parameters:

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

Public Types

typedef HouseholderSequence<MatrixType, CoeffVectorType>::ConjugateReturnType HouseholderSequenceType#

Return type of matrixQ()

typedef _MatrixType MatrixType#

Synonym for the template parameter _MatrixType.

Public Functions

inline Tridiagonalization(const MatrixType &matrix)#

Constructor; computes tridiagonal decomposition of given matrix.

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

Parameters:

matrix[in] Selfadjoint matrix whose tridiagonal decomposition is to be computed.

inline Tridiagonalization(dimen_t 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 tridiagonal decomposition will be computed.

inline Tridiagonalization &compute(const MatrixType &matrix)#

Computes tridiagonal decomposition of given matrix.

The tridiagonal decomposition is computed by bringing the columns of the matrix successively in the required form using Householder reflections. The cost is 4n3/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: \include test_EigenSolverDecomposition.cpp

Parameters:

matrix[in] Selfadjoint matrix whose tridiagonal decomposition is to be computed.

Returns:

Reference to *this

DiagonalReturnType diagonal() const#

Returns the diagonal of the tridiagonal matrix T in the decomposition.

See also

subDiagonal()

Returns:

expression representing the diagonal of T

Pre:

Either the constructor Tridiagonalization(const MatrixType&) or the member function compute(const MatrixType&) has been called before to compute the tridiagonal decomposition of a matrix.

inline CoeffVectorType householderCoefficients() const#

Returns the Householder coefficients.

The Householder coefficients allow the reconstruction of the matrix Q in the tridiagonal decomposition from the packed data.

Returns:

a const reference to the vector of Householder coefficients

Pre:

Either the constructor Tridiagonalization(const MatrixType&) or the member function compute(const MatrixType&) has been called before to compute the tridiagonal decomposition of a matrix.

inline MatrixType matrixQ()#

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

Returns:

object representing the matrix Q

Pre:

Either the constructor Tridiagonalization(const MatrixType&) or the member function compute(const MatrixType&) has been called before to compute the tridiagonal decomposition of a matrix.

inline const MatrixType &packedMatrix() const#

Returns the internal representation of the decomposition.

The returned matrix contains the following information:

  • the strict upper triangular part is equal to the input matrix A.

  • the diagonal and lower sub-diagonal represent the real tridiagonal symmetric matrix T.

  • the rest of the lower part contains the Householder vectors that, combined with Householder coefficients returned by householderCoefficients(), allows to reconstruct the matrix Q as Q=HN1H1H0. Here, the matrices Hi are the Householder transformations Hi=(IhiviviT) where hi is the ith Householder coefficient and vi is the Householder vector defined by vi=[0,,0,1,M(i+2,i),,M(N1,i)]T with M the matrix returned by this function.

See LAPACK for further details on this packed storage.

Returns:

a const reference to a matrix with the internal representation of the decomposition.

Pre:

Either the constructor Tridiagonalization(const MatrixType&) or the member function compute(const MatrixType&) has been called before to compute the tridiagonal decomposition of a matrix.

SubDiagonalReturnType subDiagonal() const#

Returns the subdiagonal of the tridiagonal matrix T in the decomposition.

Returns:

expression representing the subdiagonal of T

Pre:

Either the constructor Tridiagonalization(const MatrixType&) or the member function compute(const MatrixType&) has been called before to compute the tridiagonal decomposition of a matrix.