Skip to content

Commit 412720a

Browse files
committed
Fix compatibility with Eigen 3.0.5
1 parent aacde16 commit 412720a

File tree

5 files changed

+30
-3
lines changed

5 files changed

+30
-3
lines changed

src/details.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ namespace eigenpy
8585
}
8686
};
8787

88+
#if EIGEN_VERSION_AT_LEAST(3,2,0)
8889
template<typename MatType>
8990
struct EigenObjectAllocator< eigenpy::Ref<MatType> >
9091
{
@@ -101,6 +102,7 @@ namespace eigenpy
101102
MapNumpy<MatType>::map(pyArray) = mat;
102103
}
103104
};
105+
#endif
104106

105107
/* --- TO PYTHON -------------------------------------------------------------- */
106108
template<typename MatType>

src/eigenpy.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,20 @@
1919

2020
#include "eigenpy/fwd.hpp"
2121
#include "eigenpy/deprecated.hh"
22+
#if EIGEN_VERSION_AT_LEAST(3,2,0)
2223
#include "eigenpy/ref.hpp"
2324

2425
#define ENABLE_SPECIFIC_MATRIX_TYPE(TYPE) \
2526
enableEigenPySpecific<TYPE>(); \
2627
enableEigenPySpecific< eigenpy::Ref<TYPE> >();
2728

29+
#else
30+
31+
#define ENABLE_SPECIFIC_MATRIX_TYPE(TYPE) \
32+
enableEigenPySpecific<TYPE>();
33+
34+
#endif
35+
2836
namespace eigenpy
2937
{
3038
/* Enable Eigen-Numpy serialization for a set of standard MatrixBase instance. */

src/solvers/preconditioners.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2017, Justin Carpentier, LAAS-CNRS
2+
* Copyright 2017-2018, Justin Carpentier, LAAS-CNRS
33
*
44
* This file is part of eigenpy.
55
* eigenpy is free software: you can redistribute it and/or
@@ -14,12 +14,16 @@
1414
* with eigenpy. If not, see <http://www.gnu.org/licenses/>.
1515
*/
1616

17+
#include <Eigen/Core>
18+
19+
#if EIGEN_VERSION_AT_LEAST(3,2,0)
1720
#include "eigenpy/solvers/preconditioners.hpp"
1821
#include "eigenpy/solvers/BasicPreconditioners.hpp"
1922
//#include "eigenpy/solvers/BFGSPreconditioners.hpp"
2023

2124
namespace eigenpy
2225
{
26+
2327
void exposePreconditioners()
2428
{
2529
using namespace Eigen;
@@ -32,4 +36,8 @@ namespace eigenpy
3236
// LimitedBFGSPreconditionerBaseVisitor< LimitedBFGSPreconditioner<double,Eigen::Dynamic,Eigen::Upper|Eigen::Lower> >::expose("LimitedBFGSPreconditioner");
3337

3438
}
39+
3540
} // namespace eigenpy
41+
42+
#endif
43+

src/solvers/solvers.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2017, Justin Carpentier, LAAS-CNRS
2+
* Copyright 2017-2018, Justin Carpentier, LAAS-CNRS
33
*
44
* This file is part of eigenpy.
55
* eigenpy is free software: you can redistribute it and/or
@@ -14,6 +14,10 @@
1414
* with eigenpy. If not, see <http://www.gnu.org/licenses/>.
1515
*/
1616

17+
#include <Eigen/Core>
18+
19+
#if EIGEN_VERSION_AT_LEAST(3,2,0)
20+
1721
#include "eigenpy/solvers/solvers.hpp"
1822
#include "eigenpy/solvers/ConjugateGradient.hpp"
1923

@@ -43,3 +47,6 @@ namespace eigenpy
4347
;
4448
}
4549
} // namespace eigenpy
50+
51+
#endif
52+

unittest/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,7 @@ ADD_CUSTOM_TARGET(check COMMAND ${CMAKE_CTEST_COMMAND})
4040

4141
ADD_LIB_UNIT_TEST(matrix "eigen3")
4242
ADD_LIB_UNIT_TEST(geometry "eigen3")
43-
ADD_LIB_UNIT_TEST(ref "eigen3")
43+
IF(NOT ${EIGEN3_VERSION} VERSION_LESS "3.2.0")
44+
ADD_LIB_UNIT_TEST(ref "eigen3")
45+
ENDIF()
4446

0 commit comments

Comments
 (0)