From 7235c40ab1104c8468d1c3d091f96aac9c7df232 Mon Sep 17 00:00:00 2001 From: Justin Carpentier <justin.carpentier@inria.fr> Date: Wed, 7 Dec 2022 19:26:32 +0100 Subject: [PATCH] core: add assert for future debugging --- include/eigenpy/numpy-map.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/eigenpy/numpy-map.hpp b/include/eigenpy/numpy-map.hpp index 51af11b1..ae6b1e69 100644 --- a/include/eigenpy/numpy-map.hpp +++ b/include/eigenpy/numpy-map.hpp @@ -161,7 +161,6 @@ struct NumpyMapTraits<MatType, InputScalar, AlignmentValue, Stride, true> { const int R = (int)PyArray_DIMS(pyArray)[rowMajor]; const long int itemsize = PyArray_ITEMSIZE(pyArray); const int stride = (int)PyArray_STRIDE(pyArray, rowMajor) / (int)itemsize; - ; if ((MatType::MaxSizeAtCompileTime != R) && (MatType::MaxSizeAtCompileTime != Eigen::Dynamic)) { @@ -171,6 +170,8 @@ struct NumpyMapTraits<MatType, InputScalar, AlignmentValue, Stride, true> { InputScalar* pyData = reinterpret_cast<InputScalar*>(PyArray_DATA(pyArray)); + assert(Stride(stride).inner() == stride && + "Stride should be a dynamic stride"); return EigenMap(pyData, R, Stride(stride)); } }; -- GitLab