1from .PyPolyBoRi import Polynomial, gauss_on_polys
2from .nf import symmGB_F2_python
3from .interpolate import variety_lex_leading_terms, nf_lex_points
4
5
6def dense_system(I):
7    I = (Polynomial(p) for p in I)
8    I = (p for p in I if not p.is_zero())
9    for p in I:
10        d = p.deg()
11        if p.deg() == 1:
12            continue
13        else:
14            try:
15                if len(p) > 2 ** d + 5:
16                    return True
17            except OverflowError:
18                return True
19    return False
20
21
22def gauss_on_linear(I):
23    I = (Polynomial(p) for p in I)
24    linear = []
25    non_linear = []
26    for p in I:
27        if p.is_zero():
28            continue
29        if p.deg() <= 1:
30            linear.append(p)
31        else:
32            non_linear.append(p)
33    if len(linear) == 0:
34        return non_linear
35    linear = list(gauss_on_polys(linear))
36    return linear + non_linear
37