diff --git a/CMakeLists.txt b/CMakeLists.txt
index b57443ed44f51563e59c78b9df024a72559af6d7..86250e5a6dfab92c94e6355b317f0a258c23a7a8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -98,6 +98,7 @@ SET(HEADERS
   registration.hpp
   angle-axis.hpp
   quaternion.hpp
+  stride.hpp
   ref.hpp
 )
 
diff --git a/src/map.hpp b/src/map.hpp
index 2a2fb4b27f72126db743c4e1ee94756125857660..c7414355db270b60f4b7a203fbd9685ea378e95c 100644
--- a/src/map.hpp
+++ b/src/map.hpp
@@ -17,6 +17,7 @@
 #include "eigenpy/fwd.hpp"
 #include <numpy/arrayobject.h>
 #include "eigenpy/exception.hpp"
+#include "eigenpy/stride.hpp"
 
 namespace eigenpy
 {
diff --git a/src/ref.hpp b/src/ref.hpp
index c651e1dd426f1eba0babeb4c01e7751c74f01d05..367bf0f8ae83af557db3ebd16ea6eacb4fd07216 100644
--- a/src/ref.hpp
+++ b/src/ref.hpp
@@ -18,6 +18,7 @@
 #define __eigenpy_ref_hpp__
 
 #include "eigenpy/fwd.hpp"
+#include "eigenpy/stride.hpp"
 
 // For old Eigen versions, EIGEN_DEVICE_FUNC is not defined.
 // We must define it just in the scope of this file.
@@ -27,18 +28,7 @@
 
 namespace eigenpy
 {
-  template<typename MatType, int IsVectorAtCompileTime = MatType::IsVectorAtCompileTime>
-  struct StrideType
-  {
-    typedef Eigen::Stride<Eigen::Dynamic,Eigen::Dynamic> type;
-  };
-  
-  template<typename MatType>
-  struct StrideType<MatType,1>
-  {
-    typedef Eigen::InnerStride<Eigen::Dynamic> type;
-  };
-  
+
   template<typename PlainObjectType>
   struct Ref : Eigen::Ref<PlainObjectType,EIGENPY_DEFAULT_ALIGNMENT_VALUE,typename StrideType<PlainObjectType>::type>
   {
diff --git a/src/stride.hpp b/src/stride.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..438b818aaf6e319b33185355ca833fa6dc21417d
--- /dev/null
+++ b/src/stride.hpp
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2018, Justin Carpentier <jcarpent@laas.fr>, LAAS-CNRS
+ *
+ * This file is part of eigenpy.
+ * eigenpy is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation, either version 3 of
+ * the License, or (at your option) any later version.
+ * eigenpy is distributed in the hope that it will be
+ * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.  You should
+ * have received a copy of the GNU Lesser General Public License along
+ * with eigenpy.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __eigenpy_stride_hpp__
+#define __eigenpy_stride_hpp__
+
+#include <Eigen/Core>
+
+namespace eigenpy
+{
+  template<typename MatType, int IsVectorAtCompileTime = MatType::IsVectorAtCompileTime>
+  struct StrideType
+  {
+    typedef Eigen::Stride<Eigen::Dynamic,Eigen::Dynamic> type;
+  };
+  
+  template<typename MatType>
+  struct StrideType<MatType,1>
+  {
+    typedef Eigen::InnerStride<Eigen::Dynamic> type;
+  };
+}
+
+#endif // ifndef __eigenpy_stride_hpp__