diff options
Diffstat (limited to 'libre/sagemath/linbox-1.4.patch')
-rw-r--r-- | libre/sagemath/linbox-1.4.patch | 470 |
1 files changed, 0 insertions, 470 deletions
diff --git a/libre/sagemath/linbox-1.4.patch b/libre/sagemath/linbox-1.4.patch deleted file mode 100644 index b3955eb51..000000000 --- a/libre/sagemath/linbox-1.4.patch +++ /dev/null @@ -1,470 +0,0 @@ -diff --git a/src/module_list.py b/src/module_list.py -index a49ed36..7798cb8 100644 ---- a/src/module_list.py -+++ b/src/module_list.py -@@ -27,6 +27,18 @@ lapack_libs = list(lapack_pc['libraries']) - lapack_library_dirs = list(lapack_pc['library_dirs']) - lapack_include_dirs = list(lapack_pc['include_dirs']) - -+# FFLAS-FFPACK -+fflas_ffpack_pc = pkgconfig.parse('fflas-ffpack') -+fflas_ffpack_libs = list(fflas_ffpack_pc['libraries']) -+fflas_ffpack_library_dirs = list(fflas_ffpack_pc['library_dirs']) -+fflas_ffpack_cflags = pkgconfig.cflags('fflas-ffpack').split() -+ -+# Givaro -+givaro_pc = pkgconfig.parse('givaro') -+givaro_libs = list(givaro_pc['libraries']) -+givaro_library_dirs = list(givaro_pc['library_dirs']) -+givaro_cflags = pkgconfig.cflags('givaro').split() -+ - # GNU Scientific Library - # Note we replace the built-in gslcblas with the above cblas - gsl_pc = pkgconfig.parse('gsl') -@@ -40,6 +52,12 @@ gd_libs = list(gd_pc['libraries']) - gd_library_dirs = list(gd_pc['library_dirs']) - gd_include_dirs = list(gd_pc['include_dirs']) - -+# LinBox -+linbox_pc = pkgconfig.parse('linbox') -+linbox_libs = list(linbox_pc['libraries']) -+linbox_library_dirs = list(linbox_pc['library_dirs']) -+linbox_cflags = pkgconfig.cflags('linbox').split() -+ - # PNG image library - png_pc = pkgconfig.parse('libpng') - png_libs = list(png_pc['libraries']) -@@ -58,9 +76,18 @@ zlib_include_dirs = list(zlib_pc['include_dirs']) - ######################################################### - - aliases = dict( -+ FFLASFFPACK_CFLAGS=fflas_ffpack_cflags, -+ FFLASFFPACK_LIBRARIES=fflas_ffpack_libs, -+ FFLASFFPACK_LIBDIR=fflas_ffpack_library_dirs, -+ GIVARO_CFLAGS=givaro_cflags, -+ GIVARO_LIBRARIES=givaro_libs, -+ GIVARO_LIBDIR=givaro_library_dirs, - GSL_LIBRARIES=gsl_libs, - GSL_LIBDIR=gsl_library_dirs, - GSL_INCDIR=gsl_include_dirs, -+ LINBOX_CFLAGS=linbox_cflags, -+ LINBOX_LIBRARIES=linbox_libs, -+ LINBOX_LIBDIR=linbox_library_dirs, - ) - - ######################################################### -@@ -91,12 +118,6 @@ except ValueError: - singular_libs = ['singular', 'flint', 'ntl', 'gmpxx', 'gmp', 'readline', 'm'] - - ######################################################### --### Givaro flags --######################################################### -- --givaro_extra_compile_args =['-D__STDC_LIMIT_MACROS'] -- --######################################################### - ### Library order - ######################################################### - -@@ -111,8 +132,7 @@ givaro_extra_compile_args =['-D__STDC_LIMIT_MACROS'] - # at the very end of the list. - library_order_list = [ - "singular", "ec", "ecm", -- "linboxsage", "ntl", "iml", "linbox", "givaro", --] + gsl_libs + [ -+] + linbox_libs + gsl_libs + [ - "pari", "flint", "ratpoints", "ecl", "glpk", "ppl", - "arb", "fplll", "mpfi", "mpfr", "mpc", "gmp", "gmpxx", - "brial", -@@ -611,13 +631,10 @@ ext_modules = [ - - Extension('sage.libs.linbox.linbox', - sources = ['sage/libs/linbox/linbox.pyx'], -- libraries = ['linboxsage', 'ntl', 'iml', 'linbox', -- 'givaro', 'mpfr', 'gmp', 'gmpxx'] + cblas_libs, -+ libraries = linbox_libs, - language = 'c++', - library_dirs = cblas_library_dirs, -- include_dirs = cblas_include_dirs, -- extra_compile_args = givaro_extra_compile_args, -- depends = [os.path.join(SAGE_INC, 'givaro', 'givconfig.h')]), -+ include_dirs = cblas_include_dirs), - - Extension('sage.libs.lcalc.lcalc_Lfunction', - sources = ['sage/libs/lcalc/lcalc_Lfunction.pyx'], -@@ -665,9 +682,8 @@ ext_modules = [ - - Extension('sage.libs.singular.singular', - sources = ['sage/libs/singular/singular.pyx'], -- libraries = ['givaro'] + singular_libs, -- language="c++", -- extra_compile_args = givaro_extra_compile_args), -+ libraries = singular_libs, -+ language="c++"), - - Extension('sage.libs.singular.polynomial', - sources = ['sage/libs/singular/polynomial.pyx'], -@@ -687,8 +703,7 @@ ext_modules = [ - Extension('sage.libs.singular.function', - sources = ['sage/libs/singular/function.pyx'], - libraries = singular_libs, -- language="c++", -- extra_compile_args = givaro_extra_compile_args), -+ language="c++"), - - Extension('sage.libs.singular.option', - sources = ['sage/libs/singular/option.pyx'], -@@ -944,19 +959,17 @@ ext_modules = [ - Extension('sage.matrix.matrix_modn_dense_float', - sources = ['sage/matrix/matrix_modn_dense_float.pyx'], - language="c++", -- libraries = ['ntl', 'linbox', 'givaro', 'mpfr', 'gmpxx', 'gmp'] + cblas_libs, -+ libraries = linbox_libs + cblas_libs, - library_dirs = cblas_library_dirs, -- include_dirs = cblas_include_dirs, -- extra_compile_args = nocxx11_args + ['-DDISABLE_COMMENTATOR'] + givaro_extra_compile_args), -+ include_dirs = cblas_include_dirs), - - Extension('sage.matrix.matrix_modn_dense_double', - sources = ['sage/matrix/matrix_modn_dense_double.pyx'], - language="c++", -- libraries = ['ntl', 'linbox', 'givaro', 'mpfr', 'gmpxx', 'gmp'] + cblas_libs, -+ libraries = linbox_libs + cblas_libs, - library_dirs = cblas_library_dirs, - include_dirs = cblas_include_dirs, -- extra_compile_args = nocxx11_args + ["-D_XPG6", "-DDISABLE_COMMENTATOR"] -- + m4ri_extra_compile_args + givaro_extra_compile_args), -+ extra_compile_args = ["-D_XPG6"]), - - Extension('sage.matrix.matrix_modn_sparse', - sources = ['sage/matrix/matrix_modn_sparse.pyx']), -@@ -1400,8 +1413,7 @@ ext_modules = [ - Extension('sage.rings.finite_rings.element_givaro', - sources = ["sage/rings/finite_rings/element_givaro.pyx"], - libraries = ['givaro', 'ntl', 'gmpxx', 'gmp', 'm'], -- language='c++', -- extra_compile_args = givaro_extra_compile_args), -+ language='c++'), - - Extension('sage.rings.finite_rings.element_ntl_gf2e', - sources = ['sage/rings/finite_rings/element_ntl_gf2e.pyx'], -@@ -1421,8 +1433,7 @@ ext_modules = [ - sources = ["sage/rings/finite_rings/hom_finite_field_givaro.pyx"], - # this order is needed to compile under windows. - libraries = ['givaro', 'ntl', 'gmpxx', 'gmp', 'm'], -- language='c++', -- extra_compile_args = givaro_extra_compile_args), -+ language='c++'), - - ################################ - ## -@@ -1574,8 +1585,7 @@ ext_modules = [ - Extension('sage.rings.polynomial.plural', - sources = ['sage/rings/polynomial/plural.pyx'], - libraries = ['m', 'readline', 'singular', 'givaro', 'gmpxx', 'gmp'], -- language="c++", -- extra_compile_args = givaro_extra_compile_args), -+ language="c++"), - - Extension('sage.rings.polynomial.multi_polynomial_libsingular', - sources = ['sage/rings/polynomial/multi_polynomial_libsingular.pyx'], -diff --git a/src/sage/libs/linbox/echelonform.pxd b/src/sage/libs/linbox/echelonform.pxd -index 3097c8b..cf4902d 100644 ---- a/src/sage/libs/linbox/echelonform.pxd -+++ b/src/sage/libs/linbox/echelonform.pxd -@@ -1,23 +1,27 @@ -+# distutils: extra_compile_args = LINBOX_CFLAGS -+# distutils: libraries = LINBOX_LIBRARIES -+# distutils: library_dirs = LINBOX_LIBDIR -+ - from sage.libs.linbox.modular cimport ModDoubleField, ModDoubleFieldElement, ModFloatField, ModFloatFieldElement - from libc.stdint cimport uint64_t - --cdef extern from "linbox/matrix/blas-matrix.h" namespace "LinBox": -- cdef cppclass BlasMatrixDouble "LinBox::BlasMatrix<LinBox::Modular<double> >": -+cdef extern from "linbox/matrix/dense-matrix.h" namespace "LinBox": -+ cdef cppclass BlasMatrixDouble "LinBox::DenseMatrix<Givaro::Modular<double> >": - BlasMatrixDouble(ModDoubleField F, uint64_t nrows, uint64_t ncols) - void setEntry(size_t i, size_t j, ModDoubleFieldElement t) - ModDoubleFieldElement &getEntry(size_t i, size_t j) - -- cdef cppclass BlasMatrixFloat "LinBox::BlasMatrix<LinBox::Modular<float> >": -+ cdef cppclass BlasMatrixFloat "LinBox::DenseMatrix<Givaro::Modular<float> >": - BlasMatrixFloat(ModFloatField F, uint64_t nrows, uint64_t ncols) - void setEntry(size_t i, size_t j, ModFloatFieldElement t) - ModFloatFieldElement &getEntry(size_t i, size_t j) - - cdef extern from "linbox/algorithms/echelon-form.h": -- cdef cppclass EchelonFormDomainDouble "LinBox::EchelonFormDomain<LinBox::Modular<double> >": -+ cdef cppclass EchelonFormDomainDouble "LinBox::EchelonFormDomain<Givaro::Modular<double> >": - EchelonFormDomainDouble(ModDoubleField) - int rowReducedEchelon(BlasMatrixDouble, BlasMatrixDouble) - -- cdef cppclass EchelonFormDomainFloat "LinBox::EchelonFormDomain<LinBox::Modular<float> >": -+ cdef cppclass EchelonFormDomainFloat "LinBox::EchelonFormDomain<Givaro::Modular<float> >": - EchelonFormDomainFloat(ModFloatField) - int rowReducedEchelon(BlasMatrixFloat, BlasMatrixFloat) - -diff --git a/src/sage/libs/linbox/fflas.pxd b/src/sage/libs/linbox/fflas.pxd -index e102004..01ab1b1 100644 ---- a/src/sage/libs/linbox/fflas.pxd -+++ b/src/sage/libs/linbox/fflas.pxd -@@ -1,3 +1,7 @@ -+# distutils: extra_compile_args = FFLASFFPACK_CFLAGS -+# distutils: libraries = FFLASFFPACK_LIBRARIES -+# distutils: library_dirs = FFLASFFPACK_LIBDIR -+ - from .modular cimport ModDoubleField, ModFloatField, ModDoubleFieldElement, ModFloatFieldElement - - cdef extern from "fflas-ffpack/fflas-ffpack.h" namespace "std": -diff --git a/src/sage/libs/linbox/linbox.pyx b/src/sage/libs/linbox/linbox.pyx -index e932347..a9bd6d1 100644 ---- a/src/sage/libs/linbox/linbox.pyx -+++ b/src/sage/libs/linbox/linbox.pyx -@@ -1,3 +1,7 @@ -+# distutils: extra_compile_args = LINBOX_CFLAGS -+# distutils: libraries = LINBOX_LIBRARIES -+# distutils: library_dirs = LINBOX_LIBDIR -+ - r""" - Linbox interface - """ -diff --git a/src/sage/libs/linbox/modular.pxd b/src/sage/libs/linbox/modular.pxd -index 7ef204c..ea5fb29 100644 ---- a/src/sage/libs/linbox/modular.pxd -+++ b/src/sage/libs/linbox/modular.pxd -@@ -1,10 +1,10 @@ --cdef extern from "linbox/field/modular.h": -+cdef extern from "givaro/modular.h": - # double - -- cdef cppclass ModDoubleFieldElement "LinBox::Modular<double>::Element": -+ cdef cppclass ModDoubleFieldElement "Givaro::Modular<double>::Element": - pass - -- cdef cppclass ModDoubleField "LinBox::Modular<double>": -+ cdef cppclass ModDoubleField "Givaro::Modular<double>": - ModDoubleField(int modulus) - ModDoubleFieldElement init(ModDoubleFieldElement res, int v) - ModDoubleFieldElement init(ModDoubleFieldElement res, double v) -@@ -20,10 +20,10 @@ cdef extern from "linbox/field/modular.h": - - - # float -- cdef cppclass ModFloatFieldElement "LinBox::Modular<float>::Element": -+ cdef cppclass ModFloatFieldElement "Givaro::Modular<float>::Element": - pass - -- cdef cppclass ModFloatField "LinBox::Modular<float>": -+ cdef cppclass ModFloatField "Givaro::Modular<float>": - ModFloatField(int modulus) - ModFloatFieldElement init(ModFloatFieldElement res, int v) - ModFloatFieldElement init(ModFloatFieldElement res, double v) -diff --git a/src/sage/libs/singular/singular.pyx b/src/sage/libs/singular/singular.pyx -index 33d7f7ec..77f6e0a 100644 ---- a/src/sage/libs/singular/singular.pyx -+++ b/src/sage/libs/singular/singular.pyx -@@ -23,6 +23,7 @@ cdef extern from "limits.h": - - import os - -+from libc.stdint cimport int64_t - from sage.libs.singular.decl cimport intvec - from sage.libs.singular.decl cimport SR_HDL, SR_INT, SR_TO_INT - from sage.libs.singular.decl cimport singular_options, singular_verbose_options -@@ -156,7 +157,7 @@ cdef FFgivE si2sa_GFqGivaro(number *n, ring *_ring, Cache_givaro cache): - order = cache.objectptr.cardinality() - 1 - - while z: -- c = cache.objectptr.initi(c, <long>napGetCoeff(z)) -+ c = cache.objectptr.initi(c, <int64_t>napGetCoeff(z)) - e = napGetExpFrom(z,1, _ring) - if e == 0: - ret = cache.objectptr.add(ret, c, ret) -diff --git a/src/sage/rings/finite_rings/element_givaro.pxd b/src/sage/rings/finite_rings/element_givaro.pxd -index 68def46..91c4ed7 100644 ---- a/src/sage/rings/finite_rings/element_givaro.pxd -+++ b/src/sage/rings/finite_rings/element_givaro.pxd -@@ -1,9 +1,15 @@ --from sage.structure.element cimport Element, RingElement, ModuleElement --from sage.rings.finite_rings.element_base cimport FinitePolyExtElement -+# distutils: extra_compile_args = GIVARO_CFLAGS -+ -+from libcpp.vector cimport vector -+ctypedef vector[int] intvec -+ -+from libc.stdint cimport int64_t - --from sage.structure.parent cimport Parent -+from sage.rings.finite_rings.element_base cimport FinitePolyExtElement -+from sage.structure.parent cimport Parent - from sage.structure.sage_object cimport SageObject - -+ - cdef extern from "givaro/givconfig.h": - pass - -@@ -13,16 +19,7 @@ cdef extern from "givaro/givrandom.h": - - GivRandom GivRandomSeeded "Givaro::GivRandom"(unsigned long seed) - --cdef extern from "givaro/givgfq.h": -- ctypedef struct intvec "std::vector<unsigned int>": -- void (* push_back)(int elem) -- -- ctypedef struct constintvec "const std::vector<unsigned int>" -- -- intvec intvec_factory "std::vector<unsigned int>"(int len) -- --cdef extern from "givaro/givgfq.h": -- -+cdef extern from "givaro/gfq.h": - ctypedef struct GivaroGfq "Givaro::GFqDom<int>": - #attributes - unsigned int one -@@ -40,10 +37,10 @@ cdef extern from "givaro/givgfq.h": - unsigned int (* cardinality)() - int (* exponent)() - int (* random)(GivRandom gen, int res) -- int (* initi "init")(int res, int e) -+ int (* initi "init")(int res, int64_t e) - int (* initd "init")(int res, double e) - int (* indeterminate)() -- int (* convert)(int r, int p) -+ int (* convert)(int64_t r, int p) - int (* read)(int r, int p) - int (* axpyin)(int r, int a, int x) - int (* axpy)(int r, int a, int b, int c) -@@ -60,7 +57,12 @@ cdef extern from "givaro/givgfq.h": - void delete "delete "(void *o) - int gfq_element_factory "Givaro::GFqDom<int>::Element"() - --cdef class FiniteField_givaroElement(FinitePolyExtElement) #forward declaration -+ -+cdef class FiniteField_givaroElement(FinitePolyExtElement): -+ cdef int element -+ cdef Cache_givaro _cache -+ cdef object _multiplicative_order -+ cdef FiniteField_givaroElement _new_c(self, int value) - - cdef class Cache_givaro(SageObject): - cdef GivaroGfq *objectptr # C++ object -@@ -85,11 +87,4 @@ cdef class FiniteField_givaro_iterator: - cdef int iterator - cdef Cache_givaro _cache - --cdef class FiniteField_givaroElement(FinitePolyExtElement): -- cdef int element -- cdef Cache_givaro _cache -- cdef object _multiplicative_order -- cdef FiniteField_givaroElement _new_c(self, int value) -- -- - cdef inline FiniteField_givaroElement make_FiniteField_givaroElement(Cache_givaro cache, int x) -diff --git a/src/sage/rings/finite_rings/element_givaro.pyx b/src/sage/rings/finite_rings/element_givaro.pyx -index d32b5cf..f2afa44 100644 ---- a/src/sage/rings/finite_rings/element_givaro.pyx -+++ b/src/sage/rings/finite_rings/element_givaro.pyx -@@ -59,8 +59,9 @@ from sage.misc.randstate cimport randstate, current_randstate - from sage.rings.finite_rings.finite_field_base cimport FiniteField - from sage.rings.ring cimport Ring - from element_ext_pari import FiniteField_ext_pariElement --from element_pari_ffelt import FiniteFieldElement_pari_ffelt -+from element_pari_ffelt cimport FiniteFieldElement_pari_ffelt - from sage.structure.sage_object cimport SageObject -+from sage.structure.element cimport Element, ModuleElement, RingElement - import operator - import sage.arith.all - import finite_field_constructor as finite_field -@@ -374,18 +375,16 @@ cdef class Cache_givaro(SageObject): - elif isinstance(e, int) or \ - isinstance(e, Integer) or \ - isinstance(e, long) or is_IntegerMod(e): -- try: -- e_int = e -- except OverflowError: -- e_int = e % self.characteristic() -+ e_int = e % self.characteristic() - res = self.objectptr.initi(res, e_int) - - elif e is None: - e_int = 0 -- res = self.objectptr.initi(res,e_int) -+ res = self.objectptr.initi(res, e_int) - - elif isinstance(e, float): -- res = self.objectptr.initd(res,e) -+ e_int = int(e) % self.characteristic() -+ res = self.objectptr.initd(res, e_int) - - elif isinstance(e, str): - return self.parent(eval(e.replace("^","**"),self.parent.gens_dict())) -@@ -395,8 +394,8 @@ cdef class Cache_givaro(SageObject): - raise TypeError("e.parent must match self.vector_space") - ret = self._zero_element - for i in range(len(e)): -- e_entry = e[i] % self.characteristic() -- res = self.objectptr.initi(res, int(e_entry)) -+ e_int = e[i] % self.characteristic() -+ res = self.objectptr.initi(res, e_int) - to_add = make_FiniteField_givaroElement(self, res) - ret = ret + to_add*self.parent.gen()**i - return ret -@@ -435,8 +434,8 @@ cdef class Cache_givaro(SageObject): - raise ValueError("list is too long") - ret = self._zero_element - for i in range(len(e)): -- e_entry = e[i] % self.characteristic() -- res = self.objectptr.initi(res, int(e_entry)) -+ e_int = e[i] % self.characteristic() -+ res = self.objectptr.initi(res, e_int) - to_add = make_FiniteField_givaroElement(self, res) - ret = ret + to_add*self.parent.gen()**i - return ret -@@ -573,19 +572,17 @@ cdef class Cache_givaro(SageObject): - cdef int ret = k.zero - cdef int a = k.indeterminate() - cdef int at = k.one -- cdef unsigned int ch = k.characteristic() -- cdef int _n, t, i -+ cdef int ch = k.characteristic() -+ cdef int t, i - - if n<0 or n>k.cardinality(): - raise TypeError("n must be between 0 and self.order()") - -- _n = n -- - for i from 0 <= i < k.exponent(): -- t = k.initi(t, _n%ch) -+ t = k.initi(t, n % ch) - ret = k.axpy(ret, t, at, ret) - at = k.mul(at,at,a) -- _n = _n/ch -+ n //= ch - return make_FiniteField_givaroElement(self, ret) - - def _element_repr(self, FiniteField_givaroElement e): -diff --git a/src/sage/rings/finite_rings/finite_field_givaro.py b/src/sage/rings/finite_rings/finite_field_givaro.py -index adbaab3..c431f6d 100644 ---- a/src/sage/rings/finite_rings/finite_field_givaro.py -+++ b/src/sage/rings/finite_rings/finite_field_givaro.py -@@ -270,7 +270,8 @@ class FiniteField_givaro(FiniteField): - sage: k(2) # indirect doctest - 0 - -- Floats coerce in: -+ Floats are converted like integers:: -+ - sage: k(float(2.0)) - 0 - -@@ -344,7 +345,7 @@ class FiniteField_givaro(FiniteField): - sage: k(pari('Mod(1,2)')) - 1 - sage: k(pari('Mod(2,3)')) -- 0 -+ a - sage: k(pari('Mod(1,3)*a^20')) - a^7 + a^5 + a^4 + a^2 - |