From 8a74ce922cbee1c416675e57e48393dd6b399e4e Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Mon, 1 Sep 2014 17:19:16 +0200 Subject: [PATCH] Make IncompleteLUT use SparseSolverBase. --- .../IterativeLinearSolvers/IncompleteLUT.h | 26 ++++++------------- 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/Eigen/src/IterativeLinearSolvers/IncompleteLUT.h b/Eigen/src/IterativeLinearSolvers/IncompleteLUT.h index a39ed7748..f337c5fb0 100644 --- a/Eigen/src/IterativeLinearSolvers/IncompleteLUT.h +++ b/Eigen/src/IterativeLinearSolvers/IncompleteLUT.h @@ -94,8 +94,12 @@ Index QuickSplit(VectorV &row, VectorI &ind, Index ncut) * http://comments.gmane.org/gmane.comp.lib.eigen/3302 */ template -class IncompleteLUT : internal::noncopyable +class IncompleteLUT : public SparseSolverBase > { + protected: + typedef SparseSolverBase > Base; + using Base::m_isInitialized; + public: typedef _Scalar Scalar; typedef typename NumTraits::Real RealScalar; typedef Matrix Vector; @@ -108,13 +112,13 @@ class IncompleteLUT : internal::noncopyable IncompleteLUT() : m_droptol(NumTraits::dummy_precision()), m_fillfactor(10), - m_analysisIsOk(false), m_factorizationIsOk(false), m_isInitialized(false) + m_analysisIsOk(false), m_factorizationIsOk(false) {} template IncompleteLUT(const MatrixType& mat, const RealScalar& droptol=NumTraits::dummy_precision(), int fillfactor = 10) : m_droptol(droptol),m_fillfactor(fillfactor), - m_analysisIsOk(false),m_factorizationIsOk(false),m_isInitialized(false) + m_analysisIsOk(false),m_factorizationIsOk(false) { eigen_assert(fillfactor != 0); compute(mat); @@ -159,11 +163,7 @@ class IncompleteLUT : internal::noncopyable void setFillfactor(int fillfactor); template -#ifndef EIGEN_TEST_EVALUATORS - void _solve(const Rhs& b, Dest& x) const -#else void _solve_impl(const Rhs& b, Dest& x) const -#endif { x = m_Pinv * b; x = m_lu.template triangularView().solve(x); @@ -180,15 +180,6 @@ class IncompleteLUT : internal::noncopyable && "IncompleteLUT::solve(): invalid number of rows of the right hand side matrix b"); return internal::solve_retval(*this, b.derived()); } -#else - template inline const Solve - solve(const MatrixBase& b) const - { - eigen_assert(m_isInitialized && "IncompleteLUT is not initialized."); - eigen_assert(cols()==b.rows() - && "IncompleteLUT::solve(): invalid number of rows of the right hand side matrix b"); - return Solve(*this, b.derived()); - } #endif protected: @@ -208,7 +199,6 @@ protected: int m_fillfactor; bool m_analysisIsOk; bool m_factorizationIsOk; - bool m_isInitialized; ComputationInfo m_info; PermutationMatrix m_P; // Fill-reducing permutation PermutationMatrix m_Pinv; // Inverse permutation @@ -473,7 +463,7 @@ struct solve_retval, Rhs> template void evalTo(Dest& dst) const { - dec()._solve(rhs(),dst); + dec()._solve_impl(rhs(),dst); } };