From e6e1bf614a8187c4214bb6e8251fc3c86a23c138 Mon Sep 17 00:00:00 2001
From: Justin Carpentier <justin.carpentier@inria.fr>
Date: Wed, 2 Feb 2022 11:06:54 +0100
Subject: [PATCH] map: fix RowMajor case

---
 include/eigenpy/numpy-map.hpp | 24 ++++++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)

diff --git a/include/eigenpy/numpy-map.hpp b/include/eigenpy/numpy-map.hpp
index ed8d846..8aba094 100644
--- a/include/eigenpy/numpy-map.hpp
+++ b/include/eigenpy/numpy-map.hpp
@@ -82,16 +82,32 @@ namespace eigenpy
           rows = (int)PyArray_DIMS(pyArray)[0];
           cols = 1;
           
-          inner_stride = (int)PyArray_STRIDE(pyArray, 0) / (int)itemsize;
-          outer_stride = 0;
+          if(EquivalentInputMatrixType::IsRowMajor)
+          {
+            outer_stride = (int)PyArray_STRIDE(pyArray, 0) / (int)itemsize;
+            inner_stride = 0;
+          }
+          else
+          {
+            inner_stride = (int)PyArray_STRIDE(pyArray, 0) / (int)itemsize;
+            outer_stride = 0;
+          }
         }
         else
         {
           rows = 1;
           cols = (int)PyArray_DIMS(pyArray)[0];
           
-          inner_stride = 0;
-          outer_stride = (int)PyArray_STRIDE(pyArray, 0) / (int)itemsize;
+          if(EquivalentInputMatrixType::IsRowMajor)
+          {
+            inner_stride = (int)PyArray_STRIDE(pyArray, 0) / (int)itemsize;
+            outer_stride = 0;
+          }
+          else
+          {
+            inner_stride = 0;
+            outer_stride = (int)PyArray_STRIDE(pyArray, 0) / (int)itemsize;
+          }
         }
       }
       
-- 
GitLab