File EigenvaluesProblems.h
Defines
-
SPECTRA_EIGENVALUES_SOLVER
Spectra standard eigenvalue problem.
Uncomment the solver the function minPosGeneralizedEigenvalue uses Eigen solver for generalized eigenvalue problem
-
template<typename NT, typename MT, typename VT>
class EigenvaluesProblems - #include <EigenvaluesProblems.h>
ARPACK++ standard eigenvalues solver.
Solve eigenvalues problems
- Template Parameters:
NT – Numeric Type
MT – Matrix Type
VT – Vector Type
-
template<typename NT>
class EigenvaluesProblems<NT, Eigen::Matrix<NT, Eigen::Dynamic, Eigen::Dynamic>, Eigen::Matrix<NT, Eigen::Dynamic, 1>> - #include <EigenvaluesProblems.h>
A specialization of the template class EigenvaluesProblems for dense Eigen matrices and vectors.
- Template Parameters:
NT – Numer Type
Public Types
-
typedef Eigen::Matrix<NT, Eigen::Dynamic, Eigen::Dynamic> MT
The type for Eigen Matrix.
-
typedef Eigen::Matrix<NT, Eigen::Dynamic, 1> VT
The type for Eigen vector.
-
typedef Eigen::GeneralizedEigenSolver<MT>::ComplexVectorType CVT
The type of a complex Eigen Vector for handling eigenvectors.
Public Functions
-
inline NT findSymEigenvalue(MT const &M)
Find the smallest eigenvalue of M
- Parameters:
M – a symmetric matrix
- Returns:
smallest eigenvalue
-
inline NTpair symGeneralizedProblem(MT const &A, MT const &B) const
Find the minimum positive and maximum negative eigenvalues of the generalized eigenvalue problem A + lB, where A, B symmetric and A negative definite.
- Parameters:
A – [in] Input matrix
B – [in] Input matrix
- Returns:
The pair (minimum positive, maximum negative) of eigenvalues
-
inline NT minPosGeneralizedEigenvalue(MT const &A, MT const &B, CVT &eigenvector)
Finds the minimum positive real eigenvalue of the generalized eigenvalue problem A + lB and the corresponding eigenvector. If the macro EIGEN_EIGENVALUES_SOLVER is defined, the Generalized Solver of Eigen is used. Otherwise, we transform the generalized to a standard eigenvalue problem and use Spectra. Warning: With Spectra we might get a value smaller than the minimum positive real eigenvalue (the real part of a complex eigenvalue). No restriction on the matrices!
- Parameters:
A – [in] Input matrix
B – [in] Input matrix
eigenvector – [out] The eigenvector corresponding to the minimum positive eigenvalue
- Returns:
The minimum positive eigenvalue
-
inline NT minPosLinearEigenvalue(MT const &A, MT const &B, VT &eigvec) const
Find the minimum positive and maximum negative eigenvalues of the generalized eigenvalue problem A + lB, where A, B symmetric and A negative definite.
- Parameters:
A – [in] Input matrix
B – [in] Input matrix
- Returns:
The pair (minimum positive, maximum negative) of eigenvalues
-
inline void linearization(const MT &A, const MT &B, const MT &C, MT &X, MT &Y, bool &updateOnly)
Transform the quadratic eigenvalue problem [At^2 + Bt + c] to the generalized eigenvalue problem X+lY. If the updateOnly flag is false, compute matrices X,Y from scratch; otherwise update them.
- Parameters:
A – [in]
B – [in]
C – [in]
X – [inout]
Y – [inout]
updateOnly – [inout] True if X,Y were previously computed and only B,C changed
-
inline NT minPosQuadraticEigenvalue(MT const &A, MT const &B, MT const &C, MT &X, MT &Y, VT &eigenvector, bool &updateOnly)
Find the minimum positive real eigenvalue of the quadratic eigenvalue problem [At^2 + Bt + c]. First transform it to the generalized eigenvalue problem X+lY. If the updateOnly flag is false, compute matrices X,Y from scratch; otherwise only update them.
- Parameters:
A – [in] Input matrix
B – [in] Input matrix
C – [in] Input matrix
X – [inout]
Y – [inout]
eigenvector – [out] The eigenvector corresponding to the minimum positive eigenvalue
updateOnly – [inout] True if X,Y were previously computed and only B,C changed
- Returns:
Minimum positive eigenvalue
-
inline bool isPositiveSemidefinite(MT const &A) const
-
inline bool is_correlation_matrix(const MT &matrix, const double tol = 1e-8)
Check if a matrix is indeed a correlation matrix return true if input matrix is found to be a correlation matrix |param[in] matrix
-
inline NT minPosLinearEigenvalue_EigenSymSolver(MT const &A, MT const &B, VT &eigvec) const
Minimum positive eigenvalue of the generalized eigenvalue problem A - lB Use Eigen::GeneralizedSelfAdjointEigenSolver<MT> ges(B,A) (faster)
- Parameters:
A – [in] symmetric positive definite matrix
B – [in] symmetric matrix
- Returns:
The minimum positive eigenvalue and the corresponding eigenvector