Class xlifepp::GeneralizedSelfAdjointEigenSolver#

template<typename _MatrixType>
class GeneralizedSelfAdjointEigenSolver : public xlifepp::SelfAdjointEigenSolver<_MatrixType>#

Inheritence diagram for xlifepp::GeneralizedSelfAdjointEigenSolver:

digraph { graph [bgcolor="#00000000"] node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2] edge [color="#1414CE"] "1" [label="xlifepp::GeneralizedSelfAdjointEigenSolver< _MatrixType >" tooltip="xlifepp::GeneralizedSelfAdjointEigenSolver< _MatrixType >" fillcolor="#BFBFBF"] "2" [label="xlifepp::SelfAdjointEigenSolver< _MatrixType >" tooltip="xlifepp::SelfAdjointEigenSolver< _MatrixType >"] "1" -> "2" [dir=forward tooltip="public-inheritance"] }

Collaboration diagram for xlifepp::GeneralizedSelfAdjointEigenSolver:

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

Computes eigenvalues and eigenvectors of the generalized selfadjoint eigen problem.

This class solves the generalized eigenvalue problem \( Av = \lambda Bv \). In this case, the matrix \( A \) should be selfadjoint and the matrix \( B \) should be positive definite.

Only the lower triangular part of the input matrix is referenced.

Call the function compute() to compute the eigenvalues and eigenvectors of a given matrix. Alternatively, you can use the GeneralizedSelfAdjointEigenSolver(const MatrixType&, const MatrixType&, int) constructor which computes the eigenvalues and eigenvectors at construction time. Once the eigenvalue and eigenvectors are computed, they can be retrieved with the eigenvalues() and eigenvectors() functions.

The documentation for GeneralizedSelfAdjointEigenSolver(const MatrixType&, const MatrixType&, int) contains an example of the typical use of this class.

See also

class SelfAdjointEigenSolver, class EigenSolver

Template Parameters:

_MatrixType – the type of the matrix of which we are computing the eigendecomposition; this is expected to be an instantiation of the Matrix class template.

Public Functions

inline GeneralizedSelfAdjointEigenSolver()#

Default constructor for fixed-size matrices.

The default constructor is useful in cases in which the user intends to perform decompositions via compute().

inline GeneralizedSelfAdjointEigenSolver(const MatrixType &matA, const MatrixType &matB, int options = _computeEigenVector | _Ax_lBx)#

Constructor; computes generalized eigendecomposition of given matrix pencil.

This constructor calls compute(const MatrixType&, const MatrixType&, int) to compute the eigenvalues and (if requested) the eigenvectors of the generalized eigenproblem \( Ax = \lambda B x \) with matA the selfadjoint matrix \( A \) and matB the positive definite matrix \( B \). Each eigenvector \( x \) satisfies the property \( x^* B x = 1 \). The eigenvectors are computed if options contains ComputeEigenvectors.

In addition, the two following variants can be solved via options:

  • ABx_lx: \( ABx = \lambda x \)

  • BAx_lx: \( BAx = \lambda x \)

Parameters:
  • matA[in] Selfadjoint matrix in matrix pencil. Only the lower triangular part of the matrix is referenced.

  • matB[in] Positive-definite matrix in matrix pencil. Only the lower triangular part of the matrix is referenced.

  • options[in] A or-ed set of flags {ComputeEigenvectors,EigenvaluesOnly} | {Ax_lBx,ABx_lx,BAx_lx}. Default is ComputeEigenvectors|Ax_lBx.

inline GeneralizedSelfAdjointEigenSolver(Index size)#

Constructor, pre-allocates memory for dynamic-size matrices.

See also

compute() for an example

Parameters:

size[in] Positive integer, size of the matrix whose eigenvalues and eigenvectors will be computed.

GeneralizedSelfAdjointEigenSolver &compute(const MatrixType &matA, const MatrixType &matB, int options = _computeEigenVector | _Ax_lBx)#

Computes generalized eigendecomposition of given matrix pencil.

Accoring to options, this function computes eigenvalues and (if requested) the eigenvectors of one of the following three generalized eigenproblems:

  • Ax_lBx: \( Ax = \lambda B x \)

  • ABx_lx: \( ABx = \lambda x \)

  • BAx_lx: \( BAx = \lambda x \) with matA the selfadjoint matrix \( A \) and matB the positive definite matrix \( B \). In addition, each eigenvector \( x \) satisfies the property \( x^* B x = 1 \).

The eigenvalues() function can be used to retrieve the eigenvalues. If options contains _computeEigenVector, then the eigenvectors are also computed and can be retrieved by calling eigenvectors().

The implementation uses LLT to compute the Cholesky decomposition \( B = LL^* \) and computes the classical eigendecomposition of the selfadjoint matrix \( L^{-1} A (L^*)^{-1} \) if options contains _Ax_lBx and of \( L^{*} A L \) otherwise. This solves the generalized eigenproblem, because any solution of the generalized eigenproblem \( Ax = \lambda B x \) corresponds to a solution \( L^{-1} A (L^*)^{-1} (L^* x) = \lambda (L^* x) \) of the eigenproblem for \( L^{-1} A (L^*)^{-1} \). Similar statements can be made for the two other variants.

Parameters:
  • matA[in] Selfadjoint matrix in matrix pencil. Only the lower triangular part of the matrix is referenced.

  • matB[in] Positive-definite matrix in matrix pencil. Only the lower triangular part of the matrix is referenced.

  • options[in] A or-ed set of flags {_computeEigenVector,_eigenValueOnly} | {_Ax_lBx,_ABx_lx,_BAx_lx}. Default is _computeEigenVector|_Ax_lBx.

Returns:

Reference to *this