Skip to content

Commit e1075ed

Browse files
committed
core: fix checking of dimensions
1 parent 53c3c6a commit e1075ed

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

include/eigenpy/details.hpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,19 @@ namespace eigenpy
265265
}
266266
}
267267

268+
if (PyArray_NDIM(obj_ptr) == 2)
269+
{
270+
const int R = (int)PyArray_DIMS(obj_ptr)[0];
271+
const int C = (int)PyArray_DIMS(obj_ptr)[1];
272+
273+
if( (MatType::RowsAtCompileTime!=R)
274+
&& (MatType::RowsAtCompileTime!=Eigen::Dynamic) )
275+
return 0;
276+
if( (MatType::ColsAtCompileTime!=C)
277+
&& (MatType::ColsAtCompileTime!=Eigen::Dynamic) )
278+
return 0;
279+
}
280+
268281
// Check if the Scalar type of the obj_ptr is compatible with the Scalar type of MatType
269282
if ((PyArray_ObjectType(reinterpret_cast<PyObject *>(obj_ptr), 0)) == NPY_INT)
270283
{

0 commit comments

Comments
 (0)