Skip to content
Snippets Groups Projects
Commit 54ad6aa2 authored by jcarpent's avatar jcarpent
Browse files

[All] Handle old version of Eigen

parent 5ade5701
No related branches found
No related tags found
No related merge requests found
......@@ -39,8 +39,10 @@ namespace eigenpy
cl
.def(bp::init<>("Default constructor"))
.def(bp::init<MatrixType>(bp::arg("A"),"Initialize the preconditioner with matrix A for further Az=b solving."))
#if EIGEN_VERSION_AT_LEAST(3,3,0)
.def("info",&Preconditioner::info,
"Returns success if the Preconditioner has been well initialized.")
#endif
.def("solve",&solve,bp::arg("b"),
"Returns the solution A * z = b where the preconditioner is an estimate of A^-1.")
......@@ -91,6 +93,7 @@ namespace eigenpy
}
};
#if EIGEN_VERSION_AT_LEAST(3,3,0)
template<typename Scalar>
struct LeastSquareDiagonalPreconditionerVisitor : PreconditionerBaseVisitor<Eigen::LeastSquareDiagonalPreconditioner<Scalar> >
{
......@@ -113,6 +116,7 @@ namespace eigenpy
}
};
#endif
struct IdentityPreconditionerVisitor : PreconditionerBaseVisitor<Eigen::IdentityPreconditioner >
{
......
......@@ -25,7 +25,9 @@ namespace eigenpy
using namespace Eigen;
DiagonalPreconditionerVisitor<double>::expose();
#if EIGEN_VERSION_AT_LEAST(3,3,0)
LeastSquareDiagonalPreconditionerVisitor<double>::expose();
#endif
IdentityPreconditionerVisitor::expose();
// LimitedBFGSPreconditionerBaseVisitor< LimitedBFGSPreconditioner<double,Eigen::Dynamic,Eigen::Upper|Eigen::Lower> >::expose("LimitedBFGSPreconditioner");
......
......@@ -16,7 +16,10 @@
#include "eigenpy/solvers/solvers.hpp"
#include "eigenpy/solvers/ConjugateGradient.hpp"
#include "eigenpy/solvers/LeastSquaresConjugateGradient.hpp"
#if EIGEN_VERSION_AT_LEAST(3,3,0)
#include "eigenpy/solvers/LeastSquaresConjugateGradient.hpp"
#endif
namespace eigenpy
{
......@@ -24,7 +27,9 @@ namespace eigenpy
{
using namespace Eigen;
ConjugateGradientVisitor< ConjugateGradient<MatrixXd,Lower|Upper> >::expose();
#if EIGEN_VERSION_AT_LEAST(3,3,0)
LeastSquaresConjugateGradientVisitor< LeastSquaresConjugateGradient<MatrixXd, LeastSquareDiagonalPreconditionerFix<MatrixXd::Scalar> > >::expose();
#endif
// Conjugate gradient with limited BFGS preconditioner
ConjugateGradientVisitor< ConjugateGradient<MatrixXd,Lower|Upper,IdentityPreconditioner > >::expose("IdentityConjugateGradient");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment