Skip to content

Commit a29f6f8

Browse files
committed
python: use original signature of is_approx
1 parent b620c5b commit a29f6f8

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

include/eigenpy/utils/is-approx.hpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
2-
* Copyright 2020 INRIA
3-
*/
2+
* Copyright 2020 INRIA
3+
*/
44

55
#ifndef __eigenpy_utils_scalar_is_approx_hpp__
66
#define __eigenpy_utils_scalar_is_approx_hpp__
@@ -10,15 +10,16 @@
1010
namespace eigenpy
1111
{
1212
template<typename MatrixType1, typename MatrixType2>
13-
inline EIGEN_DONT_INLINE bool is_approx(const MatrixType1 & mat1,
14-
const MatrixType2 & mat2,
13+
inline EIGEN_DONT_INLINE bool is_approx(const Eigen::MatrixBase<MatrixType1> & mat1,
14+
const Eigen::MatrixBase<MatrixType2> & mat2,
1515
const typename MatrixType1::Scalar & prec)
1616
{
17-
return mat1.derived().isApprox(mat2.derived(),prec);
17+
return mat1.isApprox(mat2,prec);
1818
}
1919

2020
template<typename MatrixType1, typename MatrixType2>
21-
inline bool is_approx(const MatrixType1 & mat1, const MatrixType2 & mat2)
21+
inline EIGEN_DONT_INLINE bool is_approx(const Eigen::MatrixBase<MatrixType1> & mat1,
22+
const Eigen::MatrixBase<MatrixType2> & mat2)
2223
{
2324
return is_approx(mat1,mat2,Eigen::NumTraits<typename MatrixType1::Scalar>::dummy_precision());
2425
}

python/main.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,12 @@ BOOST_PYTHON_MODULE(eigenpy)
4646

4747
{
4848
using namespace Eigen;
49-
bp::def("is_approx",(bool (*)(const MatrixXd &, const MatrixXd &, const double &))&is_approx<MatrixXd,MatrixXd>,
49+
50+
bp::def("is_approx",(bool (*)(const Eigen::MatrixBase<MatrixXd> &, const Eigen::MatrixBase<MatrixXd> &, const double &))&is_approx<MatrixXd,MatrixXd>,
5051
bp::args("A","B","prec"),
5152
"Returns True if A is approximately equal to B, within the precision determined by prec.");
52-
bp::def("is_approx",(bool (*)(const MatrixXd &, const MatrixXd &))&is_approx<MatrixXd,MatrixXd>,
53+
54+
bp::def("is_approx",(bool (*)(const Eigen::MatrixBase<MatrixXd> &, const Eigen::MatrixBase<MatrixXd> &))&is_approx<MatrixXd,MatrixXd>,
5355
bp::args("A","B"),
5456
"Returns True if A is approximately equal to B.");
5557
}

0 commit comments

Comments
 (0)