Skip to content

Commit c1228b2

Browse files
author
Release Manager
committed
gh-40628: support ideals over finite fields where p > 2^29 <!-- ^ Please provide a concise and informative title. --> Currently, doing `Ideal(...).variety()` on an ideal over a multivariate polynomial over a finite field with p > 2^29, gives us this: ``` RuntimeError: error in Singular function call 'triangLfak': not implemented for rings with rings as coeffients error occurred in or before triang.lib::faktorisiere_letzten line 1091: ` factors = factorize(h[nh],1);` leaving triang.lib::faktorisiere_letzten (1087) leaving triang.lib::triangLbas (262) ``` This PR uses the toy implementation of `.variety` in that cases <!-- ^ Don't put issue numbers in the title, do this in the PR description below. --> <!-- ^ For example, instead of "Fixes #12345" use "Introduce new method to calculate 1 + 2". --> <!-- v Describe your changes below in detail. --> <!-- v Why is this change required? What problem does it solve? --> <!-- v If this PR resolves an open issue, please link to it here. For example, "Fixes #12345". --> ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [ ] I have linked a relevant issue or discussion. - [x] I have created tests covering the changes. - [ ] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - #12345: short description why this is a dependency --> <!-- - #34567: ... --> URL: #40628 Reported by: Arthur Reviewer(s): Arthur, user202729, Vincent Macri
2 parents ada2dbf + 6713c46 commit c1228b2

File tree

2 files changed

+25
-4
lines changed

2 files changed

+25
-4
lines changed

src/sage/rings/polynomial/multi_polynomial_ideal.py

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2760,6 +2760,21 @@ def _variety_triangular_decomposition(self, ring):
27602760
sage: I = Ideal([ x*y - 1, (x-2)^2 + (y-1)^2 - 1])
27612761
sage: len(I.variety())
27622762
4
2763+
2764+
We can compute the variety of an Ideal over a Multivariate Polynomial Ring over a finite field with characteristic `> 2^{29}`, which Singular doesn't support. ::
2765+
2766+
sage: p = 626526183415513590854084217045148362725470879166437124330209
2767+
sage: F = GF(p)
2768+
sage: R.<x,y,z> = F[]
2769+
sage: I = Ideal([x^2 - 5*y + z, x*21 + y - z, 20*x + 20*y - 15*z + 20])
2770+
sage: I.variety()
2771+
verbose 0 (...: multi_polynomial_ideal.py, variety) Warning: falling back to very slow toy implementation.
2772+
[{z: 475236874226935968499387140880743357810239093941490264140142,
2773+
y: 303497730986201757454241700121162099180641015844366285478588,
2774+
x: 366193016391757014347340764061969600539773744194969974791622},
2775+
{z: 151289309188577622354697076164405004915231785224946860207259,
2776+
y: 323028452429311833399842516923986263544829863322070838864298,
2777+
x: 260333167023756576506743452983178762185697134971467149538802}]
27632778
"""
27642779

27652780
def _variety(T, V, v=None):
@@ -2802,10 +2817,14 @@ def _variety(T, V, v=None):
28022817
P = self.ring()
28032818
if ring is not None:
28042819
P = P.change_ring(ring)
2805-
try:
2806-
TI = self.triangular_decomposition('singular:triangLfak')
2807-
T = [list(each.gens()) for each in TI]
2808-
except TypeError: # conversion to Singular not supported
2820+
T = None
2821+
if P.characteristic() < 2**29:
2822+
try:
2823+
TI = self.triangular_decomposition('singular:triangLfak')
2824+
T = [list(each.gens()) for each in TI]
2825+
except TypeError: # conversion to Singular not supported
2826+
pass
2827+
if T is None:
28092828
if self.ring().term_order().is_global():
28102829
verbose("Warning: falling back to very slow toy implementation.", level=0, caller_name='variety')
28112830
T = toy_variety.triangular_factorization(self.groebner_basis())

src/sage/rings/polynomial/multi_polynomial_libsingular.pyx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4662,6 +4662,8 @@ cdef class MPolynomial_libsingular(MPolynomial_libsingular_base):
46624662
sig_off()
46634663
finally:
46644664
if check_error():
4665+
if len(self.variables()) == 1:
4666+
return Factorization([(self._parent(p), e) for p, e in self.univariate_polynomial().factor()])
46654667
raise NotImplementedError("Factorization of multivariate polynomials over prime fields with characteristic > 2^29 is not implemented.")
46664668

46674669
ivv = iv.ivGetVec()

0 commit comments

Comments
 (0)