diff --git a/include/eigenpy/utils/is-approx.hpp b/include/eigenpy/utils/is-approx.hpp index 7f82ffde1144abe694c414ecda119baff4a7fc9c..59d3064e9b4d616868d34171f1403aceb88cb5f5 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 11b35d5d838c8e26ce179eb70b945ad1336feaa9..075b819b90c8ae6e7e50d5db6162b6e8e440dc7f 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."); }