passagemath-brial 10.6.38__cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- passagemath_brial/__init__.py +3 -0
- passagemath_brial-10.6.38.dist-info/METADATA +97 -0
- passagemath_brial-10.6.38.dist-info/RECORD +39 -0
- passagemath_brial-10.6.38.dist-info/WHEEL +6 -0
- passagemath_brial-10.6.38.dist-info/top_level.txt +3 -0
- passagemath_brial.libs/libbrial-c4edc49f.so.3.0.7 +0 -0
- passagemath_brial.libs/libbrial_groebner-630cf042.so.3.0.7 +0 -0
- passagemath_brial.libs/libgmp-6e109695.so.10.5.0 +0 -0
- passagemath_brial.libs/libm4ri-9da2b874.so.1.0.0 +0 -0
- passagemath_brial.libs/libpng16-b4a91cd1.so.16.43.0 +0 -0
- sage/all__sagemath_brial.py +9 -0
- sage/libs/all__sagemath_brial.py +1 -0
- sage/libs/polybori/__init__.pxd +2 -0
- sage/libs/polybori/decl.pxd +401 -0
- sage/libs/polybori/pb_wrap.h +133 -0
- sage/rings/all__sagemath_brial.py +1 -0
- sage/rings/polynomial/all__sagemath_brial.py +1 -0
- sage/rings/polynomial/pbori/PyPolyBoRi.py +123 -0
- sage/rings/polynomial/pbori/__init__.py +44 -0
- sage/rings/polynomial/pbori/blocks.py +443 -0
- sage/rings/polynomial/pbori/cnf.py +241 -0
- sage/rings/polynomial/pbori/easy_polynomials.py +56 -0
- sage/rings/polynomial/pbori/fglm.py +93 -0
- sage/rings/polynomial/pbori/frontend.py +70 -0
- sage/rings/polynomial/pbori/gbcore.py +634 -0
- sage/rings/polynomial/pbori/gbrefs.py +127 -0
- sage/rings/polynomial/pbori/heuristics.py +35 -0
- sage/rings/polynomial/pbori/interpolate.py +115 -0
- sage/rings/polynomial/pbori/interred.py +35 -0
- sage/rings/polynomial/pbori/ll.py +292 -0
- sage/rings/polynomial/pbori/nf.py +662 -0
- sage/rings/polynomial/pbori/parallel.py +298 -0
- sage/rings/polynomial/pbori/pbori.cpython-313-x86_64-linux-gnu.so +0 -0
- sage/rings/polynomial/pbori/pbori.pxd +127 -0
- sage/rings/polynomial/pbori/pbori.pyx +8107 -0
- sage/rings/polynomial/pbori/randompoly.py +105 -0
- sage/rings/polynomial/pbori/rank.py +27 -0
- sage/rings/polynomial/pbori/specialsets.py +112 -0
- sage/rings/polynomial/pbori/statistics.py +31 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# sage_setup: distribution = sagemath-brial
|
|
2
|
+
# sage.doctest: needs sage.rings.polynomial.pbori
|
|
3
|
+
from .interpolate import variety_lex_leading_terms, nf_lex_points
|
|
4
|
+
from .pbori import easy_linear_factors
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def easy_linear_polynomials(p):
|
|
8
|
+
r"""
|
|
9
|
+
Get linear polynomials implied by given polynomial.
|
|
10
|
+
|
|
11
|
+
EXAMPLES::
|
|
12
|
+
|
|
13
|
+
sage: from sage.rings.polynomial.pbori.frontend import x
|
|
14
|
+
sage: from sage.rings.polynomial.pbori.easy_polynomials import easy_linear_polynomials
|
|
15
|
+
sage: easy_linear_polynomials(x(1)*x(2) + 1)
|
|
16
|
+
[x(1) + 1, x(2) + 1]
|
|
17
|
+
sage: easy_linear_polynomials(x(1)*x(2) + 0)
|
|
18
|
+
[]
|
|
19
|
+
sage: easy_linear_polynomials(x(0)*x(1) + x(0)*x(2) + 1)
|
|
20
|
+
[x(0) + 1, x(1) + x(2) + 1]
|
|
21
|
+
"""
|
|
22
|
+
res = []
|
|
23
|
+
if p.deg() >= 2:
|
|
24
|
+
if p.vars_as_monomial().deg() > 8:
|
|
25
|
+
res.extend(q + 1 for q in easy_linear_factors(p + 1))
|
|
26
|
+
else:
|
|
27
|
+
res = easy_linear_polynomials_via_interpolation(p)
|
|
28
|
+
return res
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def easy_linear_polynomials_via_interpolation(p):
|
|
32
|
+
r"""
|
|
33
|
+
Get linear polynomials implied by given polynomial using interpolation of the variety.
|
|
34
|
+
|
|
35
|
+
TESTS::
|
|
36
|
+
|
|
37
|
+
sage: from sage.rings.polynomial.pbori.frontend import x
|
|
38
|
+
sage: from sage.rings.polynomial.pbori.easy_polynomials import easy_linear_polynomials_via_interpolation
|
|
39
|
+
sage: easy_linear_polynomials_via_interpolation(x(1)*x(2) + 1)
|
|
40
|
+
[x(1) + 1, x(2) + 1]
|
|
41
|
+
sage: easy_linear_polynomials_via_interpolation(x(1)*x(2) + 0)
|
|
42
|
+
[]
|
|
43
|
+
sage: easy_linear_polynomials_via_interpolation(x(0)*x(1) + x(0)*x(2) + 1)
|
|
44
|
+
[x(0) + 1, x(1) + x(2) + 1]
|
|
45
|
+
"""
|
|
46
|
+
res = []
|
|
47
|
+
p_vars = p.vars_as_monomial()
|
|
48
|
+
space = p_vars.divisors()
|
|
49
|
+
zeros = p.zeros_in(space)
|
|
50
|
+
lex_leads = variety_lex_leading_terms(zeros, p_vars)
|
|
51
|
+
for m in lex_leads:
|
|
52
|
+
if m.deg() == 1:
|
|
53
|
+
red = m + nf_lex_points(m, zeros)
|
|
54
|
+
if red.lead_deg() == 1: # normal ordering
|
|
55
|
+
res.append(red)
|
|
56
|
+
return res
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# sage_setup: distribution = sagemath-brial
|
|
2
|
+
# sage.doctest: needs sage.rings.polynomial.pbori
|
|
3
|
+
from .pbori import BooleSet, FGLMStrategy
|
|
4
|
+
from .PyPolyBoRi import BoolePolynomialVector, Polynomial
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def _fglm(I, from_ring, to_ring):
|
|
8
|
+
r"""
|
|
9
|
+
Unchecked variant of fglm
|
|
10
|
+
"""
|
|
11
|
+
vec = BoolePolynomialVector(I)
|
|
12
|
+
return FGLMStrategy(from_ring, to_ring, vec).main()
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def fglm(I, from_ring, to_ring):
|
|
16
|
+
r"""
|
|
17
|
+
Convert *reduced* Groebner Basis in ``from_ring`` to a GroebnerBasis
|
|
18
|
+
in ``to_ring``.
|
|
19
|
+
|
|
20
|
+
It acts independent of the global ring, which is restored at the end of the
|
|
21
|
+
computation.
|
|
22
|
+
|
|
23
|
+
TESTS::
|
|
24
|
+
|
|
25
|
+
sage: from sage.rings.polynomial.pbori import *
|
|
26
|
+
sage: from sage.rings.polynomial.pbori.PyPolyBoRi import OrderCode
|
|
27
|
+
sage: dp_asc = OrderCode.dp_asc
|
|
28
|
+
sage: r=declare_ring(['x','y','z'],dict())
|
|
29
|
+
sage: old_ring = r
|
|
30
|
+
sage: new_ring = old_ring.clone(ordering=dp_asc)
|
|
31
|
+
sage: (x,y,z) = [old_ring.variable(i) for i in range(3)]
|
|
32
|
+
sage: ideal=[x+z, y+z]# lp Groebner basis
|
|
33
|
+
sage: from sage.rings.polynomial.pbori.fglm import fglm
|
|
34
|
+
sage: list(fglm(ideal, old_ring, new_ring))
|
|
35
|
+
[y + x, z + x]
|
|
36
|
+
"""
|
|
37
|
+
for poly in I:
|
|
38
|
+
if poly.ring().id() != from_ring.id():
|
|
39
|
+
raise ValueError("Ideal I must be from the first ring argument")
|
|
40
|
+
return _fglm(I, from_ring, to_ring)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def vars_real_divisors(monomial, monomial_set):
|
|
44
|
+
r"""
|
|
45
|
+
Return all elements of ``monomial_set``, which result multiplied by a variable in monomial.
|
|
46
|
+
|
|
47
|
+
EXAMPLES::
|
|
48
|
+
|
|
49
|
+
sage: from sage.rings.polynomial.pbori.pbori import *
|
|
50
|
+
sage: from sage.rings.polynomial.pbori.PyPolyBoRi import OrderCode
|
|
51
|
+
sage: dp_asc = OrderCode.dp_asc
|
|
52
|
+
sage: from sage.rings.polynomial.pbori.PyPolyBoRi import Ring
|
|
53
|
+
sage: r = Ring(1000)
|
|
54
|
+
sage: x = r.variable
|
|
55
|
+
sage: b = BooleSet([x(1)*x(2),x(2)])
|
|
56
|
+
sage: from sage.rings.polynomial.pbori.fglm import vars_real_divisors
|
|
57
|
+
sage: vars_real_divisors(x(1)*x(2)*x(3),b)
|
|
58
|
+
{{x(1),x(2)}}
|
|
59
|
+
"""
|
|
60
|
+
return BooleSet(Polynomial(monomial_set.divisors_of(monomial)).
|
|
61
|
+
graded_part(monomial.deg() - 1))
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def m_k_plus_one(completed_elements, variables):
|
|
65
|
+
r"""
|
|
66
|
+
Calculate `m_{k+1}` from the FGLM algorithm.
|
|
67
|
+
|
|
68
|
+
Calculate `m_{k+1}` from the FGLM algorithm as described in Wichmann [Wich1997]_.
|
|
69
|
+
|
|
70
|
+
.. NOTE::
|
|
71
|
+
|
|
72
|
+
It would be nice to be able to efficiently extract the smallest term of a polynomial.
|
|
73
|
+
|
|
74
|
+
EXAMPLES::
|
|
75
|
+
|
|
76
|
+
sage: from sage.rings.polynomial.pbori.pbori import *
|
|
77
|
+
sage: from sage.rings.polynomial.pbori.PyPolyBoRi import OrderCode
|
|
78
|
+
sage: from sage.rings.polynomial.pbori.fglm import m_k_plus_one
|
|
79
|
+
sage: dp_asc = OrderCode.dp_asc
|
|
80
|
+
sage: from sage.rings.polynomial.pbori.PyPolyBoRi import Ring
|
|
81
|
+
sage: r = Ring(1000)
|
|
82
|
+
sage: x = r.variable
|
|
83
|
+
sage: from sage.rings.polynomial.pbori.PyPolyBoRi import Monomial
|
|
84
|
+
sage: s = BooleSet([x(1)*x(2),x(1),x(2),Monomial(r),x(3)])
|
|
85
|
+
sage: variables = BooleSet([x(1),x(2),x(3)])
|
|
86
|
+
sage: m_k_plus_one(s,variables)
|
|
87
|
+
x(2)*x(3)
|
|
88
|
+
sage: r2 = r.clone(ordering=dp_asc)
|
|
89
|
+
sage: m_k_plus_one(r2(s).set(),r2(variables).set())
|
|
90
|
+
x(1)*x(3)
|
|
91
|
+
"""
|
|
92
|
+
return sorted(completed_elements.cartesian_product(variables).diff(
|
|
93
|
+
completed_elements))[0]
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# sage_setup: distribution = sagemath-brial
|
|
2
|
+
# sage.doctest: needs sage.rings.polynomial.pbori
|
|
3
|
+
# Import basic functionality
|
|
4
|
+
r"""
|
|
5
|
+
This module defines an initial ring, and patches the declare_ring to use
|
|
6
|
+
a given context.
|
|
7
|
+
|
|
8
|
+
EXAMPLES::
|
|
9
|
+
|
|
10
|
+
sage: from sage.rings.polynomial.pbori.frontend import x
|
|
11
|
+
sage: x(0)
|
|
12
|
+
x(0)
|
|
13
|
+
sage: x(0)*x(0)
|
|
14
|
+
x(0)
|
|
15
|
+
sage: x(0) + x(0)
|
|
16
|
+
0
|
|
17
|
+
sage: x(9999)
|
|
18
|
+
x(9999)
|
|
19
|
+
sage: x(9999)*x(9999)
|
|
20
|
+
x(9999)
|
|
21
|
+
sage: x(9999) + x(9999)
|
|
22
|
+
0
|
|
23
|
+
|
|
24
|
+
sage: from sage.rings.polynomial.pbori.frontend import x, polybori_start
|
|
25
|
+
sage: context = dict(globals())
|
|
26
|
+
sage: polybori_start(context)
|
|
27
|
+
ipbori...
|
|
28
|
+
sage: r = context['declare_ring']('abc')
|
|
29
|
+
sage: context['a']
|
|
30
|
+
a
|
|
31
|
+
sage: r.variable(0)
|
|
32
|
+
a
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
from .PyPolyBoRi import Ring
|
|
37
|
+
from .pbori import VariableFactory
|
|
38
|
+
from .blocks import declare_ring as orig_declare_ring
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def block_scheme_names(blocks):
|
|
42
|
+
r"""
|
|
43
|
+
Helper for Singular interface.
|
|
44
|
+
"""
|
|
45
|
+
context = {}
|
|
46
|
+
from .blocks import declare_block_scheme
|
|
47
|
+
declare_block_scheme(blocks, context)
|
|
48
|
+
|
|
49
|
+
return list(context.keys())
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
ipbname = 'ipbori'
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def polybori_start(global_context):
|
|
56
|
+
def declare_ring(blocks, context=None):
|
|
57
|
+
if context is None:
|
|
58
|
+
context = global_context
|
|
59
|
+
|
|
60
|
+
return orig_declare_ring(blocks, context)
|
|
61
|
+
declare_ring.__doc__ = orig_declare_ring.__doc__
|
|
62
|
+
global_context["declare_ring"] = declare_ring
|
|
63
|
+
|
|
64
|
+
print(ipbname + """ -- The interactive command line tool of PolyBoRi/BRiAL %s
|
|
65
|
+
""" % global_context.get("polybori_version", ''))
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
# Here come the defaults
|
|
69
|
+
r = Ring(10000)
|
|
70
|
+
x = VariableFactory(r)
|