From 1da815366df1143258b1dfea76d228fdd3a1c6c1 Mon Sep 17 00:00:00 2001 From: Justin Carpentier <justin.carpentier@inria.fr> Date: Sun, 11 Feb 2024 08:18:09 +0100 Subject: [PATCH] utils: fix is_approx for complex types --- include/eigenpy/utils/is-approx.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/eigenpy/utils/is-approx.hpp b/include/eigenpy/utils/is-approx.hpp index 0b9548c8..45c178b1 100644 --- a/include/eigenpy/utils/is-approx.hpp +++ b/include/eigenpy/utils/is-approx.hpp @@ -12,7 +12,7 @@ namespace eigenpy { template <typename MatrixType1, typename MatrixType2> EIGEN_DONT_INLINE bool is_approx(const Eigen::MatrixBase<MatrixType1>& mat1, const Eigen::MatrixBase<MatrixType2>& mat2, - const typename MatrixType1::Scalar& prec) { + const typename MatrixType1::RealScalar& prec) { return mat1.isApprox(mat2, prec); } @@ -21,14 +21,14 @@ 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()); + Eigen::NumTraits<typename MatrixType1::RealScalar>::dummy_precision()); } template <typename MatrixType1, typename MatrixType2> EIGEN_DONT_INLINE bool is_approx( const Eigen::SparseMatrixBase<MatrixType1>& mat1, const Eigen::SparseMatrixBase<MatrixType2>& mat2, - const typename MatrixType1::Scalar& prec) { + const typename MatrixType1::RealScalar& prec) { return mat1.isApprox(mat2, prec); } @@ -38,7 +38,7 @@ EIGEN_DONT_INLINE bool is_approx( const Eigen::SparseMatrixBase<MatrixType2>& mat2) { return is_approx( mat1, mat2, - Eigen::NumTraits<typename MatrixType1::Scalar>::dummy_precision()); + Eigen::NumTraits<typename MatrixType1::RealScalar>::dummy_precision()); } } // namespace eigenpy -- GitLab