diff --git a/cmake b/cmake index d1340a9e0340c443e5e8841c7ab4a0997f989e59..a5c65a0ee51191be3f2e2667b95830706c211bb2 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit d1340a9e0340c443e5e8841c7ab4a0997f989e59 +Subproject commit a5c65a0ee51191be3f2e2667b95830706c211bb2 diff --git a/include/eigenpy/angle-axis.hpp b/include/eigenpy/angle-axis.hpp index 00b73c215402da322e44f176992cf8e63d9ec528..7957e480f9c12501f8a16004ac8dde03f8deb06d 100644 --- a/include/eigenpy/angle-axis.hpp +++ b/include/eigenpy/angle-axis.hpp @@ -1,12 +1,11 @@ /* - * Copyright 2014-2019, CNRS - * Copyright 2018-2019, INRIA + * Copyright 2014-2020 CNRS INRIA */ #ifndef __eigenpy_angle_axis_hpp__ #define __eigenpy_angle_axis_hpp__ -#include "eigenpy/fwd.hpp" +#include "eigenpy/eigenpy.hpp" #include <Eigen/Core> #include <Eigen/Geometry> diff --git a/include/eigenpy/decompositions/EigenSolver.hpp b/include/eigenpy/decompositions/EigenSolver.hpp index 0b20a8210aa0b8af53cda2ea3a65d882f8dccf53..36eb02949345d68c69e5e407501ca3e7df84506e 100644 --- a/include/eigenpy/decompositions/EigenSolver.hpp +++ b/include/eigenpy/decompositions/EigenSolver.hpp @@ -5,7 +5,8 @@ #ifndef __eigenpy_decomposition_eigen_solver_hpp__ #define __eigenpy_decomposition_eigen_solver_hpp__ -#include <boost/python.hpp> +#include "eigenpy/eigenpy.hpp" + #include <Eigen/Core> #include <Eigen/Eigenvalues> diff --git a/include/eigenpy/decompositions/LDLT.hpp b/include/eigenpy/decompositions/LDLT.hpp index 5a47bb899380c2863e2d9161510e90c285530be7..6e6b3e3d9b6812fb8a317beb91268f18ccc86066 100644 --- a/include/eigenpy/decompositions/LDLT.hpp +++ b/include/eigenpy/decompositions/LDLT.hpp @@ -5,7 +5,8 @@ #ifndef __eigenpy_decomposition_ldlt_hpp__ #define __eigenpy_decomposition_ldlt_hpp__ -#include <boost/python.hpp> +#include "eigenpy/eigenpy.hpp" + #include <Eigen/Core> #include <Eigen/Cholesky> diff --git a/include/eigenpy/decompositions/LLT.hpp b/include/eigenpy/decompositions/LLT.hpp index 569a2a72a8adc219aa8ac40c31ec29997e1cfbf9..f854aba368401fc869bb6845adde8c4d2f743ea3 100644 --- a/include/eigenpy/decompositions/LLT.hpp +++ b/include/eigenpy/decompositions/LLT.hpp @@ -5,7 +5,8 @@ #ifndef __eigenpy_decomposition_llt_hpp__ #define __eigenpy_decomposition_llt_hpp__ -#include <boost/python.hpp> +#include "eigenpy/eigenpy.hpp" + #include <Eigen/Core> #include <Eigen/Cholesky> diff --git a/include/eigenpy/decompositions/SelfAdjointEigenSolver.hpp b/include/eigenpy/decompositions/SelfAdjointEigenSolver.hpp index c400f8402e8f04b6aff553524e53a19eb8445e87..562ba0c5bca53c72f0b1eb79a8493b024ec01061 100644 --- a/include/eigenpy/decompositions/SelfAdjointEigenSolver.hpp +++ b/include/eigenpy/decompositions/SelfAdjointEigenSolver.hpp @@ -5,7 +5,8 @@ #ifndef __eigenpy_decomposition_self_adjoint_eigen_solver_hpp__ #define __eigenpy_decomposition_self_adjoint_eigen_solver_hpp__ -#include <boost/python.hpp> +#include "eigenpy/eigenpy.hpp" + #include <Eigen/Core> #include <Eigen/Eigenvalues> diff --git a/include/eigenpy/eigen-from-python.hpp b/include/eigenpy/eigen-from-python.hpp index f17ca6ed1fce7ad67e0eaac620653eb246242828..f74bdab603e09a929a195a70f129609a7efa0745 100644 --- a/include/eigenpy/eigen-from-python.hpp +++ b/include/eigenpy/eigen-from-python.hpp @@ -148,7 +148,7 @@ namespace boost { namespace python { namespace converter { } }; -#define RVALUE_FROM_PYTHON_DATA_INIT(type) \ +#define EIGENPY_RVALUE_FROM_PYTHON_DATA_INIT(type) \ typedef rvalue_from_python_data_eigen<type> Base; \ \ rvalue_from_python_data(rvalue_from_python_stage1_data const & _stage1) \ @@ -162,7 +162,7 @@ namespace boost { namespace python { namespace converter { struct rvalue_from_python_data<Eigen::MatrixBase<Derived> const &> : rvalue_from_python_data_eigen<Derived const &> { - RVALUE_FROM_PYTHON_DATA_INIT(Derived const &) + EIGENPY_RVALUE_FROM_PYTHON_DATA_INIT(Derived const &) }; /// \brief Template specialization of rvalue_from_python_data @@ -170,11 +170,9 @@ namespace boost { namespace python { namespace converter { struct rvalue_from_python_data<Eigen::EigenBase<Derived> const &> : rvalue_from_python_data_eigen<Derived const &> { - RVALUE_FROM_PYTHON_DATA_INIT(Derived const &) + EIGENPY_RVALUE_FROM_PYTHON_DATA_INIT(Derived const &) }; -#undef RVALUE_FROM_PYTHON_DATA_INIT - template<typename MatType, int Options, typename Stride> struct rvalue_from_python_data<Eigen::Ref<MatType,Options,Stride> &> : rvalue_from_python_storage<Eigen::Ref<MatType,Options,Stride> &> diff --git a/include/eigenpy/quaternion.hpp b/include/eigenpy/quaternion.hpp index f1e830893f427b6223b1ed281afe5e82878321c2..d1462f2e8c1c1c06ecd29ae01b57a19198899e08 100644 --- a/include/eigenpy/quaternion.hpp +++ b/include/eigenpy/quaternion.hpp @@ -1,18 +1,60 @@ /* - * Copyright 2014-2019, CNRS - * Copyright 2018-2019, INRIA + * Copyright 2014-2020 CNRS INRIA */ #ifndef __eigenpy_quaternion_hpp__ #define __eigenpy_quaternion_hpp__ -#include "eigenpy/fwd.hpp" +#include "eigenpy/eigenpy.hpp" #include <Eigen/Core> #include <Eigen/Geometry> #include "eigenpy/exception.hpp" +namespace boost { namespace python { namespace converter { + + /// \brief Template specialization of rvalue_from_python_data + template<typename Quaternion> + struct rvalue_from_python_data<Eigen::QuaternionBase<Quaternion> const &> + : rvalue_from_python_data_eigen<Quaternion const &> + { + EIGENPY_RVALUE_FROM_PYTHON_DATA_INIT(Quaternion const &) + }; + + template <class Quaternion> + struct implicit<Quaternion, Eigen::QuaternionBase<Quaternion> > + { + typedef Quaternion Source; + typedef Eigen::QuaternionBase<Quaternion> Target; + + static void* convertible(PyObject* obj) + { + // Find a converter which can produce a Source instance from + // obj. The user has told us that Source can be converted to + // Target, and instantiating construct() below, ensures that + // at compile-time. + return implicit_rvalue_convertible_from_python(obj, registered<Source>::converters) + ? obj : 0; + } + + static void construct(PyObject* obj, rvalue_from_python_stage1_data* data) + { + void* storage = ((rvalue_from_python_storage<Target>*)data)->storage.bytes; + + arg_from_python<Source> get_source(obj); + bool convertible = get_source.convertible(); + BOOST_VERIFY(convertible); + + new (storage) Source(get_source()); + + // record successful construction + data->convertible = storage; + } + }; + +}}} // namespace boost::python::converter + namespace eigenpy { @@ -267,7 +309,7 @@ namespace eigenpy // Cast to Eigen::QuaternionBase and vice-versa bp::implicitly_convertible<Quaternion,QuaternionBase >(); - bp::implicitly_convertible<QuaternionBase,Quaternion >(); +// bp::implicitly_convertible<QuaternionBase,Quaternion >(); } };