/usr/lib/python2.7/dist-packages/brial/statistics.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 | from .PyPolyBoRi import Monomial, Polynomial, top_index, BooleConstant
def used_vars(l, bound=None):
if not l:
return BooleConstant(1)
m = Monomial(Polynomial(next(iter(l))).vars_as_monomial())
for p in l[1:]:
m = m * Polynomial(p).vars_as_monomial()
if bound and len(m) > bound:
return m
return m
def used_vars_set(l, bound=None):
if not l:
return BooleConstant(1)
s = set()
for p in l:
s.update(Polynomial(p).vars_as_monomial().variables())
if bound and len(s) > bound:
break
sorted_s = sorted(list(s), key=top_index, reverse=True)
m = Monomial(iter(l).next().ring())
for v in sorted_s:
m = v * m
return m
|