Sending the attachment manually as it didn't come with the notification.

Benjamin Lorenz
>From f293923ae20196f34b1348bae9338fed0387388c Mon Sep 17 00:00:00 2001
From: Christof Soeger <csoe...@uos.de>
Date: Tue, 8 Dec 2015 12:04:40 +0100
Subject: [PATCH] fix libnormaliz for gmp 6.1

adapted from upstream 14b874f017:
    Resolve ambiguous calls of gcd for gmp 6.1.0

    gmp 6.1.0 introduced gcd and lcm in their c++ interface. This made the
    call of gcd(mpz_class&, mpz_class&) ambiguous.
    Resolved it by explicitly calling the libnormaliz version to keep
    compatibility to older gmp versions.
---
 ChangeLog                                                             | 3 +++
 bundled/libnormaliz/external/libnormaliz/HilbertSeries.cpp            | 2 +-
 bundled/libnormaliz/external/libnormaliz/integer.cpp                  | 2 +-
 bundled/libnormaliz/external/libnormaliz/matrix.cpp                   | 4 ++--
 bundled/libnormaliz/external/libnormaliz/simplex.cpp                  | 2 +-
 .../libnormaliz/external/libnormaliz/sublattice_representation.cpp    | 4 ++--
 bundled/libnormaliz/external/libnormaliz/vector_operations.cpp        | 2 +-
 7 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f4c4012..ee2ea7d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 Changelog
 
+-- general --
+ * fix building of libnormaliz with gmp 6.1
+
 === Polymake 2.14r1 ===
 
 -- general --
diff --git a/bundled/libnormaliz/external/libnormaliz/HilbertSeries.cpp b/bundled/libnormaliz/external/libnormaliz/HilbertSeries.cpp
index 38b97f2..c38120d 100644
--- a/bundled/libnormaliz/external/libnormaliz/HilbertSeries.cpp
+++ b/bundled/libnormaliz/external/libnormaliz/HilbertSeries.cpp
@@ -355,7 +355,7 @@ void HilbertSeries::computeHilbertQuasiPolynomial() const {
     //divide by gcd //TODO operate directly on vector
     Matrix<mpz_class> QP(quasi_poly);
     mpz_class g = QP.matrix_gcd();
-    g = gcd(g,quasi_denom);
+    g = libnormaliz::gcd(g,quasi_denom);
     quasi_denom /= g;
     QP.scalar_division(g);
     quasi_poly = QP.get_elements();
diff --git a/bundled/libnormaliz/external/libnormaliz/integer.cpp b/bundled/libnormaliz/external/libnormaliz/integer.cpp
index 91552b4..94016ab 100644
--- a/bundled/libnormaliz/external/libnormaliz/integer.cpp
+++ b/bundled/libnormaliz/external/libnormaliz/integer.cpp
@@ -88,7 +88,7 @@ Integer lcm(const Integer& a, const Integer& b){
         return 0;
     }
     else
-        return Iabs<Integer>(a*b/gcd<Integer>(a,b));
+        return Iabs<Integer>(a*b/libnormaliz::gcd<Integer>(a,b));
 }
 
 template<> mpz_class lcm<mpz_class>(const mpz_class& a, const mpz_class& b) {
diff --git a/bundled/libnormaliz/external/libnormaliz/matrix.cpp b/bundled/libnormaliz/external/libnormaliz/matrix.cpp
index 8f27ab5..b5c2262 100644
--- a/bundled/libnormaliz/external/libnormaliz/matrix.cpp
+++ b/bundled/libnormaliz/external/libnormaliz/matrix.cpp
@@ -638,7 +638,7 @@ Integer Matrix<Integer>::matrix_gcd() const{
     Integer g=0,h;
     for (size_t i = 0; i <nr; i++) {
         h = v_gcd(elements[i]);
-        g = gcd<Integer>(g, h);
+        g = libnormaliz::gcd<Integer>(g, h);
         if (g==1) return g;
     }
     return g;
@@ -1210,7 +1210,7 @@ vector<Integer> Matrix<Integer>::solve(const vector<Integer>& v, Integer& denom)
             return vector<Integer>();
         }
     }
-    Integer total_gcd =gcd(denom,v_gcd(Linear_Form)); // extract the gcd of denom and solution
+    Integer total_gcd =libnormaliz::gcd(denom,v_gcd(Linear_Form)); // extract the gcd of denom and solution
     denom/=total_gcd;
     v_scalar_division(Linear_Form,total_gcd);
     return Linear_Form;
diff --git a/bundled/libnormaliz/external/libnormaliz/simplex.cpp b/bundled/libnormaliz/external/libnormaliz/simplex.cpp
index cda5c83..e9bd91f 100644
--- a/bundled/libnormaliz/external/libnormaliz/simplex.cpp
+++ b/bundled/libnormaliz/external/libnormaliz/simplex.cpp
@@ -341,7 +341,7 @@ Integer SimplexEvaluator<Integer>::start_evaluation(SHORTSIMPLEX<Integer>& s, Co
     if(potentially_unimodular && C.isComputed(ConeProperty::Grading)){
         long g=0;
         for(i=0;i<dim;++i){
-            g=gcd(g,gen_degrees[i]);
+            g=libnormaliz::gcd(g,gen_degrees[i]);
             if(g==1)
                 break;
         }
diff --git a/bundled/libnormaliz/external/libnormaliz/sublattice_representation.cpp b/bundled/libnormaliz/external/libnormaliz/sublattice_representation.cpp
index 1f8642d..ddd7854 100644
--- a/bundled/libnormaliz/external/libnormaliz/sublattice_representation.cpp
+++ b/bundled/libnormaliz/external/libnormaliz/sublattice_representation.cpp
@@ -158,7 +158,7 @@ void Sublattice_Representation<Integer>::compose(const Sublattice_Representation
     
     //check if a factor can be extraced from B  //TODO necessary?
     Integer g = B.matrix_gcd();
-    g = gcd(g,c);  //TODO necessary??
+    g = libnormaliz::gcd(g,c);  //TODO necessary??
     if (g > 1) {
         c /= g;
         B.scalar_division(g);
@@ -303,7 +303,7 @@ Matrix<Integer> Sublattice_Representation<Integer>::get_congruences() const {
             //new_row cannot be divisible by a factor of m
             //so make_prime divides by an invertible element
             rowgcd = v_make_prime(new_row);  
-            assert(gcd(m,rowgcd) == 1);
+            assert(libnormaliz::gcd(m,rowgcd) == 1);
             new_row[dim] = m;
             Cong2.append(new_row);
         }
diff --git a/bundled/libnormaliz/external/libnormaliz/vector_operations.cpp b/bundled/libnormaliz/external/libnormaliz/vector_operations.cpp
index bbd13d7..bd6ccce 100644
--- a/bundled/libnormaliz/external/libnormaliz/vector_operations.cpp
+++ b/bundled/libnormaliz/external/libnormaliz/vector_operations.cpp
@@ -211,7 +211,7 @@ Integer v_gcd(const vector<Integer>& v){
     size_t i, size=v.size();
     Integer g=0;
     for (i = 0; i < size; i++) {
-        g=gcd(g,v[i]);
+        g=libnormaliz::gcd(g,v[i]);
         if (g==1) {
             return 1;
         }
-- 
1.8.4.5

Reply via email to