Skip to content
Snippets Groups Projects
Verified Commit a29f6f85 authored by Justin Carpentier's avatar Justin Carpentier
Browse files

python: use original signature of is_approx

parent b620c5b3
No related branches found
No related tags found
No related merge requests found
/* /*
* Copyright 2020 INRIA * Copyright 2020 INRIA
*/ */
#ifndef __eigenpy_utils_scalar_is_approx_hpp__ #ifndef __eigenpy_utils_scalar_is_approx_hpp__
#define __eigenpy_utils_scalar_is_approx_hpp__ #define __eigenpy_utils_scalar_is_approx_hpp__
...@@ -10,15 +10,16 @@ ...@@ -10,15 +10,16 @@
namespace eigenpy namespace eigenpy
{ {
template<typename MatrixType1, typename MatrixType2> template<typename MatrixType1, typename MatrixType2>
inline EIGEN_DONT_INLINE bool is_approx(const MatrixType1 & mat1, inline EIGEN_DONT_INLINE bool is_approx(const Eigen::MatrixBase<MatrixType1> & mat1,
const MatrixType2 & mat2, const Eigen::MatrixBase<MatrixType2> & mat2,
const typename MatrixType1::Scalar & prec) const typename MatrixType1::Scalar & prec)
{ {
return mat1.derived().isApprox(mat2.derived(),prec); return mat1.isApprox(mat2,prec);
} }
template<typename MatrixType1, typename MatrixType2> 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()); return is_approx(mat1,mat2,Eigen::NumTraits<typename MatrixType1::Scalar>::dummy_precision());
} }
......
...@@ -46,10 +46,12 @@ BOOST_PYTHON_MODULE(eigenpy) ...@@ -46,10 +46,12 @@ BOOST_PYTHON_MODULE(eigenpy)
{ {
using namespace Eigen; 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"), bp::args("A","B","prec"),
"Returns True if A is approximately equal to B, within the precision determined by 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"), bp::args("A","B"),
"Returns True if A is approximately equal to B."); "Returns True if A is approximately equal to B.");
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment