aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/PaStiXSupport/PaStiXSupport.h
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2014-09-01 15:00:19 +0200
committerGravatar Gael Guennebaud <g.gael@free.fr>2014-09-01 15:00:19 +0200
commit85c765957418cd2fd24b46ca3a14e6fcbad43f05 (patch)
tree01111ad07068a8d03fab51c277e0026de2a441cb /Eigen/src/PaStiXSupport/PaStiXSupport.h
parentbc065c75d2a8df928cb368d0352b8fcb25791fa8 (diff)
Refactoring of sparse solvers through a SparseSolverBase class and usage of the Solve<> expression. Introduce a SolveWithGuess expression on top of Solve.
Diffstat (limited to 'Eigen/src/PaStiXSupport/PaStiXSupport.h')
-rw-r--r--Eigen/src/PaStiXSupport/PaStiXSupport.h32
1 files changed, 17 insertions, 15 deletions
diff --git a/Eigen/src/PaStiXSupport/PaStiXSupport.h b/Eigen/src/PaStiXSupport/PaStiXSupport.h
index 8a546dc2f..0dc5c6a6f 100644
--- a/Eigen/src/PaStiXSupport/PaStiXSupport.h
+++ b/Eigen/src/PaStiXSupport/PaStiXSupport.h
@@ -125,9 +125,15 @@ namespace internal
// This is the base class to interface with PaStiX functions.
// Users should not used this class directly.
template <class Derived>
-class PastixBase : internal::noncopyable
+class PastixBase : public SparseSolverBase<Derived>
{
+ protected:
+ typedef SparseSolverBase<Derived> Base;
+ using Base::derived;
+ using Base::m_isInitialized;
public:
+ using Base::_solve_impl;
+
typedef typename internal::pastix_traits<Derived>::MatrixType _MatrixType;
typedef _MatrixType MatrixType;
typedef typename MatrixType::Scalar Scalar;
@@ -138,7 +144,7 @@ class PastixBase : internal::noncopyable
public:
- PastixBase() : m_initisOk(false), m_analysisIsOk(false), m_factorizationIsOk(false), m_isInitialized(false), m_pastixdata(0), m_size(0)
+ PastixBase() : m_initisOk(false), m_analysisIsOk(false), m_factorizationIsOk(false), m_pastixdata(0), m_size(0)
{
init();
}
@@ -148,6 +154,7 @@ class PastixBase : internal::noncopyable
clean();
}
+#ifndef EIGEN_TEST_EVALUATORS
/** \returns the solution x of \f$ A x = b \f$ using the current decomposition of A.
*
* \sa compute()
@@ -161,19 +168,11 @@ class PastixBase : internal::noncopyable
&& "PastixBase::solve(): invalid number of rows of the right hand side matrix b");
return internal::solve_retval<PastixBase, Rhs>(*this, b.derived());
}
+#endif
template<typename Rhs,typename Dest>
- bool _solve (const MatrixBase<Rhs> &b, MatrixBase<Dest> &x) const;
+ bool _solve_impl(const MatrixBase<Rhs> &b, MatrixBase<Dest> &x) const;
- Derived& derived()
- {
- return *static_cast<Derived*>(this);
- }
- const Derived& derived() const
- {
- return *static_cast<const Derived*>(this);
- }
-
/** Returns a reference to the integer vector IPARM of PaStiX parameters
* to modify the default parameters.
* The statistics related to the different phases of factorization and solve are saved here as well
@@ -228,6 +227,7 @@ class PastixBase : internal::noncopyable
return m_info;
}
+#ifndef EIGEN_TEST_EVALUATORS
/** \returns the solution x of \f$ A x = b \f$ using the current decomposition of A.
*
* \sa compute()
@@ -241,6 +241,7 @@ class PastixBase : internal::noncopyable
&& "PastixBase::solve(): invalid number of rows of the right hand side matrix b");
return internal::sparse_solve_retval<PastixBase, Rhs>(*this, b.derived());
}
+#endif // EIGEN_TEST_EVALUATORS
protected:
@@ -268,7 +269,6 @@ class PastixBase : internal::noncopyable
int m_initisOk;
int m_analysisIsOk;
int m_factorizationIsOk;
- bool m_isInitialized;
mutable ComputationInfo m_info;
mutable pastix_data_t *m_pastixdata; // Data structure for pastix
mutable int m_comm; // The MPI communicator identifier
@@ -393,7 +393,7 @@ void PastixBase<Derived>::factorize(ColSpMatrix& mat)
/* Solve the system */
template<typename Base>
template<typename Rhs,typename Dest>
-bool PastixBase<Base>::_solve (const MatrixBase<Rhs> &b, MatrixBase<Dest> &x) const
+bool PastixBase<Base>::_solve_impl(const MatrixBase<Rhs> &b, MatrixBase<Dest> &x) const
{
eigen_assert(m_isInitialized && "The matrix should be factorized first");
EIGEN_STATIC_ASSERT((Dest::Flags&RowMajorBit)==0,
@@ -694,6 +694,7 @@ class PastixLDLT : public PastixBase< PastixLDLT<_MatrixType, _UpLo> >
}
};
+#ifndef EIGEN_TEST_EVALUATORS
namespace internal {
template<typename _MatrixType, typename Rhs>
@@ -705,7 +706,7 @@ struct solve_retval<PastixBase<_MatrixType>, Rhs>
template<typename Dest> void evalTo(Dest& dst) const
{
- dec()._solve(rhs(),dst);
+ dec()._solve_impl(rhs(),dst);
}
};
@@ -723,6 +724,7 @@ struct sparse_solve_retval<PastixBase<_MatrixType>, Rhs>
};
} // end namespace internal
+#endif // EIGEN_TEST_EVALUATORS
} // end namespace Eigen