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 ...@@ -39,8 +39,10 @@ namespace eigenpy
cl cl
.def(bp::init<>("Default constructor")) .def(bp::init<>("Default constructor"))
.def(bp::init<MatrixType>(bp::arg("A"),"Initialize the preconditioner with matrix A for further Az=b solving.")) .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, .def("info",&Preconditioner::info,
"Returns success if the Preconditioner has been well initialized.") "Returns success if the Preconditioner has been well initialized.")
#endif
.def("solve",&solve,bp::arg("b"), .def("solve",&solve,bp::arg("b"),
"Returns the solution A * z = b where the preconditioner is an estimate of A^-1.") "Returns the solution A * z = b where the preconditioner is an estimate of A^-1.")
...@@ -91,6 +93,7 @@ namespace eigenpy ...@@ -91,6 +93,7 @@ namespace eigenpy
} }
}; };
#if EIGEN_VERSION_AT_LEAST(3,3,0)
template<typename Scalar> template<typename Scalar>
struct LeastSquareDiagonalPreconditionerVisitor : PreconditionerBaseVisitor<Eigen::LeastSquareDiagonalPreconditioner<Scalar> > struct LeastSquareDiagonalPreconditionerVisitor : PreconditionerBaseVisitor<Eigen::LeastSquareDiagonalPreconditioner<Scalar> >
{ {
...@@ -113,6 +116,7 @@ namespace eigenpy ...@@ -113,6 +116,7 @@ namespace eigenpy
} }
}; };
#endif
struct IdentityPreconditionerVisitor : PreconditionerBaseVisitor<Eigen::IdentityPreconditioner > struct IdentityPreconditionerVisitor : PreconditionerBaseVisitor<Eigen::IdentityPreconditioner >
{ {
......
...@@ -25,7 +25,9 @@ namespace eigenpy ...@@ -25,7 +25,9 @@ namespace eigenpy
using namespace Eigen; using namespace Eigen;
DiagonalPreconditionerVisitor<double>::expose(); DiagonalPreconditionerVisitor<double>::expose();
#if EIGEN_VERSION_AT_LEAST(3,3,0)
LeastSquareDiagonalPreconditionerVisitor<double>::expose(); LeastSquareDiagonalPreconditionerVisitor<double>::expose();
#endif
IdentityPreconditionerVisitor::expose(); IdentityPreconditionerVisitor::expose();
// LimitedBFGSPreconditionerBaseVisitor< LimitedBFGSPreconditioner<double,Eigen::Dynamic,Eigen::Upper|Eigen::Lower> >::expose("LimitedBFGSPreconditioner"); // LimitedBFGSPreconditionerBaseVisitor< LimitedBFGSPreconditioner<double,Eigen::Dynamic,Eigen::Upper|Eigen::Lower> >::expose("LimitedBFGSPreconditioner");
......
...@@ -16,7 +16,10 @@ ...@@ -16,7 +16,10 @@
#include "eigenpy/solvers/solvers.hpp" #include "eigenpy/solvers/solvers.hpp"
#include "eigenpy/solvers/ConjugateGradient.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 namespace eigenpy
{ {
...@@ -24,7 +27,9 @@ namespace eigenpy ...@@ -24,7 +27,9 @@ namespace eigenpy
{ {
using namespace Eigen; using namespace Eigen;
ConjugateGradientVisitor< ConjugateGradient<MatrixXd,Lower|Upper> >::expose(); ConjugateGradientVisitor< ConjugateGradient<MatrixXd,Lower|Upper> >::expose();
#if EIGEN_VERSION_AT_LEAST(3,3,0)
LeastSquaresConjugateGradientVisitor< LeastSquaresConjugateGradient<MatrixXd, LeastSquareDiagonalPreconditionerFix<MatrixXd::Scalar> > >::expose(); LeastSquaresConjugateGradientVisitor< LeastSquaresConjugateGradient<MatrixXd, LeastSquareDiagonalPreconditionerFix<MatrixXd::Scalar> > >::expose();
#endif
// Conjugate gradient with limited BFGS preconditioner // Conjugate gradient with limited BFGS preconditioner
ConjugateGradientVisitor< ConjugateGradient<MatrixXd,Lower|Upper,IdentityPreconditioner > >::expose("IdentityConjugateGradient"); 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