1 #ifndef PRECONDITIONER_HPP_INCLUDED
2 #define PRECONDITIONER_HPP_INCLUDED
9 template <
class Scalar>
13 typedef Scalar scalar_t;
14 typedef Eigen::Matrix<scalar_t, Eigen::Dynamic, 1> vector_t;
20 template<
typename MatrixType>
22 : m_inv_diag(mat.cols())
27 template<
typename MatrixType>
33 template<
typename MatrixType>
36 m_inv_diag = mat.get_diagonal();
37 for (
size_t i = 0; i < m_inv_diag.rows(); ++i)
38 m_inv_diag(i, 0) = 1.0 / m_inv_diag(i, 0);
42 template<
typename MatrixType>
45 return factorize(mat);
48 template<
typename Rhs>
49 inline vector_t solve(Rhs
const &b)
const
51 return m_inv_diag.array() * b.array() ;
54 Eigen::ComputationInfo info()
56 return Eigen::Success;