From a29f6f85b695d98b00f50dc82940562b9f938050 Mon Sep 17 00:00:00 2001
From: Justin Carpentier <justin.carpentier@inria.fr>
Date: Thu, 20 Feb 2020 12:01:57 +0100
Subject: [PATCH] python: use original signature of is_approx

---
 include/eigenpy/utils/is-approx.hpp | 13 +++++++------
 python/main.cpp                     |  6 ++++--
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/include/eigenpy/utils/is-approx.hpp b/include/eigenpy/utils/is-approx.hpp
index 7f82ffde..59d3064e 100644
--- a/include/eigenpy/utils/is-approx.hpp
+++ b/include/eigenpy/utils/is-approx.hpp
@@ -1,6 +1,6 @@
 /*
-* Copyright 2020 INRIA
-*/
+ * Copyright 2020 INRIA
+ */
 
 #ifndef __eigenpy_utils_scalar_is_approx_hpp__
 #define __eigenpy_utils_scalar_is_approx_hpp__
@@ -10,15 +10,16 @@
 namespace eigenpy
 {
   template<typename MatrixType1, typename MatrixType2>
-  inline EIGEN_DONT_INLINE bool is_approx(const MatrixType1 & mat1,
-                                          const MatrixType2 & mat2,
+  inline EIGEN_DONT_INLINE bool is_approx(const Eigen::MatrixBase<MatrixType1> & mat1,
+                                          const Eigen::MatrixBase<MatrixType2> & mat2,
                                           const typename MatrixType1::Scalar & prec)
   {
-    return mat1.derived().isApprox(mat2.derived(),prec);
+    return mat1.isApprox(mat2,prec);
   }
 
   template<typename MatrixType1, typename MatrixType2>
-  inline bool is_approx(const MatrixType1 & mat1, const MatrixType2 & mat2)
+  inline EIGEN_DONT_INLINE bool is_approx(const Eigen::MatrixBase<MatrixType1> & mat1,
+                                          const Eigen::MatrixBase<MatrixType2> & mat2)
   {
     return is_approx(mat1,mat2,Eigen::NumTraits<typename MatrixType1::Scalar>::dummy_precision());
   }
diff --git a/python/main.cpp b/python/main.cpp
index 11b35d5d..075b819b 100644
--- a/python/main.cpp
+++ b/python/main.cpp
@@ -46,10 +46,12 @@ BOOST_PYTHON_MODULE(eigenpy)
   
   {
     using namespace Eigen;
-    bp::def("is_approx",(bool (*)(const MatrixXd &, const MatrixXd &, const double &))&is_approx<MatrixXd,MatrixXd>,
+    
+    bp::def("is_approx",(bool (*)(const Eigen::MatrixBase<MatrixXd> &, const Eigen::MatrixBase<MatrixXd> &, const double &))&is_approx<MatrixXd,MatrixXd>,
             bp::args("A","B","prec"),
             "Returns True if A is approximately equal to B, within the precision determined by prec.");
-    bp::def("is_approx",(bool (*)(const MatrixXd &, const MatrixXd &))&is_approx<MatrixXd,MatrixXd>,
+    
+    bp::def("is_approx",(bool (*)(const Eigen::MatrixBase<MatrixXd> &, const Eigen::MatrixBase<MatrixXd> &))&is_approx<MatrixXd,MatrixXd>,
             bp::args("A","B"),
             "Returns True if A is approximately equal to B.");
   }
-- 
GitLab