Make unsupport sparse solvers use SparseSolverBase

This commit is contained in:
Gael Guennebaud
2014-09-01 17:21:47 +02:00
parent b3d63b4db2
commit b051bbd64f
5 changed files with 55 additions and 26 deletions

View File

@@ -2,7 +2,7 @@
// for linear algebra.
//
// Copyright (C) 2012 Giacomo Po <gpo@ucla.edu>
// Copyright (C) 2011 Gael Guennebaud <gael.guennebaud@inria.fr>
// Copyright (C) 2011-2014 Gael Guennebaud <gael.guennebaud@inria.fr>
//
// This Source Code Form is subject to the terms of the Mozilla
// Public License v. 2.0. If a copy of the MPL was not distributed
@@ -217,6 +217,7 @@ namespace Eigen {
using Base::m_info;
using Base::m_isInitialized;
public:
using Base::_solve_impl;
typedef _MatrixType MatrixType;
typedef typename MatrixType::Scalar Scalar;
typedef typename MatrixType::Index Index;
@@ -244,7 +245,8 @@ namespace Eigen {
/** Destructor. */
~MINRES(){}
#ifndef EIGEN_TEST_EVALUATORS
/** \returns the solution x of \f$ A x = b \f$ using the current decomposition of A
* \a x0 as an initial solution.
*
@@ -260,10 +262,11 @@ namespace Eigen {
return internal::solve_retval_with_guess
<MINRES, Rhs, Guess>(*this, b.derived(), x0);
}
#endif
/** \internal */
template<typename Rhs,typename Dest>
void _solveWithGuess(const Rhs& b, Dest& x) const
void _solve_with_guess_impl(const Rhs& b, Dest& x) const
{
m_iterations = Base::maxIterations();
m_error = Base::m_tolerance;
@@ -284,16 +287,17 @@ namespace Eigen {
/** \internal */
template<typename Rhs,typename Dest>
void _solve(const Rhs& b, Dest& x) const
void _solve_impl(const Rhs& b, MatrixBase<Dest> &x) const
{
x.setZero();
_solveWithGuess(b,x);
_solve_with_guess_impl(b,x.derived());
}
protected:
};
#ifndef EIGEN_TEST_EVALUATORS
namespace internal {
template<typename _MatrixType, int _UpLo, typename _Preconditioner, typename Rhs>
@@ -305,12 +309,13 @@ namespace Eigen {
template<typename Dest> void evalTo(Dest& dst) const
{
dec()._solve(rhs(),dst);
dec()._solve_impl(rhs(),dst);
}
};
} // end namespace internal
#endif
} // end namespace Eigen
#endif // EIGEN_MINRES_H