diff --git a/sagemath-ntl9.patch b/sagemath-ntl9.patch new file mode 100644 index 0000000..1914918 --- /dev/null +++ b/sagemath-ntl9.patch @@ -0,0 +1,178 @@ +--- ./src/sage/rings/bernmm/bernmm-test.cpp.orig 2015-02-16 17:15:12.000000000 -0700 ++++ ./src/sage/rings/bernmm/bernmm-test.cpp 2015-05-07 21:39:58.565251320 -0600 +@@ -70,7 +70,7 @@ void bern_naive(mpq_t* res, long n) + */ + int testcase__bern_modp_powg(long p, long k, mpq_t b) + { +- double pinv = 1 / ((double) p); ++ wide_double pinv = wide_double(1) / wide_double(p); + + // compute B_k mod p using _bern_modp_powg() + long x = _bern_modp_powg(p, pinv, k); +@@ -147,7 +147,7 @@ int test__bern_modp_powg() + */ + int testcase__bern_modp_pow2(long p, long k) + { +- double pinv = 1 / ((double) p); ++ wide_double pinv = wide_double(1) / wide_double(p); + + if (PowerMod(2, k, p, pinv) == 1) + return 1; +--- ./src/sage/rings/bernmm/bern_modp.cpp.orig 2015-02-16 17:15:12.000000000 -0700 ++++ ./src/sage/rings/bernmm/bern_modp.cpp 2015-05-07 20:17:37.680381004 -0600 +@@ -43,14 +43,14 @@ namespace bernmm { + pinv = 1 / ((double) p) + g = a multiplicative generator of GF(p), in [0, p) + */ +-long bernsum_powg(long p, double pinv, long k, long g) ++long bernsum_powg(long p, wide_double pinv, long k, long g) + { + long half_gm1 = (g + ((g & 1) ? 0 : p) - 1) / 2; // (g-1)/2 mod p + long g_to_jm1 = 1; + long g_to_km1 = PowerMod(g, k-1, p, pinv); + long g_to_km1_to_j = g_to_km1; + long sum = 0; +- double g_pinv = ((double) g) / ((double) p); ++ wide_double g_pinv = wide_double(g) / wide_double(p); + mulmod_precon_t g_to_km1_pinv = PrepMulModPrecon(g_to_km1, p, pinv); + + for (long j = 1; j <= (p-1)/2; j++) +@@ -224,7 +224,7 @@ public: + #error Number of bits in a long must be divisible by TABLE_LG_SIZE + #endif + +-long bernsum_pow2(long p, double pinv, long k, long g, long n) ++long bernsum_pow2(long p, wide_double pinv, long k, long g, long n) + { + // In the main summation loop we accumulate data into the _tables_ array; + // tables[y][z] contributes to the final answer with a weight of +@@ -481,7 +481,7 @@ long PrepRedc(long n) + (See bernsum_pow2() for code comments; we only add comments here where + something is different from bernsum_pow2()) + */ +-long bernsum_pow2_redc(long p, double pinv, long k, long g, long n) ++long bernsum_pow2_redc(long p, wide_double pinv, long k, long g, long n) + { + long pinv2 = PrepRedc(p); + long F = (1L << (ULONG_BITS/2)) % p; +@@ -655,7 +655,7 @@ long bernsum_pow2_redc(long p, double pi + + Algorithm: uses bernsum_powg() to compute the main sum. + */ +-long _bern_modp_powg(long p, double pinv, long k) ++long _bern_modp_powg(long p, wide_double pinv, long k) + { + Factorisation F(p-1); + long g = primitive_root(p, pinv, F); +@@ -685,7 +685,7 @@ long _bern_modp_powg(long p, double pinv + Algorithm: uses bernsum_pow2() (or bernsum_pow2_redc() if p is small + enough) to compute the main sum. + */ +-long _bern_modp_pow2(long p, double pinv, long k) ++long _bern_modp_pow2(long p, wide_double pinv, long k) + { + Factorisation F(p-1); + long g = primitive_root(p, pinv, F); +@@ -717,7 +717,7 @@ long _bern_modp_pow2(long p, double pinv + 2 <= k <= p-3, k even + pinv = 1 / ((double) p) + */ +-long _bern_modp(long p, double pinv, long k) ++long _bern_modp(long p, wide_double pinv, long k) + { + if (PowerMod(2, k, p, pinv) != 1) + // 2^k != 1 mod p, so we use the faster version +@@ -765,7 +765,7 @@ long bern_modp(long p, long k) + if (m == 0) + return -1; + +- double pinv = 1 / ((double) p); ++ wide_double pinv = wide_double(1) / wide_double (p); + long x = _bern_modp(p, pinv, m); // = B_m/m mod p + return MulMod(x, k, p, pinv); + } +--- ./src/sage/rings/bernmm/bern_modp.h.orig 2015-02-16 17:15:12.000000000 -0700 ++++ ./src/sage/rings/bernmm/bern_modp.h 2015-05-09 08:06:39.732529882 -0600 +@@ -12,6 +12,7 @@ + #ifndef BERNMM_BERN_MODP_H + #define BERNMM_BERN_MODP_H + ++#include + + namespace bernmm { + +@@ -29,8 +30,8 @@ long bern_modp(long p, long k); + /* + Exported for testing. + */ +-long _bern_modp_powg(long p, double pinv, long k); +-long _bern_modp_pow2(long p, double pinv, long k); ++long _bern_modp_powg(long p, NTL::wide_double pinv, long k); ++long _bern_modp_pow2(long p, NTL::wide_double pinv, long k); + + + }; +--- ./src/sage/rings/bernmm/bern_modp_util.cpp.orig 2015-02-16 17:15:12.000000000 -0700 ++++ ./src/sage/rings/bernmm/bern_modp_util.cpp 2015-05-07 21:38:06.662182003 -0600 +@@ -20,7 +20,7 @@ NTL_CLIENT; + namespace bernmm { + + +-long PowerMod(long a, long ee, long n, double ninv) ++long PowerMod(long a, long ee, long n, wide_double ninv) + { + long x, y; + +@@ -89,7 +89,7 @@ PrimeTable::PrimeTable(long bound) + } + + +-long order(long x, long p, double pinv, const Factorisation& F) ++long order(long x, long p, wide_double pinv, const Factorisation& F) + { + // in the loop below, m is always some multiple of the order of x + long m = p - 1; +@@ -113,7 +113,7 @@ long order(long x, long p, double pinv, + + + +-long primitive_root(long p, double pinv, const Factorisation& F) ++long primitive_root(long p, wide_double pinv, const Factorisation& F) + { + if (p == 2) + return 1; +--- ./src/sage/rings/bernmm/bern_modp_util.h.orig 2015-02-16 17:15:12.000000000 -0700 ++++ ./src/sage/rings/bernmm/bern_modp_util.h 2015-05-09 08:58:22.618458475 -0600 +@@ -17,6 +17,7 @@ + #include + #include + #include ++#include + + + #if ULONG_MAX == 4294967295U +@@ -39,7 +40,7 @@ namespace bernmm { + + (Implementation is adapted from ZZ.c in NTL 5.4.1.) + */ +-long PowerMod(long a, long ee, long n, double ninv); ++long PowerMod(long a, long ee, long n, NTL::wide_double ninv); + + + /* +@@ -123,13 +124,13 @@ long next_prime(long p); + /* + Computes order of x mod p, given the factorisation F of p-1. + */ +-long order(long x, long p, double pinv, const Factorisation& F); ++long order(long x, long p, NTL::wide_double pinv, const Factorisation& F); + + + /* + Finds the smallest primitive root mod p, given the factorisation F of p-1. + */ +-long primitive_root(long p, double pinv, const Factorisation& F); ++long primitive_root(long p, NTL::wide_double pinv, const Factorisation& F); + + + }; // end namespace diff --git a/sagemath.spec b/sagemath.spec index c82dadf..a624807 100644 --- a/sagemath.spec +++ b/sagemath.spec @@ -42,7 +42,7 @@ Name: sagemath Group: Applications/Engineering Summary: A free open-source mathematics software system Version: 6.5 -Release: 3%{?dist} +Release: 4%{?dist} # The file ${SAGE_ROOT}/COPYING.txt is the upstream license breakdown file # Additionally, every $files section has a comment with the license name # before files with that license @@ -151,6 +151,9 @@ Patch24: %{name}-parallel.patch # https://bugzilla.redhat.com/show_bug.cgi?id=1194941 Patch25: %{name}-ipython3.patch +# Fix a changed interface in NTL 9.x +Patch26: %{name}-ntl9.patch + BuildRequires: 4ti2 BuildRequires: atlas-devel BuildRequires: cddlib-tools @@ -211,8 +214,8 @@ BuildRequires: python-ipython BuildRequires: python-matplotlib BuildRequires: python-networkx BuildRequires: python-sphinx +BuildRequires: python-twisted BuildRequires: python-twisted-web -BuildRequires: python-twisted-web2 BuildRequires: polybori-devel BuildRequires: R BuildRequires: ratpoints-devel @@ -263,9 +266,9 @@ Requires: python-ipython Requires: python-matplotlib Requires: python-networkx Requires: python-polybori +Requires: python-twisted Requires: python-twisted-mail Requires: python-twisted-web -Requires: python-twisted-web2 Requires: python-ZODB3 Requires: R Requires: rpy @@ -632,6 +635,7 @@ popd %patch23 %patch24 %patch25 +%patch26 sed -e 's|@@SAGE_ROOT@@|%{SAGE_ROOT}|' \ -e 's|@@SAGE_DOC@@|%{SAGE_DOC}|' \ @@ -1358,6 +1362,9 @@ exit 0 ######################################################################## %changelog +* Sat May 9 2015 Jerry James - 6.5-4 +- Rebuild for ntl 9.1.0 + * Tue May 5 2015 Peter Robinson 6.5-3 - Drop old F-18 comparisions - Build on ARMv7, all deps now met