Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
more cleanup for pbori
Browse files Browse the repository at this point in the history
  • Loading branch information
fchapoton committed Dec 15, 2020
1 parent c4a802d commit dea4c7a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/sage/rings/polynomial/pbori/easy_polynomials.py
Expand Up @@ -6,7 +6,7 @@ def easy_linear_polynomials(p):
r"""
Get linear polynomials implied by given polynomial.
TESTS::
EXAMPLES::
sage: from sage.rings.polynomial.pbori.frontend import *
sage: from sage.rings.polynomial.pbori.easy_polynomials import easy_linear_polynomials
Expand Down
3 changes: 2 additions & 1 deletion src/sage/rings/polynomial/pbori/frontend.py
Expand Up @@ -31,7 +31,8 @@
"""


from . import *
from .PyPolyBoRi import Ring, Monomial, Polynomial
from .pbori import VariableFactory
from .blocks import declare_ring as orig_declare_ring


Expand Down
22 changes: 9 additions & 13 deletions src/sage/rings/polynomial/pbori/gbcore.py
@@ -1,17 +1,17 @@
from copy import copy
from itertools import chain
from inspect import getfullargspec as getargspec

from .nf import GeneratorLimitExceeded, symmGB_F2_C, symmGB_F2_python
from .PyPolyBoRi import (Monomial, Polynomial,
GroebnerStrategy, OrderCode, ll_red_nf_redsb)
from .ll import eliminate, ll_encode
from copy import copy
from itertools import chain
from .statistics import used_vars_set
from .heuristics import dense_system, gauss_on_linear
from .easy_polynomials import easy_linear_polynomials
from .interpolate import lex_groebner_basis_for_polynomial_via_variety
from .fglm import _fglm

from inspect import getfullargspec as getargspec


def get_options_from_function(f):
(argnames, varargs, varopts, defaults) = getargspec(f)[:4]
Expand All @@ -22,7 +22,7 @@ def filter_oldstyle_options(**options):
filtered = dict()
for key in options:
newkey = key
for prefix in ['', 'use_', 'opt_allow_', 'opt_']:
for prefix in ['use_', 'opt_allow_', 'opt_']:
newkey = newkey.replace(prefix, '')
filtered[newkey] = options[key]
return filtered
Expand Down Expand Up @@ -197,13 +197,9 @@ def make_wrapper(f):
return make_wrapper


def clean_polys(I):
I = list(set((Polynomial(p) for p in I if not Polynomial(p).is_zero())))
return I


def clean_polys_pre(I):
return (clean_polys(I), None)
wrap = (Polynomial(p) for p in I)
return (list(set(p for p in wrap if not p.is_zero())), None)


def gb_with_pre_post_option(option, pre=None,
Expand Down Expand Up @@ -259,14 +255,14 @@ def wrapper(I, **kwds):


def redsb_post(I, state):
if I == []:
if not I:
return []
else:
return I.minimalize_and_tail_reduce()


def minsb_post(I, state):
if I == []:
if not I:
return []
else:
return I.minimalize()
Expand Down
6 changes: 3 additions & 3 deletions src/sage/rings/polynomial/pbori/ll.py
Expand Up @@ -109,15 +109,15 @@ def identity(p):
else:
reduction_function = ll_red_nf_redsb

def llnf(p):
return reduction_function(p, reductors)
reduced_list = []
if optimized:
llnf, reduced_list = eliminate_ll_ranked(linear_leads, rest,
reduction_function=reduction_function,
reduce_ll_system=(not on_the_fly),
prot=prot)
else:
def llnf(p):
return reduction_function(p, reductors)
reduced_list = []
reductors = ll_encode(linear_leads, reduce=(not on_the_fly), prot=prot)
for p in rest:
p = reduction_function(p, reductors)
Expand Down

0 comments on commit dea4c7a

Please sign in to comment.