20 #ifndef __mast_slepc_constrained_generalized_hermitian_eigen_solver_h__ 21 #define __mast_slepc_constrained_generalized_hermitian_eigen_solver_h__ 31 #include <Eigen/Eigenvalues> 36 namespace EigenWrapper {
38 template <
typename ScalarType,
39 typename EigenSolverType,
64 "Eigenvalue index must be less than matrix size");
66 return _solver.eigenvalues()(i);
82 "Eigenvalue index must be less than matrix size");
86 "Vector must have dimension of original matrix");
99 inline void solve(MatType &A_mat,
101 bool computeEigenvectors) {
105 Assert2(A_mat.rows() == A_mat.cols(),
106 A_mat.rows(), A_mat.cols(),
107 "Matrix must be square");
108 Assert2(B_mat.rows() == B_mat.cols(),
109 B_mat.rows(), B_mat.cols(),
110 "Matrix must be square");
111 Assert2(A_mat.rows() == B_mat.rows(),
112 A_mat.rows(), B_mat.rows(),
113 "Matrices must have same dimensions");
121 if (computeEigenvectors)
143 v1 = VectorType::Zero(
_n);
151 v1.dot( (A_sens * v1) - (eig * B_sens * v1) )/
162 const Eigen::Matrix<scalar_t, Eigen::Dynamic, Eigen::Dynamic> &B,
163 Eigen::Matrix<scalar_t, Eigen::Dynamic, Eigen::Dynamic> &A_sub,
164 Eigen::Matrix<scalar_t, Eigen::Dynamic, Eigen::Dynamic> &B_sub) {
192 #endif // __mast_slepc_constrained_generalized_hermitian_eigen_solver_h__ void solve(MatType &A_mat, MatType &B_mat, bool computeEigenvectors)
method for eigenvalue problems
virtual ~ConstrainedGeneralizedHermitianEigenSolver()
scalar_t sensitivity_solve(MatType &B, MatType &A_sens, MatType &B_sens, uint_t i)
compute the sensitivity of i th eigenvalue Dimension of the matrices B, A_sens and B_sens is equal t...
ScalarType eig(uint_t i)
this method returns the eigen value
void getEigenVector(uint_t i, VectorType &x)
this method returns the eigen pair.
void _init_sub_matrices(const Eigen::Matrix< scalar_t, Eigen::Dynamic, Eigen::Dynamic > &A, const Eigen::Matrix< scalar_t, Eigen::Dynamic, Eigen::Dynamic > &B, Eigen::Matrix< scalar_t, Eigen::Dynamic, Eigen::Dynamic > &A_sub, Eigen::Matrix< scalar_t, Eigen::Dynamic, Eigen::Dynamic > &B_sub)
#define Assert0(cond, msg)
#define Assert2(cond, v1, v2, msg)
ConstrainedGeneralizedHermitianEigenSolver(const std::vector< uint_t > &dofs)
dofs is the vector of unconstrained degrees of freedom on the local rank.
const std::vector< uint_t > & _dofs