Commit 287351ea by Justin Carpentier

### core: rename MapNumpy into NumpyMap

parent eb920acc
 ... @@ -96,10 +96,10 @@ namespace eigenpy ... @@ -96,10 +96,10 @@ namespace eigenpy } // namespace details } // namespace details #define EIGENPY_CAST_FROM_PYARRAY_TO_EIGEN_MATRIX(MatType,Scalar,NewScalar,pyArray,mat) \ #define EIGENPY_CAST_FROM_PYARRAY_TO_EIGEN_MATRIX(MatType,Scalar,NewScalar,pyArray,mat) \ details::cast_matrix_or_array::run(MapNumpy::map(pyArray),mat) details::cast_matrix_or_array::run(NumpyMap::map(pyArray),mat) #define EIGENPY_CAST_FROM_EIGEN_MATRIX_TO_PYARRAY(MatType,Scalar,NewScalar,mat,pyArray) \ #define EIGENPY_CAST_FROM_EIGEN_MATRIX_TO_PYARRAY(MatType,Scalar,NewScalar,mat,pyArray) \ details::cast_matrix_or_array::run(mat,MapNumpy::map(pyArray)) details::cast_matrix_or_array::run(mat,NumpyMap::map(pyArray)) template template struct EigenAllocator struct EigenAllocator ... @@ -117,7 +117,7 @@ namespace eigenpy ... @@ -117,7 +117,7 @@ namespace eigenpy const int pyArray_Type = EIGENPY_GET_PY_ARRAY_TYPE(pyArray); const int pyArray_Type = EIGENPY_GET_PY_ARRAY_TYPE(pyArray); if(pyArray_Type == NumpyEquivalentType::type_code) if(pyArray_Type == NumpyEquivalentType::type_code) { { mat = MapNumpy::map(pyArray); // avoid useless cast mat = NumpyMap::map(pyArray); // avoid useless cast return; return; } } ... @@ -160,11 +160,11 @@ namespace eigenpy ... @@ -160,11 +160,11 @@ namespace eigenpy const MatrixDerived & mat = const_cast(mat_.derived()); const MatrixDerived & mat = const_cast(mat_.derived()); const int pyArray_Type = EIGENPY_GET_PY_ARRAY_TYPE(pyArray); const int pyArray_Type = EIGENPY_GET_PY_ARRAY_TYPE(pyArray); typedef typename MapNumpy::EigenMap MapType; typedef typename NumpyMap::EigenMap MapType; if(pyArray_Type == NumpyEquivalentType::type_code) // no cast needed if(pyArray_Type == NumpyEquivalentType::type_code) // no cast needed { { MapType map_pyArray = MapNumpy::map(pyArray); MapType map_pyArray = NumpyMap::map(pyArray); if(mat.rows() == map_pyArray.rows()) if(mat.rows() == map_pyArray.rows()) map_pyArray = mat; map_pyArray = mat; else else ... @@ -248,7 +248,7 @@ namespace eigenpy ... @@ -248,7 +248,7 @@ namespace eigenpy RefType & mat = *reinterpret_cast(raw_ptr); RefType & mat = *reinterpret_cast(raw_ptr); if(pyArray_Type == NumpyEquivalentType::type_code) if(pyArray_Type == NumpyEquivalentType::type_code) { { mat = MapNumpy::map(pyArray); // avoid useless cast mat = NumpyMap::map(pyArray); // avoid useless cast return; return; } } ... @@ -285,7 +285,7 @@ namespace eigenpy ... @@ -285,7 +285,7 @@ namespace eigenpy else else { { assert(pyArray_Type == NumpyEquivalentType::type_code); assert(pyArray_Type == NumpyEquivalentType::type_code); typename MapNumpy::EigenMap numpyMap = MapNumpy::map(pyArray); typename NumpyMap::EigenMap numpyMap = NumpyMap::map(pyArray); RefType mat_ref(numpyMap); RefType mat_ref(numpyMap); new (raw_ptr) StorageType(mat_ref,pyArray); new (raw_ptr) StorageType(mat_ref,pyArray); } } ... @@ -340,7 +340,7 @@ namespace eigenpy ... @@ -340,7 +340,7 @@ namespace eigenpy MatType & mat = *mat_ptr; MatType & mat = *mat_ptr; if(pyArray_Type == NumpyEquivalentType::type_code) if(pyArray_Type == NumpyEquivalentType::type_code) { { mat = MapNumpy::map(pyArray); // avoid useless cast mat = NumpyMap::map(pyArray); // avoid useless cast return; return; } } ... @@ -377,7 +377,7 @@ namespace eigenpy ... @@ -377,7 +377,7 @@ namespace eigenpy else else { { assert(pyArray_Type == NumpyEquivalentType::type_code); assert(pyArray_Type == NumpyEquivalentType::type_code); typename MapNumpy::EigenMap numpyMap = MapNumpy::map(pyArray); typename NumpyMap::EigenMap numpyMap = NumpyMap::map(pyArray); RefType mat_ref(numpyMap); RefType mat_ref(numpyMap); new (raw_ptr) StorageType(mat_ref,pyArray); new (raw_ptr) StorageType(mat_ref,pyArray); } } ... @@ -397,7 +397,7 @@ namespace eigenpy ... @@ -397,7 +397,7 @@ namespace eigenpy static void allocate(PyArrayObject * pyArray, void * storage) static void allocate(PyArrayObject * pyArray, void * storage) { { typename MapNumpy::EigenMap numpyMap = MapNumpy::map(pyArray); typename NumpyMap::EigenMap numpyMap = NumpyMap::map(pyArray); new (storage) Type(numpyMap); new (storage) Type(numpyMap); } } ... ...
 ... @@ -13,13 +13,13 @@ ... @@ -13,13 +13,13 @@ namespace eigenpy namespace eigenpy { { template template struct MapNumpyTraits {}; struct NumpyMapTraits {}; /* Wrap a numpy::array with an Eigen::Map. No memory copy. */ /* Wrap a numpy::array with an Eigen::Map. No memory copy. */ template::type> template::type> struct MapNumpy struct NumpyMap { { typedef MapNumpyTraits Impl; typedef NumpyMapTraits Impl; typedef typename Impl::EigenMap EigenMap; typedef typename Impl::EigenMap EigenMap; static EigenMap map(PyArrayObject* pyArray); static EigenMap map(PyArrayObject* pyArray); ... @@ -34,7 +34,7 @@ namespace eigenpy ... @@ -34,7 +34,7 @@ namespace eigenpy namespace eigenpy namespace eigenpy { { template template struct MapNumpyTraits struct NumpyMapTraits { { typedef Eigen::Matrix EquivalentInputMatrixType; typedef Eigen::Matrix EquivalentInputMatrixType; typedef Eigen::Map EigenMap; typedef Eigen::Map EigenMap; ... @@ -108,7 +108,7 @@ namespace eigenpy ... @@ -108,7 +108,7 @@ namespace eigenpy }; }; template template struct MapNumpyTraits struct NumpyMapTraits { { typedef Eigen::Matrix EquivalentInputMatrixType; typedef Eigen::Matrix EquivalentInputMatrixType; typedef Eigen::Map EigenMap; typedef Eigen::Map EigenMap; ... @@ -140,8 +140,8 @@ namespace eigenpy ... @@ -140,8 +140,8 @@ namespace eigenpy }; }; template template typename MapNumpy::EigenMap typename NumpyMap::EigenMap MapNumpy::map(PyArrayObject * pyArray) NumpyMap::map(PyArrayObject * pyArray) { { return Impl::mapImpl(pyArray); return Impl::mapImpl(pyArray); } } ... ...
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!