Verified Commit 471b8d65 authored by Justin Carpentier's avatar Justin Carpentier
Browse files

core: handle RowMajor case for Eigen::Ref

parent a9653f10
Pipeline #18562 passed with stage
in 10 minutes and 44 seconds
......@@ -70,8 +70,11 @@ struct NumpyAllocator<Eigen::Ref<MatType, Options, Stride> > {
if (NumpyType::sharedMemory()) {
const int Scalar_type_code = Register::getTypeCode<Scalar>();
Eigen::DenseIndex inner_stride = mat.innerStride(),
outer_stride = mat.outerStride();
Eigen::DenseIndex inner_stride = MatType::IsRowMajor ? mat.outerStride()
: mat.innerStride(),
outer_stride = MatType::IsRowMajor ? mat.innerStride()
: mat.outerStride();
const int elsize = call_PyArray_DescrFromType(Scalar_type_code)->elsize;
npy_intp strides[2] = {elsize * inner_stride, elsize * outer_stride};
......@@ -131,8 +134,11 @@ struct NumpyAllocator<const Eigen::Ref<const MatType, Options, Stride> > {
if (NumpyType::sharedMemory()) {
const int Scalar_type_code = Register::getTypeCode<Scalar>();
Eigen::DenseIndex inner_stride = mat.innerStride(),
outer_stride = mat.outerStride();
Eigen::DenseIndex inner_stride = MatType::IsRowMajor ? mat.outerStride()
: mat.innerStride(),
outer_stride = MatType::IsRowMajor ? mat.innerStride()
: mat.outerStride();
const int elsize = call_PyArray_DescrFromType(Scalar_type_code)->elsize;
npy_intp strides[2] = {elsize * inner_stride, elsize * outer_stride};
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment