Re: [eigen] no matching function for call to 'abs(const float&)'

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


Hi Numo,

You could try to see if abs() really supports floating point arguments in your system. For example if this small code 

https://github.com/tbs1980/Cpp/blob/master/CmathAbs/mathabs.cpp

compiles fine then you shouldn’t have any issues compiling the Eigen code. The other option may be is to define a custom version of abs() in the namespace std. 

Best,
Sree

Sreekumar Thaithara Balan
Research Associate in Cosmology
University College London
Email:sbalan@star.ucl.ac.uk
Phone:+44 (0)20 7679 4349

On 27 Aug 2015, at 18:59, Ilja Honkonen <ilja.j.honkonen@xxxxxxxx> wrote:

cmath has been included.
> > OK, replacing line 44 of Eigen/src/Core/functors/UnaryFunctors.h with:
> > EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const result_type operator()
> > (const Scalar& a) const { using std::fabs; return fabs(a); }
> Will this work even if cmath hasn't been included at all?

And if it's not? Eigen cannot control what has been included before or after Eigen headers and I'm guessing your fix would break as soon as someone uses that code without including cmath first.
Ilja





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