Bug 578 - Avoid std::abs for mpfr compatibility
Avoid std::abs for mpfr compatibility
Status: RESOLVED FIXED
Product: Eigen
Classification: Unclassified
Component: Sparse
3.2
All All
: Normal Unknown
Assigned To: Nobody
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-04-03 16:06 UTC by Angelos
Modified: 2013-04-03 16:34 UTC (History)
1 user (show)



Attachments

Description Angelos 2013-04-03 16:06:17 UTC
Hi,

Here is a small patch for src/IterativeLinearSolvers/IncompleteLUT.h
that restores mpfr compatibility.

best
Angelos


@@ -29,6 +29,8 @@
 {
   typedef typename VectorV::RealScalar RealScalar;
   using std::swap;
+  using std::abs;
   int mid;
   int n = row.size(); /* length of the vector */
   int first, last ; 
@@ -40,9 +42,9 @@
   
   do {
     mid = first; 
-    RealScalar abskey = std::abs(row(mid)); 
+    RealScalar abskey = abs(row(mid)); 
     for (int j = first + 1; j <= last; j++) {
-      if ( std::abs(row(j)) > abskey) {
+      if ( abs(row(j)) > abskey) {
         ++mid;
         swap(row(mid), row(j));
         swap(ind(mid), ind(j));
Comment 1 Christoph Hertzberg 2013-04-03 16:34:34 UTC
Fixed here:
https://bitbucket.org/eigen/eigen/commits/744cea6ac6c32b8b83c68814438261f21bf68c36

Thanks for the patch. If you have more sophisticated patches, please check how to make proper patches here:
http://eigen.tuxfamily.org/index.php?title=Mercurial


The class might require most int replaced by Index, but I guess there is no urgent need at the moment.

Note You need to log in before you can comment on or make changes to this bug.