Public Types | Public Member Functions | Protected Attributes | List of all members
Eigen::ArpackGeneralizedSelfAdjointEigenSolver< MatrixType, MatrixSolver, BisSPD > Class Template Reference

#include <ArpackSelfAdjointEigenSolver.h>

Public Types

typedef MatrixType::Index Index
 
typedef NumTraits< Scalar >::Real RealScalar
 Real scalar type for MatrixType. More...
 
typedef internal::plain_col_type< MatrixType, RealScalar >::type RealVectorType
 Type for vector of eigenvalues as returned by eigenvalues(). More...
 
typedef MatrixType::Scalar Scalar
 Scalar type for matrices of type MatrixType. More...
 

Public Member Functions

 ArpackGeneralizedSelfAdjointEigenSolver ()
 Default constructor. More...
 
 ArpackGeneralizedSelfAdjointEigenSolver (const MatrixType &A, const MatrixType &B, Index nbrEigenvalues, std::string eigs_sigma="LM", int options=ComputeEigenvectors, RealScalar tol=0.0)
 Constructor; computes generalized eigenvalues of given matrix with respect to another matrix. More...
 
 ArpackGeneralizedSelfAdjointEigenSolver (const MatrixType &A, Index nbrEigenvalues, std::string eigs_sigma="LM", int options=ComputeEigenvectors, RealScalar tol=0.0)
 Constructor; computes eigenvalues of given matrix. More...
 
ArpackGeneralizedSelfAdjointEigenSolvercompute (const MatrixType &A, const MatrixType &B, Index nbrEigenvalues, std::string eigs_sigma="LM", int options=ComputeEigenvectors, RealScalar tol=0.0)
 Computes generalized eigenvalues / eigenvectors of given matrix using the external ARPACK library. More...
 
ArpackGeneralizedSelfAdjointEigenSolvercompute (const MatrixType &A, Index nbrEigenvalues, std::string eigs_sigma="LM", int options=ComputeEigenvectors, RealScalar tol=0.0)
 Computes eigenvalues / eigenvectors of given matrix using the external ARPACK library. More...
 
const Matrix< Scalar, Dynamic, 1 > & eigenvalues () const
 Returns the eigenvalues of given matrix. More...
 
const Matrix< Scalar, Dynamic, Dynamic > & eigenvectors () const
 Returns the eigenvectors of given matrix. More...
 
size_t getNbrConvergedEigenValues () const
 
size_t getNbrIterations () const
 
ComputationInfo info () const
 Reports whether previous computation was successful. More...
 
Matrix< Scalar, Dynamic, DynamicoperatorInverseSqrt () const
 Computes the inverse square root of the matrix. More...
 
Matrix< Scalar, Dynamic, DynamicoperatorSqrt () const
 Computes the positive-definite square root of the matrix. More...
 

Protected Attributes

bool m_eigenvectorsOk
 
Matrix< Scalar, Dynamic, 1 > m_eivalues
 
Matrix< Scalar, Dynamic, Dynamicm_eivec
 
ComputationInfo m_info
 
bool m_isInitialized
 
size_t m_nbrConverged
 
size_t m_nbrIterations
 

Detailed Description

template<typename MatrixType, typename MatrixSolver = SimplicialLLT<MatrixType>, bool BisSPD = false>
class Eigen::ArpackGeneralizedSelfAdjointEigenSolver< MatrixType, MatrixSolver, BisSPD >

Definition at line 25 of file ArpackSelfAdjointEigenSolver.h.

Member Typedef Documentation

◆ Index

template<typename MatrixType , typename MatrixSolver = SimplicialLLT<MatrixType>, bool BisSPD = false>
typedef MatrixType::Index Eigen::ArpackGeneralizedSelfAdjointEigenSolver< MatrixType, MatrixSolver, BisSPD >::Index

Definition at line 32 of file ArpackSelfAdjointEigenSolver.h.

◆ RealScalar

template<typename MatrixType , typename MatrixSolver = SimplicialLLT<MatrixType>, bool BisSPD = false>
typedef NumTraits<Scalar>::Real Eigen::ArpackGeneralizedSelfAdjointEigenSolver< MatrixType, MatrixSolver, BisSPD >::RealScalar

Real scalar type for MatrixType.

This is just Scalar if Scalar is real (e.g., float or Scalar), and the type of the real part of Scalar if Scalar is complex.

Definition at line 40 of file ArpackSelfAdjointEigenSolver.h.

◆ RealVectorType

template<typename MatrixType , typename MatrixSolver = SimplicialLLT<MatrixType>, bool BisSPD = false>
typedef internal::plain_col_type<MatrixType, RealScalar>::type Eigen::ArpackGeneralizedSelfAdjointEigenSolver< MatrixType, MatrixSolver, BisSPD >::RealVectorType

Type for vector of eigenvalues as returned by eigenvalues().

This is a column vector with entries of type RealScalar. The length of the vector is the size of nbrEigenvalues.

Definition at line 47 of file ArpackSelfAdjointEigenSolver.h.

◆ Scalar

template<typename MatrixType , typename MatrixSolver = SimplicialLLT<MatrixType>, bool BisSPD = false>
typedef MatrixType::Scalar Eigen::ArpackGeneralizedSelfAdjointEigenSolver< MatrixType, MatrixSolver, BisSPD >::Scalar

Scalar type for matrices of type MatrixType.

Definition at line 31 of file ArpackSelfAdjointEigenSolver.h.

Constructor & Destructor Documentation

◆ ArpackGeneralizedSelfAdjointEigenSolver() [1/3]

template<typename MatrixType , typename MatrixSolver = SimplicialLLT<MatrixType>, bool BisSPD = false>
Eigen::ArpackGeneralizedSelfAdjointEigenSolver< MatrixType, MatrixSolver, BisSPD >::ArpackGeneralizedSelfAdjointEigenSolver ( )
inline

Default constructor.

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

Definition at line 55 of file ArpackSelfAdjointEigenSolver.h.

◆ ArpackGeneralizedSelfAdjointEigenSolver() [2/3]

template<typename MatrixType , typename MatrixSolver = SimplicialLLT<MatrixType>, bool BisSPD = false>
Eigen::ArpackGeneralizedSelfAdjointEigenSolver< MatrixType, MatrixSolver, BisSPD >::ArpackGeneralizedSelfAdjointEigenSolver ( const MatrixType A,
const MatrixType B,
Index  nbrEigenvalues,
std::string  eigs_sigma = "LM",
int  options = ComputeEigenvectors,
RealScalar  tol = 0.0 
)
inline

Constructor; computes generalized eigenvalues of given matrix with respect to another matrix.

Parameters
[in]ASelf-adjoint matrix whose eigenvalues / eigenvectors will computed. By default, the upper triangular part is used, but can be changed through the template parameter.
[in]BSelf-adjoint matrix for the generalized eigenvalue problem.
[in]nbrEigenvaluesThe number of eigenvalues / eigenvectors to compute. Must be less than the size of the input matrix, or an error is returned.
[in]eigs_sigmaString containing either "LM", "SM", "LA", or "SA", with respective meanings to find the largest magnitude , smallest magnitude, largest algebraic, or smallest algebraic eigenvalues. Alternatively, this value can contain floating point value in string form, in which case the eigenvalues closest to this value will be found.
[in]optionsCan be ComputeEigenvectors (default) or EigenvaluesOnly.
[in]tolWhat tolerance to find the eigenvalues to. Default is 0, which means machine precision.

This constructor calls compute(const MatrixType&, const MatrixType&, Index, string, int, RealScalar) to compute the eigenvalues of the matrix A with respect to B. The eigenvectors are computed if options equals ComputeEigenvectors.

Definition at line 86 of file ArpackSelfAdjointEigenSolver.h.

◆ ArpackGeneralizedSelfAdjointEigenSolver() [3/3]

template<typename MatrixType , typename MatrixSolver = SimplicialLLT<MatrixType>, bool BisSPD = false>
Eigen::ArpackGeneralizedSelfAdjointEigenSolver< MatrixType, MatrixSolver, BisSPD >::ArpackGeneralizedSelfAdjointEigenSolver ( const MatrixType A,
Index  nbrEigenvalues,
std::string  eigs_sigma = "LM",
int  options = ComputeEigenvectors,
RealScalar  tol = 0.0 
)
inline

Constructor; computes eigenvalues of given matrix.

Parameters
[in]ASelf-adjoint matrix whose eigenvalues / eigenvectors will computed. By default, the upper triangular part is used, but can be changed through the template parameter.
[in]nbrEigenvaluesThe number of eigenvalues / eigenvectors to compute. Must be less than the size of the input matrix, or an error is returned.
[in]eigs_sigmaString containing either "LM", "SM", "LA", or "SA", with respective meanings to find the largest magnitude , smallest magnitude, largest algebraic, or smallest algebraic eigenvalues. Alternatively, this value can contain floating point value in string form, in which case the eigenvalues closest to this value will be found.
[in]optionsCan be ComputeEigenvectors (default) or EigenvaluesOnly.
[in]tolWhat tolerance to find the eigenvalues to. Default is 0, which means machine precision.

This constructor calls compute(const MatrixType&, Index, string, int, RealScalar) to compute the eigenvalues of the matrix A. The eigenvectors are computed if options equals ComputeEigenvectors.

Definition at line 121 of file ArpackSelfAdjointEigenSolver.h.

Member Function Documentation

◆ compute() [1/2]

template<typename MatrixType , typename MatrixSolver , bool BisSPD>
ArpackGeneralizedSelfAdjointEigenSolver< MatrixType, MatrixSolver, BisSPD > & Eigen::ArpackGeneralizedSelfAdjointEigenSolver< MatrixType, MatrixSolver, BisSPD >::compute ( const MatrixType A,
const MatrixType B,
Index  nbrEigenvalues,
std::string  eigs_sigma = "LM",
int  options = ComputeEigenvectors,
RealScalar  tol = 0.0 
)

Computes generalized eigenvalues / eigenvectors of given matrix using the external ARPACK library.

Parameters
[in]ASelfadjoint matrix whose eigendecomposition is to be computed.
[in]BSelfadjoint matrix for generalized eigenvalues.
[in]nbrEigenvaluesThe number of eigenvalues / eigenvectors to compute. Must be less than the size of the input matrix, or an error is returned.
[in]eigs_sigmaString containing either "LM", "SM", "LA", or "SA", with respective meanings to find the largest magnitude , smallest magnitude, largest algebraic, or smallest algebraic eigenvalues. Alternatively, this value can contain floating point value in string form, in which case the eigenvalues closest to this value will be found.
[in]optionsCan be ComputeEigenvectors (default) or EigenvaluesOnly.
[in]tolWhat tolerance to find the eigenvalues to. Default is 0, which means machine precision.
Returns
Reference to *this

This function computes the generalized eigenvalues of A with respect to B using ARPACK. The eigenvalues() function can be used to retrieve them. If options equals ComputeEigenvectors, then the eigenvectors are also computed and can be retrieved by calling eigenvectors().

Definition at line 333 of file ArpackSelfAdjointEigenSolver.h.

◆ compute() [2/2]

template<typename MatrixType , typename MatrixSolver , bool BisSPD>
ArpackGeneralizedSelfAdjointEigenSolver< MatrixType, MatrixSolver, BisSPD > & Eigen::ArpackGeneralizedSelfAdjointEigenSolver< MatrixType, MatrixSolver, BisSPD >::compute ( const MatrixType A,
Index  nbrEigenvalues,
std::string  eigs_sigma = "LM",
int  options = ComputeEigenvectors,
RealScalar  tol = 0.0 
)

Computes eigenvalues / eigenvectors of given matrix using the external ARPACK library.

Parameters
[in]ASelfadjoint matrix whose eigendecomposition is to be computed.
[in]nbrEigenvaluesThe number of eigenvalues / eigenvectors to compute. Must be less than the size of the input matrix, or an error is returned.
[in]eigs_sigmaString containing either "LM", "SM", "LA", or "SA", with respective meanings to find the largest magnitude , smallest magnitude, largest algebraic, or smallest algebraic eigenvalues. Alternatively, this value can contain floating point value in string form, in which case the eigenvalues closest to this value will be found.
[in]optionsCan be ComputeEigenvectors (default) or EigenvaluesOnly.
[in]tolWhat tolerance to find the eigenvalues to. Default is 0, which means machine precision.
Returns
Reference to *this

This function computes the eigenvalues of A using ARPACK. The eigenvalues() function can be used to retrieve them. If options equals ComputeEigenvectors, then the eigenvectors are also computed and can be retrieved by calling eigenvectors().

Definition at line 320 of file ArpackSelfAdjointEigenSolver.h.

◆ eigenvalues()

template<typename MatrixType , typename MatrixSolver = SimplicialLLT<MatrixType>, bool BisSPD = false>
const Matrix<Scalar, Dynamic, 1>& Eigen::ArpackGeneralizedSelfAdjointEigenSolver< MatrixType, MatrixSolver, BisSPD >::eigenvalues ( ) const
inline

Returns the eigenvalues of given matrix.

Returns
A const reference to the column vector containing the eigenvalues.
Precondition
The eigenvalues have been computed before.

The eigenvalues are repeated according to their algebraic multiplicity, so there are as many eigenvalues as rows in the matrix. The eigenvalues are sorted in increasing order.

Example:

MatrixXd ones = MatrixXd::Ones(3,3);
SelfAdjointEigenSolver<MatrixXd> es(ones);
cout << "The eigenvalues of the 3x3 matrix of ones are:"
<< endl << es.eigenvalues() << endl;

Output:

See also
eigenvectors(), MatrixBase::eigenvalues()

Definition at line 230 of file ArpackSelfAdjointEigenSolver.h.

◆ eigenvectors()

template<typename MatrixType , typename MatrixSolver = SimplicialLLT<MatrixType>, bool BisSPD = false>
const Matrix<Scalar, Dynamic, Dynamic>& Eigen::ArpackGeneralizedSelfAdjointEigenSolver< MatrixType, MatrixSolver, BisSPD >::eigenvectors ( ) const
inline

Returns the eigenvectors of given matrix.

Returns
A const reference to the matrix whose columns are the eigenvectors.
Precondition
The eigenvectors have been computed before.

Column $ k $ of the returned matrix is an eigenvector corresponding to eigenvalue number $ k $ as returned by eigenvalues(). The eigenvectors are normalized to have (Euclidean) norm equal to one. If this object was used to solve the eigenproblem for the selfadjoint matrix $ A $, then the matrix returned by this function is the matrix $ V $ in the eigendecomposition $ A V = D V $. For the generalized eigenproblem, the matrix returned is the solution $ A V = D B V $

Example:

MatrixXd ones = MatrixXd::Ones(3,3);
SelfAdjointEigenSolver<MatrixXd> es(ones);
cout << "The first eigenvector of the 3x3 matrix of ones is:"
<< endl << es.eigenvectors().col(0) << endl;

Output:

See also
eigenvalues()

Definition at line 208 of file ArpackSelfAdjointEigenSolver.h.

◆ getNbrConvergedEigenValues()

template<typename MatrixType , typename MatrixSolver = SimplicialLLT<MatrixType>, bool BisSPD = false>
size_t Eigen::ArpackGeneralizedSelfAdjointEigenSolver< MatrixType, MatrixSolver, BisSPD >::getNbrConvergedEigenValues ( ) const
inline

Definition at line 296 of file ArpackSelfAdjointEigenSolver.h.

◆ getNbrIterations()

template<typename MatrixType , typename MatrixSolver = SimplicialLLT<MatrixType>, bool BisSPD = false>
size_t Eigen::ArpackGeneralizedSelfAdjointEigenSolver< MatrixType, MatrixSolver, BisSPD >::getNbrIterations ( ) const
inline

Definition at line 299 of file ArpackSelfAdjointEigenSolver.h.

◆ info()

template<typename MatrixType , typename MatrixSolver = SimplicialLLT<MatrixType>, bool BisSPD = false>
ComputationInfo Eigen::ArpackGeneralizedSelfAdjointEigenSolver< MatrixType, MatrixSolver, BisSPD >::info ( ) const
inline

Reports whether previous computation was successful.

Returns
Success if computation was successful, NoConvergence otherwise.

Definition at line 290 of file ArpackSelfAdjointEigenSolver.h.

◆ operatorInverseSqrt()

template<typename MatrixType , typename MatrixSolver = SimplicialLLT<MatrixType>, bool BisSPD = false>
Matrix<Scalar, Dynamic, Dynamic> Eigen::ArpackGeneralizedSelfAdjointEigenSolver< MatrixType, MatrixSolver, BisSPD >::operatorInverseSqrt ( ) const
inline

Computes the inverse square root of the matrix.

Returns
the inverse positive-definite square root of the matrix
Precondition
The eigenvalues and eigenvectors of a positive-definite matrix have been computed before.

This function uses the eigendecomposition $ A = V D V^{-1} $ to compute the inverse square root as $ V D^{-1/2} V^{-1} $. This is cheaper than first computing the square root with operatorSqrt() and then its inverse with MatrixBase::inverse().

Example:

MatrixXd X = MatrixXd::Random(4,4);
MatrixXd A = X * X.transpose();
cout << "Here is a random positive-definite matrix, A:" << endl << A << endl << endl;
SelfAdjointEigenSolver<MatrixXd> es(A);
cout << "The inverse square root of A is: " << endl;
cout << es.operatorInverseSqrt() << endl;
cout << "We can also compute it with operatorSqrt() and inverse(). That yields: " << endl;
cout << es.operatorSqrt().inverse() << endl;

Output:

See also
operatorSqrt(), MatrixBase::inverse(), MatrixFunctions Module

Definition at line 279 of file ArpackSelfAdjointEigenSolver.h.

◆ operatorSqrt()

template<typename MatrixType , typename MatrixSolver = SimplicialLLT<MatrixType>, bool BisSPD = false>
Matrix<Scalar, Dynamic, Dynamic> Eigen::ArpackGeneralizedSelfAdjointEigenSolver< MatrixType, MatrixSolver, BisSPD >::operatorSqrt ( ) const
inline

Computes the positive-definite square root of the matrix.

Returns
the positive-definite square root of the matrix
Precondition
The eigenvalues and eigenvectors of a positive-definite matrix have been computed before.

The square root of a positive-definite matrix $ A $ is the positive-definite matrix whose square equals $ A $. This function uses the eigendecomposition $ A = V D V^{-1} $ to compute the square root as $ A^{1/2} = V D^{1/2} V^{-1} $.

Example:

MatrixXd X = MatrixXd::Random(4,4);
MatrixXd A = X * X.transpose();
cout << "Here is a random positive-definite matrix, A:" << endl << A << endl << endl;
SelfAdjointEigenSolver<MatrixXd> es(A);
MatrixXd sqrtA = es.operatorSqrt();
cout << "The square root of A is: " << endl << sqrtA << endl;
cout << "If we square this, we get: " << endl << sqrtA*sqrtA << endl;

Output:

See also
operatorInverseSqrt(), MatrixFunctions Module

Definition at line 254 of file ArpackSelfAdjointEigenSolver.h.

Member Data Documentation

◆ m_eigenvectorsOk

template<typename MatrixType , typename MatrixSolver = SimplicialLLT<MatrixType>, bool BisSPD = false>
bool Eigen::ArpackGeneralizedSelfAdjointEigenSolver< MatrixType, MatrixSolver, BisSPD >::m_eigenvectorsOk
protected

Definition at line 307 of file ArpackSelfAdjointEigenSolver.h.

◆ m_eivalues

template<typename MatrixType , typename MatrixSolver = SimplicialLLT<MatrixType>, bool BisSPD = false>
Matrix<Scalar, Dynamic, 1> Eigen::ArpackGeneralizedSelfAdjointEigenSolver< MatrixType, MatrixSolver, BisSPD >::m_eivalues
protected

Definition at line 304 of file ArpackSelfAdjointEigenSolver.h.

◆ m_eivec

template<typename MatrixType , typename MatrixSolver = SimplicialLLT<MatrixType>, bool BisSPD = false>
Matrix<Scalar, Dynamic, Dynamic> Eigen::ArpackGeneralizedSelfAdjointEigenSolver< MatrixType, MatrixSolver, BisSPD >::m_eivec
protected

Definition at line 303 of file ArpackSelfAdjointEigenSolver.h.

◆ m_info

template<typename MatrixType , typename MatrixSolver = SimplicialLLT<MatrixType>, bool BisSPD = false>
ComputationInfo Eigen::ArpackGeneralizedSelfAdjointEigenSolver< MatrixType, MatrixSolver, BisSPD >::m_info
protected

Definition at line 305 of file ArpackSelfAdjointEigenSolver.h.

◆ m_isInitialized

template<typename MatrixType , typename MatrixSolver = SimplicialLLT<MatrixType>, bool BisSPD = false>
bool Eigen::ArpackGeneralizedSelfAdjointEigenSolver< MatrixType, MatrixSolver, BisSPD >::m_isInitialized
protected

Definition at line 306 of file ArpackSelfAdjointEigenSolver.h.

◆ m_nbrConverged

template<typename MatrixType , typename MatrixSolver = SimplicialLLT<MatrixType>, bool BisSPD = false>
size_t Eigen::ArpackGeneralizedSelfAdjointEigenSolver< MatrixType, MatrixSolver, BisSPD >::m_nbrConverged
protected

Definition at line 309 of file ArpackSelfAdjointEigenSolver.h.

◆ m_nbrIterations

template<typename MatrixType , typename MatrixSolver = SimplicialLLT<MatrixType>, bool BisSPD = false>
size_t Eigen::ArpackGeneralizedSelfAdjointEigenSolver< MatrixType, MatrixSolver, BisSPD >::m_nbrIterations
protected

Definition at line 310 of file ArpackSelfAdjointEigenSolver.h.


The documentation for this class was generated from the following file:
es
EigenSolver< MatrixXf > es
Definition: EigenSolver_compute.cpp:1
X
#define X
Definition: icosphere.cpp:20
A
Definition: test_numpy_dtypes.cpp:298
sqrtA
MatrixXd sqrtA
Definition: SelfAdjointEigenSolver_operatorSqrt.cpp:6
ones
MatrixXcf ones
Definition: ComplexEigenSolver_eigenvalues.cpp:1


gtsam
Author(s):
autogenerated on Thu Dec 19 2024 04:09:08