From 702336f1ec3901574ba005689bf5ed49ec558d2c Mon Sep 17 00:00:00 2001 From: Justin Carpentier Date: Sun, 28 Sep 2025 09:42:05 +0200 Subject: [PATCH 1/8] cmake: sync submodule --- cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake b/cmake index 3632eb9e..34ded94e 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit 3632eb9ed43e29d7acbc5b35d30c9b2aee801702 +Subproject commit 34ded94e5d33ce56746abb4898b4ccc6dc69bfe8 From f694eb377e00dbcb819dbc1e90c47234793cac8a Mon Sep 17 00:00:00 2001 From: Justin Carpentier Date: Sun, 28 Sep 2025 09:42:43 +0200 Subject: [PATCH 2/8] core: fix copyright --- include/eigenpy/std-vector.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/eigenpy/std-vector.hpp b/include/eigenpy/std-vector.hpp index 278f942f..9b09f90d 100644 --- a/include/eigenpy/std-vector.hpp +++ b/include/eigenpy/std-vector.hpp @@ -1,6 +1,6 @@ /// -/// Copyright (c) 2016-2024 CNRS INRIA -/// Copyright (c) 2025-2025 Heriot-Watt University +/// Copyright (c) 2016-2025 CNRS INRIA +/// Copyright (c) 2025 Heriot-Watt University /// This file was taken from Pinocchio (header /// ) /// From ba38116f8116688d661bf95dd94ce53d0bb5533f Mon Sep 17 00:00:00 2001 From: Justin Carpentier Date: Sun, 28 Sep 2025 09:43:02 +0200 Subject: [PATCH 3/8] core: fix usage of shorten namespace bp --- include/eigenpy/std-vector.hpp | 36 +++++++++++++++------------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/include/eigenpy/std-vector.hpp b/include/eigenpy/std-vector.hpp index 9b09f90d..ff41a0c1 100644 --- a/include/eigenpy/std-vector.hpp +++ b/include/eigenpy/std-vector.hpp @@ -53,7 +53,7 @@ bool from_python_list(PyObject *obj_ptr, T *) { template struct build_list { - static ::boost::python::list run(vector_type &vec, const bool deep_copy) { + static bp::list run(vector_type &vec, const bool deep_copy) { if (deep_copy) return build_list::run(vec, true); bp::list bp_list; @@ -66,7 +66,7 @@ struct build_list { template struct build_list { - static ::boost::python::list run(vector_type &vec, const bool) { + static bp::list run(vector_type &vec, const bool) { typedef bp::iterator iterator; return bp::list(iterator()(vec)); } @@ -77,8 +77,7 @@ struct build_list { /// them. template struct overload_base_get_item_for_std_vector - : public boost::python::def_visitor< - overload_base_get_item_for_std_vector> { + : public bp::def_visitor> { typedef typename Container::value_type value_type; typedef typename Container::value_type data_type; typedef size_t index_type; @@ -92,8 +91,8 @@ struct overload_base_get_item_for_std_vector } private: - static boost::python::object base_get_item_int( - boost::python::back_reference container, PyObject *i_) { + static bp::object base_get_item_int(bp::back_reference container, + PyObject *i_) { index_type idx = convert_index(container.get(), i_); typename Container::iterator i = container.get().begin(); std::advance(i, idx); @@ -108,9 +107,8 @@ struct overload_base_get_item_for_std_vector return bp::object(bp::handle<>(convert(*i))); } - static boost::python::object base_get_item_slice( - boost::python::back_reference container, - boost::python::slice slice) { + static bp::object base_get_item_slice( + bp::back_reference container, bp::slice slice) { bp::list out; try { auto rng = @@ -225,7 +223,7 @@ struct extract_to_eigen_ref extract_to_eigen_ref(api::object const &o) : base(o.ptr()) {} }; -/// \brief Specialization of the boost::python::extract struct for references to +/// \brief Specialization of the bp::extract struct for references to /// Eigen matrix objects. template @@ -366,9 +364,8 @@ struct StdContainerFromPythonList { /// \brief Allocate the std::vector and fill it with the element contained in /// the list - static void construct( - PyObject *obj_ptr, - boost::python::converter::rvalue_from_python_stage1_data *memory) { + static void construct(PyObject *obj_ptr, + bp::converter::rvalue_from_python_stage1_data *memory) { // Extract the list bp::object bp_obj(bp::handle<>(bp::borrowed(obj_ptr))); bp::list bp_list(bp_obj); @@ -389,12 +386,11 @@ struct StdContainerFromPythonList { } static void register_converter() { - ::boost::python::converter::registry::push_back( - &convertible, &construct, ::boost::python::type_id()); + bp::converter::registry::push_back(&convertible, &construct, + bp::type_id()); } - static ::boost::python::list tolist(vector_type &self, - const bool deep_copy = false) { + static bp::list tolist(vector_type &self, const bool deep_copy = false) { return details::build_list::run(self, deep_copy); } }; @@ -428,7 +424,7 @@ struct contains_algo { template struct contains_vector_derived_policies - : public ::boost::python::vector_indexing_suite< + : public bp::vector_indexing_suite< Container, NoProxy, contains_vector_derived_policies> { typedef typename Container::value_type key_type; @@ -445,7 +441,7 @@ struct contains_vector_derived_policies /// template struct ExposeStdMethodToStdVector - : public boost::python::def_visitor< + : public bp::def_visitor< ExposeStdMethodToStdVector> { typedef StdContainerFromPythonList FromPythonListConverter; @@ -533,7 +529,7 @@ struct StdVectorPythonVisitor { cl.def(IdVisitor()); // Standard vector indexing definition - boost::python::vector_indexing_suite< + bp::vector_indexing_suite< vector_type, NoProxy, internal::contains_vector_derived_policies> vector_indexing; From 0bb71c7da9c297a334f2de419df13ba2c7a67312 Mon Sep 17 00:00:00 2001 From: Justin Carpentier Date: Sun, 28 Sep 2025 09:43:36 +0200 Subject: [PATCH 4/8] decompositions: fix compatibility issus with Eigen > 4 --- include/eigenpy/decompositions/GeneralizedEigenSolver.hpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/eigenpy/decompositions/GeneralizedEigenSolver.hpp b/include/eigenpy/decompositions/GeneralizedEigenSolver.hpp index 25547098..a579da65 100644 --- a/include/eigenpy/decompositions/GeneralizedEigenSolver.hpp +++ b/include/eigenpy/decompositions/GeneralizedEigenSolver.hpp @@ -40,9 +40,11 @@ struct GeneralizedEigenSolverVisitor "Returns the computed generalized eigenvalues.") .def("alphas", &Solver::alphas, bp::arg("self"), - "Returns the vectors containing the alpha values. ") + "Returns the vectors containing the alpha values. ", + bp::return_value_policy()) .def("betas", &Solver::betas, bp::arg("self"), - "Returns the vectors containing the beta values. ") + "Returns the vectors containing the beta values. ", + bp::return_value_policy()) .def("compute", &GeneralizedEigenSolverVisitor::compute_proxy, From 67d2ad09f56627c2cfb860d30f6df872f77d89c8 Mon Sep 17 00:00:00 2001 From: Justin Carpentier Date: Sun, 28 Sep 2025 09:45:13 +0200 Subject: [PATCH 5/8] changelog: update --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e658fa1..9b79f849 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Added - Support for Python slice, tuple and list indexing for `std::vector` bindings ([#592](https://github.com/stack-of-tasks/eigenpy/pull/592)) +### Fixed +- Fix partly the support of change of API of GeneralizedEigenSolverVisitor ([]()) + ## [3.12.0] - 2025-08-12 ### Added From dd0098612645b71dda7ae5932afe41022570ba4d Mon Sep 17 00:00:00 2001 From: Justin Carpentier Date: Sun, 28 Sep 2025 10:08:25 +0200 Subject: [PATCH 6/8] container/vector: reduce code redudancy --- include/eigenpy/std-vector.hpp | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/include/eigenpy/std-vector.hpp b/include/eigenpy/std-vector.hpp index ff41a0c1..6b58b24e 100644 --- a/include/eigenpy/std-vector.hpp +++ b/include/eigenpy/std-vector.hpp @@ -86,8 +86,8 @@ struct overload_base_get_item_for_std_vector void visit(Class &cl) const { cl.def("__getitem__", &base_get_item_int) .def("__getitem__", &base_get_item_slice) - .def("__getitem__", &base_get_item_list) - .def("__getitem__", &base_get_item_tuple); + .def("__getitem__", &base_get_item_list_or_tuple) + .def("__getitem__", &base_get_item_list_or_tuple); } private: @@ -132,25 +132,9 @@ struct overload_base_get_item_for_std_vector return out; } - static bp::object base_get_item_list(bp::back_reference c, - bp::list idxs) { - const Py_ssize_t m = bp::len(idxs); - bp::list out; - for (Py_ssize_t k = 0; k < m; ++k) { - bp::object obj = idxs[k]; - bp::extract ei(obj); - if (!ei.check()) { - PyErr_SetString(PyExc_TypeError, "indices must be integers"); - bp::throw_error_already_set(); - } - auto idx = normalize_index(c.get().size(), ei()); - out.append(elem_ref(c.get(), idx)); - } - return out; - } - - static bp::object base_get_item_tuple(bp::back_reference c, - bp::tuple idxs) { + template + static bp::object base_get_item_list_or_tuple( + bp::back_reference c, list_or_tuple idxs) { const Py_ssize_t m = bp::len(idxs); bp::list out; for (Py_ssize_t k = 0; k < m; ++k) { From 1c1caffd214e2d24bc5f271c907e806558286890 Mon Sep 17 00:00:00 2001 From: Justin Carpentier Date: Sun, 28 Sep 2025 10:10:03 +0200 Subject: [PATCH 7/8] container/vector: fix error message --- include/eigenpy/std-vector.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/eigenpy/std-vector.hpp b/include/eigenpy/std-vector.hpp index 6b58b24e..d6f86c37 100644 --- a/include/eigenpy/std-vector.hpp +++ b/include/eigenpy/std-vector.hpp @@ -141,7 +141,7 @@ struct overload_base_get_item_for_std_vector bp::object obj = idxs[k]; bp::extract ei(obj); if (!ei.check()) { - PyErr_SetString(PyExc_TypeError, "indices must be integers"); + PyErr_SetString(PyExc_TypeError, "Indices must be integers"); bp::throw_error_already_set(); } auto idx = normalize_index(c.get().size(), ei()); @@ -154,7 +154,7 @@ struct overload_base_get_item_for_std_vector long idx = i; if (idx < 0) idx += static_cast(n); if (idx < 0 || idx >= static_cast(n)) { - PyErr_SetString(PyExc_IndexError, "index out of range"); + PyErr_SetString(PyExc_IndexError, "Index out of range"); bp::throw_error_already_set(); } return static_cast(idx); From 36bd9e4c37c16ca54168af7adf61a794f2e8d26c Mon Sep 17 00:00:00 2001 From: Justin Carpentier Date: Sun, 28 Sep 2025 17:13:25 +0200 Subject: [PATCH 8/8] changelog: sync link --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b79f849..ebe0519e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Support for Python slice, tuple and list indexing for `std::vector` bindings ([#592](https://github.com/stack-of-tasks/eigenpy/pull/592)) ### Fixed -- Fix partly the support of change of API of GeneralizedEigenSolverVisitor ([]()) +- Fix partly the support of the change of API of GeneralizedEigenSolver in Eigen 5+ ([#594](https://github.com/stack-of-tasks/eigenpy/pull/594)) ## [3.12.0] - 2025-08-12