Skip to content
Snippets Groups Projects
Commit 71a329d1 authored by Wilson Jallet's avatar Wilson Jallet :clapper:
Browse files

numpy-allocator: extend row vector fix to const<EigenRef>

parent 1fe931f0
No related branches found
No related tags found
No related merge requests found
Pipeline #18579 passed with warnings
...@@ -135,10 +135,11 @@ struct NumpyAllocator<const Eigen::Ref<const MatType, Options, Stride> > { ...@@ -135,10 +135,11 @@ struct NumpyAllocator<const Eigen::Ref<const MatType, Options, Stride> > {
if (NumpyType::sharedMemory()) { if (NumpyType::sharedMemory()) {
const int Scalar_type_code = Register::getTypeCode<Scalar>(); const int Scalar_type_code = Register::getTypeCode<Scalar>();
Eigen::DenseIndex inner_stride = MatType::IsRowMajor ? mat.outerStride() const bool reverse_strides = MatType::IsRowMajor || (mat.rows() == 1);
: mat.innerStride(), Eigen::DenseIndex inner_stride = reverse_strides ? mat.outerStride()
outer_stride = MatType::IsRowMajor ? mat.innerStride() : mat.innerStride(),
: mat.outerStride(); outer_stride = reverse_strides ? mat.innerStride()
: mat.outerStride();
const int elsize = call_PyArray_DescrFromType(Scalar_type_code)->elsize; const int elsize = call_PyArray_DescrFromType(Scalar_type_code)->elsize;
npy_intp strides[2] = {elsize * inner_stride, elsize * outer_stride}; npy_intp strides[2] = {elsize * inner_stride, elsize * outer_stride};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment