From d6539ff652aadb118cdcce8c6e1533966599bdd5 Mon Sep 17 00:00:00 2001 From: Justin Carpentier <justin.carpentier@inria.fr> Date: Thu, 18 Oct 2018 18:37:08 +0200 Subject: [PATCH] lib: expose the new switching features --- src/eigenpy.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/eigenpy.cpp b/src/eigenpy.cpp index dae15e9d..df38094a 100644 --- a/src/eigenpy.cpp +++ b/src/eigenpy.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018 LAAS-CNRS + * Copyright (c) 2015-2018 LAAS-CNRS, INRIA * * This file is part of eigenpy. * eigenpy is free software: you can redistribute it and/or @@ -19,11 +19,21 @@ namespace eigenpy { - /* Enable Eigen-Numpy serialization for a set of standard MatrixBase instance. */ + /* Enable Eigen-Numpy serialization for a set of standard MatrixBase instances. */ void enableEigenPy() { using namespace Eigen; Exception::registerException(); + + bp::def("setNumpyType",&PyMatrixType::setNumpyType, + bp::arg("Numpy type (np.ndarray or np.matrix)"), + "Change the type returned by the converters from an Eigen object."); + + bp::def("switchToNumpyArray",&PyMatrixType::switchToNumpyArray, + "Set the conversion from Eigen::Matrix to numpy.ndarray."); + + bp::def("switchToNumpyMatrix",&PyMatrixType::switchToNumpyMatrix, + "Set the conversion from Eigen::Matrix to numpy.matrix."); ENABLE_SPECIFIC_MATRIX_TYPE(MatrixXd); ENABLE_SPECIFIC_MATRIX_TYPE(Matrix2d); -- GitLab