Re: [eigen] Ambiguous call

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]



What? I don't see any changeset from you in the mainline eigen repo.

Use this documentation:
http://eigen.tuxfamily.org/index.php?title=Mercurial#Generating_a_patch

Here it is. I commited before only in my local repo.

--
Luis


Benoit


--
Luis




Benoit


Best,

--
Luis


Benoit

2011/12/7 Luis Peñaranda<luis.penaranda@xxxxxxx>:


Hello,

I have a problem with a simple call to the determinant of a
Eigen::Matrix<NT,Eigen::Dynamic,Eigen::Dynamic>      . This works for
many
different instantiations of NT, like mpq_class. The problem is when I
try
to
use a rational number type from the CGAL library, CGAL::Gmpq. I get the
following error from the compiler:

/usr/local/include/eigen3/Eigen/src/Core/Functors.h:284:90: error: call
of
overloaded ‘abs(const CGAL::Gmpq&)’ is ambiguous

The point is that the function abs(a) is also defined for CGAL::Gmpq.
Digging inside the code, I found that the line 284 of the above file
reads

  EIGEN_STRONG_INLINE const result_type operator() (const Scalar&      a)
const {
return abs(a); }

This function is inside the namespace internal::, and I think what is
intended here is to return internal::abs(a). Changing this line
resulted
in
a correct compilation.

My question are two, then. Is it right what I am saying? Is it feasible
to
make this change permanent?

Thank you,

--
Luis














exporting patch:
# HG changeset patch
# User Luis Peñaranda <luis.penaranda@xxxxxxx>
# Date 1323291191 -3600
# Node ID 3652a853be733048e294c7659a7954c925877751
# Parent  a636d18af2550b2cebb2c1095fce9c693124ef45
added internal:: namespace to ambiguous abs() call

diff -r a636d18af255 -r 3652a853be73 Eigen/src/Core/Functors.h
--- a/Eigen/src/Core/Functors.h	Wed Dec 07 13:20:52 2011 +0100
+++ b/Eigen/src/Core/Functors.h	Wed Dec 07 21:53:11 2011 +0100
@@ -281,7 +281,8 @@
 template<typename Scalar> struct scalar_abs_op {
   EIGEN_EMPTY_STRUCT_CTOR(scalar_abs_op)
   typedef typename NumTraits<Scalar>::Real result_type;
-  EIGEN_STRONG_INLINE const result_type operator() (const Scalar& a) const { return abs(a); }
+  EIGEN_STRONG_INLINE const result_type operator() (const Scalar& a) const
+  { return internal::abs(a); }
   template<typename Packet>
   EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a) const
   { return internal::pabs(a); }


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/