diff --git a/sagemath-m4rie.patch b/sagemath-m4rie.patch new file mode 100644 index 0000000..1272341 --- /dev/null +++ b/sagemath-m4rie.patch @@ -0,0 +1,62 @@ +--- sage-5.8/spkg/build/sage-5.8/sage/libs/m4rie.pxd.orig 2013-05-07 08:12:27.137652862 -0600 ++++ sage-5.8/spkg/build/sage-5.8/sage/libs/m4rie.pxd 2013-05-07 11:45:12.067923724 -0600 +@@ -52,9 +52,9 @@ cdef extern from "m4rie/m4rie.h": + + void mzed_add_elem(mzed_t *a, const_size_t row, const_size_t col, const_int elem) + +- void mzed_add_multiple_of_row(mzed_t *A, size_t ar, mzed_t *B, size_t br, m4ri_word *X, size_t start_col) ++ void mzed_add_multiple_of_row(mzed_t *A, size_t ar, mzed_t *B, size_t br, m4ri_word x, size_t start_col) + +- void mzed_rescale_row(mzed_t *A, size_t r, size_t c, m4ri_word *X) ++ void mzed_rescale_row(mzed_t *A, size_t r, size_t c, m4ri_word x) + + void mzed_row_swap(mzed_t *M, const_size_t rowa, const_size_t rowb) + +@@ -112,14 +112,12 @@ cdef extern from "m4rie/m4rie.h": + + #cdef extern from "m4rie/mzd_slice.h": + +- int __M4RIE_MAX_KARATSUBA_DEGREE +- + ctypedef struct mzd_slice_t: + mzd_t *x[16] +- gf2e *finite_field + int nrows + int ncols + int depth ++ gf2e *finite_field + + mzd_slice_t *mzd_slice_init(gf2e *ff, size_t m, size_t n) + +--- sage-5.8/spkg/build/sage-5.8/sage/matrix/matrix_mod2e_dense.pyx.orig 2013-05-07 08:12:27.139652859 -0600 ++++ sage-5.8/spkg/build/sage-5.8/sage/matrix/matrix_mod2e_dense.pyx 2013-05-07 11:21:05.095668016 -0600 +@@ -561,9 +561,6 @@ cdef class Matrix_mod2e_dense(matrix_den + if self._ncols != right._nrows: + raise ArithmeticError("left ncols must match right nrows") + +- if self._entries.finite_field.degree > __M4RIE_MAX_KARATSUBA_DEGREE: +- raise NotImplementedError("Karatsuba multiplication is only implemented for matrices over GF(2^e) with e <= %d."%__M4RIE_MAX_KARATSUBA_DEGREE) +- + cdef Matrix_mod2e_dense ans + + ans = self.new_matrix(nrows = self.nrows(), ncols = right.ncols()) +@@ -1047,8 +1044,7 @@ cdef class Matrix_mod2e_dense(matrix_den + [ a a^2 + 1 a + 1] + """ + cdef m4ri_word x = (self.cc.objectptr).log2pol((multiple).element) +- cdef m4ri_word *X = self._entries.finite_field.mul[x] +- mzed_rescale_row(self._entries, row, start_col, X) ++ mzed_rescale_row(self._entries, row, start_col, x) + + + cdef add_multiple_of_row_c(self, Py_ssize_t row_to, Py_ssize_t row_from, multiple, Py_ssize_t start_col): +@@ -1077,8 +1073,7 @@ cdef class Matrix_mod2e_dense(matrix_den + """ + + cdef m4ri_word x = (self.cc.objectptr).log2pol((multiple).element) +- cdef m4ri_word *X = self._entries.finite_field.mul[x] +- mzed_add_multiple_of_row(self._entries, row_to, self._entries, row_from, X, start_col) ++ mzed_add_multiple_of_row(self._entries, row_to, self._entries, row_from, x, start_col) + + + cdef swap_rows_c(self, Py_ssize_t row1, Py_ssize_t row2): diff --git a/sagemath-ntl6.patch b/sagemath-ntl6.patch index af85c07..6b87ade 100644 --- a/sagemath-ntl6.patch +++ b/sagemath-ntl6.patch @@ -1,6 +1,6 @@ --- sage-5.8/spkg/build/sage-5.8/c_lib/include/ntl_wrap.h.orig 2010-06-28 10:37:05.000000000 -0600 +++ sage-5.8/spkg/build/sage-5.8/c_lib/include/ntl_wrap.h 2013-05-03 15:42:32.931073654 -0600 -@@ -40,91 +40,91 @@ EXTERN void setup_NTL_error_callback(voi +@@ -40,91 +40,92 @@ EXTERN void setup_NTL_error_callback(voi //////// ZZ ////////// #ifndef __cplusplus @@ -36,6 +36,7 @@ #ifndef __cplusplus -struct ZZ_p; +typedef struct ZZ_p ZZ_p; ++typedef struct ZZ_pContext ZZ_pContext; #endif #ifdef __cplusplus // sorry, if you want a C version, feel free to add it @@ -154,7 +155,7 @@ //////// ZZXFactoring ////////// -@@ -132,76 +132,76 @@ EXTERN void ZZX_preallocate_space(struct +@@ -132,76 +133,77 @@ EXTERN void ZZX_preallocate_space(struct // e -- point to list of e longs (the exponents) // n -- length of above two lists // The lists v and e are mallocd, and must be freed by the calling code. @@ -278,10 +279,11 @@ #ifndef __cplusplus -struct zz_p; +typedef struct zz_p zz_p; ++typedef struct zz_pContext zz_pContext; #endif #define zz_p_set_from_long( obj1, obj2 )\ -@@ -209,14 +209,14 @@ struct zz_p; +@@ -209,14 +211,14 @@ struct zz_p; #define NTL_zz_p_DOUBLE_EQUALS( obj1, obj2 )\ (obj1) == (obj2) @@ -300,7 +302,7 @@ #endif #define NTL_zz_pX_DOUBLE_EQUALS( obj1, obj2 )\ -@@ -225,104 +225,104 @@ struct zz_pX; +@@ -225,104 +227,106 @@ struct zz_pX; //////// ZZ_pEContext /////////////// #ifndef __cplusplus @@ -419,6 +421,7 @@ #ifndef __cplusplus -struct GF2EContext; ++typedef struct GF2E GF2E; +typedef struct GF2EContext GF2EContext; #endif @@ -441,6 +444,7 @@ #ifndef __cplusplus -struct mat_GF2; ++typedef struct GF2 GF2; +typedef struct mat_GF2 mat_GF2; #endif @@ -1344,3 +1348,104 @@ { //int j; cpn.restore(); +--- sage-5.8/spkg/build/sage-5.8/sage/libs/ntl/decl.pxi.orig 2010-06-28 10:37:01.000000000 -0600 ++++ sage-5.8/spkg/build/sage-5.8/sage/libs/ntl/decl.pxi 2013-05-07 09:38:36.134950663 -0600 +@@ -23,7 +23,7 @@ from sage.libs.ntl.ntl_ZZ_pEX_decl cimpo + + cdef extern from "ntl_wrap.h": + #### mat_ZZ_c +- ctypedef struct mat_ZZ_c "struct mat_ZZ": ++ ctypedef struct mat_ZZ_c "mat_ZZ": + pass + + # Some boiler-plate +@@ -93,7 +93,7 @@ cdef extern from "ntl_wrap.h": + cdef long mat_ZZ_G_BKZ_RR_U "G_BKZ_RR"(mat_ZZ_c B, mat_ZZ_c U, double delta, long BlockSize, long prune, int check, long verbose) + + #### GF2_c +- ctypedef struct GF2_c "struct GF2": ++ ctypedef struct GF2_c "GF2": + pass + + GF2_c* GF2_new "New"() +@@ -119,7 +119,7 @@ cdef extern from "ntl_wrap.h": + + #### GF2X_c + +- ctypedef struct GF2X_c "struct GF2X": ++ ctypedef struct GF2X_c "GF2X": + pass + + long *GF2XHexOutput_c "(&GF2X::HexOutput)" # work-around for Cython bug +@@ -176,7 +176,7 @@ cdef extern from "ntl_wrap.h": + void GF2X_BuildIrred "BuildIrred" (GF2X_c f, long n) + + #### GF2XModulus_c +- ctypedef struct GF2XModulus_c "struct GF2XModulus": ++ ctypedef struct GF2XModulus_c "GF2XModulus": + pass + + GF2X_c GF2XModulus_GF2X "GF2X" (GF2XModulus_c m) +@@ -185,7 +185,7 @@ cdef extern from "ntl_wrap.h": + + #### GF2EContext_c + +- ctypedef struct GF2EContext_c "struct GF2EContext": ++ ctypedef struct GF2EContext_c "GF2EContext": + void (*restore)() + + GF2EContext_c* GF2EContext_new "New"() +@@ -196,7 +196,7 @@ cdef extern from "ntl_wrap.h": + void GF2EContext_delete "Delete"(GF2EContext_c *mem) + + #### GF2E_c +- ctypedef struct GF2E_c "struct GF2E": ++ ctypedef struct GF2E_c "GF2E": + pass + + void GF2E_init "GF2E::init"(GF2X_c x) +@@ -231,7 +231,7 @@ cdef extern from "ntl_wrap.h": + GF2_c GF2E_trace "trace"(GF2E_c x) + + #### GF2EX_c +- ctypedef struct GF2EX_c "struct GF2EX": ++ ctypedef struct GF2EX_c "GF2EX": + pass + + GF2EX_c* GF2EX_new "New"() +@@ -250,7 +250,7 @@ cdef extern from "ntl_wrap.h": + int GF2EX_IsZero "IsZero"(GF2EX_c x) + + #### vec_GF2E_c +- ctypedef struct vec_GF2E_c "struct vec_GF2E": ++ ctypedef struct vec_GF2E_c "vec_GF2E": + pass + + vec_GF2E_c* vec_GF2E_new "New"() +@@ -261,7 +261,7 @@ cdef extern from "ntl_wrap.h": + object vec_GF2E_to_PyString "_to_PyString"(vec_GF2E_c *x) + + #### mat_GF2E_c +- ctypedef struct mat_GF2E_c "struct mat_GF2E": ++ ctypedef struct mat_GF2E_c "mat_GF2E": + void (*SetDims)(long nrows, long ncols) + long (*NumRows)() + long (*NumCols)() +@@ -300,7 +300,7 @@ cdef extern from "ntl_wrap.h": + void mat_GF2E_conv_vec_GF2E(mat_GF2E_c out, vec_GF2E_c inp) + + #### vec_GF2_c +- ctypedef struct vec_GF2_c "struct vec_GF2": ++ ctypedef struct vec_GF2_c "vec_GF2": + pass + + vec_GF2_c* vec_GF2_new "New"() +@@ -312,7 +312,7 @@ cdef extern from "ntl_wrap.h": + + + #### mat_GF2_c +- ctypedef struct mat_GF2_c "struct mat_GF2": ++ ctypedef struct mat_GF2_c "mat_GF2": + void (*SetDims)(long nrows, long ncols) + long (*NumRows)() + long (*NumCols)() diff --git a/sagemath.spec b/sagemath.spec index 6f59ba2..fc6e89b 100644 --- a/sagemath.spec +++ b/sagemath.spec @@ -214,6 +214,9 @@ Patch32: %{name}-cryptominisat.patch # http://trac.sagemath.org/sage_trac/ticket/14452 Patch33: 14452_cython_0.19.patch +# Adapt to m4rie 20130416 +Patch34: %{name}-m4rie.patch + BuildRequires: 4ti2 BuildRequires: atlas-devel BuildRequires: cddlib-tools @@ -700,6 +703,10 @@ pushd spkg/build/sage-%{version} popd %endif +%if 0%{?fedora} >= 19 +%patch34 -p1 +%endif + #------------------------------------------------------------------------ # ensure proper/preferred libatlas is in linker path pushd spkg/build/sage-%{version} @@ -1390,6 +1397,7 @@ exit 0 - Rebuild for libfplll 4.0.3, m4ri and m4rie 20130416, and ntl 6.0.0 - Drop sagemath-unpatched_ntl.patch now that Fedora's NTL is patched - Add sagemath-ntl6.patch to adapt to NTL 6 +- Add sagemath-m4rie.patch to adapt to m4rie 20130416 * Sat Apr 27 2013 pcpa - 5.8-8 - Add surf-geometry to path for proper Singular plotting