void-packages/srcpkgs/sagemath/patches/35934-singular_4.3.2p7.patch

222 lines
9.1 KiB
Diff

diff --git a/build/pkgs/singular/checksums.ini b/build/pkgs/singular/checksums.ini
index 313463d2fea..1101fc55700 100644
--- a/build/pkgs/singular/checksums.ini
+++ b/build/pkgs/singular/checksums.ini
@@ -1,5 +1,5 @@
tarball=singular-VERSION.tar.gz
-sha1=28bb3ee97ef48d04dfa96de182fd93eebe08426c
-md5=fc0a4f5720dadba45a52ee94324ce00c
-cksum=1573851737
-upstream_url=ftp://jim.mathematik.uni-kl.de/pub/Math/Singular/SOURCES/4-3-1/singular-VERSION.tar.gz
+sha1=df1997f412580f2073295aba569bb955ad227317
+md5=50349213e206a18cdaa1bc410dde7ea4
+cksum=376854707
+upstream_url=ftp://jim.mathematik.uni-kl.de/pub/Math/Singular/SOURCES/4-3-2/singular-VERSION.tar.gz
diff --git a/build/pkgs/singular/package-version.txt b/build/pkgs/singular/package-version.txt
index 66e2bede53a..9f1bf008217 100644
--- a/build/pkgs/singular/package-version.txt
+++ b/build/pkgs/singular/package-version.txt
@@ -1 +1 @@
-4.3.1p3
+4.3.2p7
diff --git a/build/pkgs/singular/spkg-configure.m4 b/build/pkgs/singular/spkg-configure.m4
index 6a85631f624..f7621ec5fa1 100644
--- a/build/pkgs/singular/spkg-configure.m4
+++ b/build/pkgs/singular/spkg-configure.m4
@@ -6,14 +6,27 @@ SAGE_SPKG_CONFIGURE([singular], [
AS_IF([test -z "${SINGULAR_BIN}"], [sage_spkg_install_singular=yes], [
dnl Use pkg-config to ensure that Singular is new enough.
PKG_CHECK_MODULES([SINGULAR], [Singular >= 4.2.1], [
- AC_MSG_CHECKING([that Singular's help is working])
- AS_IF([test x`printf "system(\"--browser\", \"builtin\"); \n help;" | Singular 2>&1 | grep "error occurred"` = x], [
- AC_MSG_RESULT(yes)
- ], [
- AC_MSG_RESULT(no)
- sage_spkg_install_singular=yes
- ]
- )], [
+ AC_MSG_CHECKING([whether Singular is built with FLINT])
+ AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM([
+ #include <singular/singularconfig.h>
+ #if !defined(HAVE_FLINT)
+ # error "Need Singular compiled with FLINT"
+ ], [])
+ ], [
+ AC_MSG_RESULT([yes])
+ AC_MSG_CHECKING([that Singular's help is working])
+ AS_IF([test x`printf "system(\"--browser\", \"builtin\"); \n help;" | Singular 2>&1 | grep "error occurred"` = x], [
+ AC_MSG_RESULT(yes)
+ ], [
+ AC_MSG_RESULT(no)
+ sage_spkg_install_singular=yes
+ ])
+ ], [
+ AC_MSG_RESULT([no])
+ sage_spkg_install_singular=yes
+ ])
+ ], [
dnl pkg-config version check failed
sage_spkg_install_singular=yes
])
diff --git a/src/sage/interfaces/singular.py b/src/sage/interfaces/singular.py
index b15cc1c602c..4b5c76e2bfa 100644
--- a/src/sage/interfaces/singular.py
+++ b/src/sage/interfaces/singular.py
@@ -604,8 +604,7 @@ def eval(self, x, allow_semicolon=True, strip=True, **kwds):
sage: i = singular.ideal(['x^2','y^2','z^2'])
sage: s = i.std()
sage: singular.eval('hilb(%s)'%(s.name()))
- '// 1 t^0\n// -3 t^2\n// 3 t^4\n// -1 t^6\n\n// 1 t^0\n//
- 3 t^1\n// 3 t^2\n// 1 t^3\n// dimension (affine) = 0\n//
+ '...// dimension (affine) = 0\n//
degree (affine) = 8'
::
@@ -613,15 +612,7 @@ def eval(self, x, allow_semicolon=True, strip=True, **kwds):
sage: from sage.misc.verbose import set_verbose
sage: set_verbose(1)
sage: o = singular.eval('hilb(%s)'%(s.name()))
- // 1 t^0
- // -3 t^2
- // 3 t^4
- // -1 t^6
- // 1 t^0
- // 3 t^1
- // 3 t^2
- // 1 t^3
- // dimension (affine) = 0
+ ...// dimension (affine) = 0
// degree (affine) = 8
This is mainly useful if this method is called implicitly. Because
@@ -631,15 +622,7 @@ def eval(self, x, allow_semicolon=True, strip=True, **kwds):
::
sage: o = s.hilb()
- // 1 t^0
- // -3 t^2
- // 3 t^4
- // -1 t^6
- // 1 t^0
- // 3 t^1
- // 3 t^2
- // 1 t^3
- // dimension (affine) = 0
+ ...// dimension (affine) = 0
// degree (affine) = 8
// ** right side is not a datum, assignment ignored
...
diff --git a/src/sage/libs/singular/function.pyx b/src/sage/libs/singular/function.pyx
index f40346d1fd0..c597c63aafe 100644
--- a/src/sage/libs/singular/function.pyx
+++ b/src/sage/libs/singular/function.pyx
@@ -1241,32 +1241,22 @@ cdef class SingularFunction(SageObject):
sage: I = Ideal([x^3*y^2 + 3*x^2*y^2*z + y^3*z^2 + z^5])
sage: I = Ideal(I.groebner_basis())
sage: hilb = sage.libs.singular.function_factory.ff.hilb
- sage: hilb(I) # Singular will print // ** _ is no standard basis
- // ** _ is no standard basis
- // 1 t^0
- // -1 t^5
- <BLANKLINE>
- // 1 t^0
- // 1 t^1
- // 1 t^2
- // 1 t^3
- // 1 t^4
- // dimension (proj.) = 1
- // degree (proj.) = 5
+ sage: from sage.misc.sage_ostools import redirection
+ sage: out = tmp_filename()
+ sage: with redirection(sys.stdout, open(out, 'w')):
+ ....: hilb(I) # Singular will print // ** _ is no standard basis
+ sage: with open(out) as f:
+ ....: 'is no standard basis' in f.read()
+ True
So we tell Singular that ``I`` is indeed a Groebner basis::
- sage: hilb(I,attributes={I:{'isSB':1}}) # no complaint from Singular
- // 1 t^0
- // -1 t^5
- <BLANKLINE>
- // 1 t^0
- // 1 t^1
- // 1 t^2
- // 1 t^3
- // 1 t^4
- // dimension (proj.) = 1
- // degree (proj.) = 5
+ sage: out = tmp_filename()
+ sage: with redirection(sys.stdout, open(out, 'w')):
+ ....: hilb(I,attributes={I:{'isSB':1}}) # no complaint from Singular
+ sage: with open(out) as f:
+ ....: 'is no standard basis' in f.read()
+ False
TESTS:
diff --git a/src/sage/rings/polynomial/multi_polynomial_ideal.py b/src/sage/rings/polynomial/multi_polynomial_ideal.py
index 22ada6de947..80352700872 100644
--- a/src/sage/rings/polynomial/multi_polynomial_ideal.py
+++ b/src/sage/rings/polynomial/multi_polynomial_ideal.py
@@ -3132,13 +3132,16 @@ def hilbert_numerator(self, grading=None, algorithm='sage'):
sage: I.hilbert_numerator() # needs sage.rings.number_field
-t^5 + 1
- This example returns a wrong answer due to an integer overflow in Singular::
+ This example returns a wrong answer in singular < 4.3.2p4 due to an integer overflow::
sage: n=4; m=11; P = PolynomialRing(QQ, n*m, "x"); x = P.gens(); M = Matrix(n, x)
sage: I = P.ideal(M.minors(2))
sage: J = P * [m.lm() for m in I.groebner_basis()]
- sage: J.hilbert_numerator(algorithm='singular')
- ...120*t^33 - 3465*t^32 + 48180*t^31 - ...
+ sage: J.hilbert_numerator(algorithm='singular') # known bug
+ Traceback (most recent call last):
+ ....
+ RuntimeError: error in Singular function call 'hilb':
+ overflow at t^22
Our two algorithms should always agree; not tested until
:trac:`33178` is fixed::
diff --git a/src/sage/sandpiles/sandpile.py b/src/sage/sandpiles/sandpile.py
index 02d2021b2fb..c8e15e06f05 100644
--- a/src/sage/sandpiles/sandpile.py
+++ b/src/sage/sandpiles/sandpile.py
@@ -2493,9 +2493,15 @@ def _set_ideal(self):
sage: '_ideal' in S.__dict__
True
"""
+ from sage.libs.singular.function_factory import ff
+ try:
+ sat = ff.elim__lib.sat_with_exp
+ except NameError:
+ sat = ff.elim__lib.sat
R = self.ring()
- I = self._unsaturated_ideal._singular_()
- self._ideal = R.ideal(I.sat(prod(R.gens())._singular_())[1])
+ I = self._unsaturated_ideal
+ I_sat_gens = sat(I, prod(R.gens()))[0]
+ self._ideal = R.ideal(I_sat_gens)
def unsaturated_ideal(self):
r"""
diff --git a/src/sage/schemes/projective/projective_subscheme.py b/src/sage/schemes/projective/projective_subscheme.py
index e6caf19ba74..afd6484d779 100644
--- a/src/sage/schemes/projective/projective_subscheme.py
+++ b/src/sage/schemes/projective/projective_subscheme.py
@@ -1001,7 +1001,10 @@ def dual(self):
for i in range(n + 1):
J = J + S.ideal(z[-1] * f_S.derivative(z[i]) - z[i + n + 1])
- sat = ff.elim__lib.sat
+ try:
+ sat = ff.elim__lib.sat_with_exp
+ except NameError:
+ sat = ff.elim__lib.sat
max_ideal = S.ideal(z[n + 1: 2 * n + 2])
J_sat_gens = sat(J, max_ideal)[0]