/usr/lib/python2.7/dist-packages/brial/interred.py is in python-brial 1.2.0-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | from .PyPolyBoRi import GroebnerStrategy, Polynomial, ReductionStrategy
def interred(l, completely=False):
"""computes a new generating system (g1, ...,gn),
spanning the same ideal modulo field equations.
The system is interreduced: For i!=j:
gi.lead() does not divide any leading term of gj.
If completely is set to True, then also terms in the
tail are not reducible by other polynomials.
"""
l = [Polynomial(p) for p in l if not p == 0]
if not l:
return []
ring = l[0].ring()
l_old = None
l = tuple(l)
while l_old != l:
l_old = l
l = sorted(l, key=Polynomial.lead)
g = ReductionStrategy(ring)
if completely:
g.opt_red_tail = True
for p in l:
p = g.nf(p)
if not p.is_zero():
g.add_generator(p)
l = tuple([e.p for e in g])
return list(l)
|