diff --git a/src/details.hpp b/src/details.hpp index 6fe8295d21b6b1109963cf1ef6d0dc217012300d..f99467fc6593eb6fc61e2f0010bd8b7c26a0a43f 100644 --- a/src/details.hpp +++ b/src/details.hpp @@ -85,6 +85,7 @@ namespace eigenpy } }; +#if EIGEN_VERSION_AT_LEAST(3,2,0) template<typename MatType> struct EigenObjectAllocator< eigenpy::Ref<MatType> > { @@ -101,6 +102,7 @@ namespace eigenpy MapNumpy<MatType>::map(pyArray) = mat; } }; +#endif /* --- TO PYTHON -------------------------------------------------------------- */ template<typename MatType> diff --git a/src/eigenpy.hpp b/src/eigenpy.hpp index 9fcecc7ce29815f09f02791c2228e889ee26e886..8ecf798f9a43a5eaf4266f647f66ef37a140b7de 100644 --- a/src/eigenpy.hpp +++ b/src/eigenpy.hpp @@ -19,12 +19,20 @@ #include "eigenpy/fwd.hpp" #include "eigenpy/deprecated.hh" +#if EIGEN_VERSION_AT_LEAST(3,2,0) #include "eigenpy/ref.hpp" #define ENABLE_SPECIFIC_MATRIX_TYPE(TYPE) \ enableEigenPySpecific<TYPE>(); \ enableEigenPySpecific< eigenpy::Ref<TYPE> >(); +#else + +#define ENABLE_SPECIFIC_MATRIX_TYPE(TYPE) \ + enableEigenPySpecific<TYPE>(); + +#endif + namespace eigenpy { /* Enable Eigen-Numpy serialization for a set of standard MatrixBase instance. */ diff --git a/src/solvers/preconditioners.cpp b/src/solvers/preconditioners.cpp index fb2f2e35a519b1ac4d3d788f5ba36aa99dd7f226..1854170f72fd67855aad03049b8755391ce08ff1 100644 --- a/src/solvers/preconditioners.cpp +++ b/src/solvers/preconditioners.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2017, Justin Carpentier, LAAS-CNRS + * Copyright 2017-2018, Justin Carpentier, LAAS-CNRS * * This file is part of eigenpy. * eigenpy is free software: you can redistribute it and/or @@ -14,12 +14,16 @@ * with eigenpy. If not, see <http://www.gnu.org/licenses/>. */ +#include <Eigen/Core> + +#if EIGEN_VERSION_AT_LEAST(3,2,0) #include "eigenpy/solvers/preconditioners.hpp" #include "eigenpy/solvers/BasicPreconditioners.hpp" //#include "eigenpy/solvers/BFGSPreconditioners.hpp" namespace eigenpy { + void exposePreconditioners() { using namespace Eigen; @@ -32,4 +36,8 @@ namespace eigenpy // LimitedBFGSPreconditionerBaseVisitor< LimitedBFGSPreconditioner<double,Eigen::Dynamic,Eigen::Upper|Eigen::Lower> >::expose("LimitedBFGSPreconditioner"); } + } // namespace eigenpy + +#endif + diff --git a/src/solvers/solvers.cpp b/src/solvers/solvers.cpp index d0d7103ff29dfd7ec872d324655d3fd513c9338a..8a30217ddd9fb2854049f9f501afb0e356272cef 100644 --- a/src/solvers/solvers.cpp +++ b/src/solvers/solvers.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2017, Justin Carpentier, LAAS-CNRS + * Copyright 2017-2018, Justin Carpentier, LAAS-CNRS * * This file is part of eigenpy. * eigenpy is free software: you can redistribute it and/or @@ -14,6 +14,10 @@ * with eigenpy. If not, see <http://www.gnu.org/licenses/>. */ +#include <Eigen/Core> + +#if EIGEN_VERSION_AT_LEAST(3,2,0) + #include "eigenpy/solvers/solvers.hpp" #include "eigenpy/solvers/ConjugateGradient.hpp" @@ -43,3 +47,6 @@ namespace eigenpy ; } } // namespace eigenpy + +#endif + diff --git a/unittest/CMakeLists.txt b/unittest/CMakeLists.txt index 8b0a15c8e797fe03b9f4e25cf95299208dd87603..76a817fd5fe55e856ec54ab765096940f080aa11 100644 --- a/unittest/CMakeLists.txt +++ b/unittest/CMakeLists.txt @@ -40,5 +40,7 @@ ADD_CUSTOM_TARGET(check COMMAND ${CMAKE_CTEST_COMMAND}) ADD_LIB_UNIT_TEST(matrix "eigen3") ADD_LIB_UNIT_TEST(geometry "eigen3") -ADD_LIB_UNIT_TEST(ref "eigen3") +IF(NOT ${EIGEN3_VERSION} VERSION_LESS "3.2.0") + ADD_LIB_UNIT_TEST(ref "eigen3") +ENDIF()