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

Commit

Permalink
speed up check in SymmetricFunctions
Browse files Browse the repository at this point in the history
  • Loading branch information
videlec committed Apr 24, 2020
1 parent ccdd618 commit 4e3cffe
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/sage/combinat/sf/monomial.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,11 @@ def from_polynomial(self, f, check=True):
m[1, 1] + 2*m[2, 1] + 3*m[3]
"""
assert self.base_ring() == f.base_ring()
out = self.sum_of_terms((Partition(e), c)
for (e,c) in six.iteritems(f.dict())
if tuple(sorted(e)) == tuple(reversed(e)))
if check and out.expand(f.parent().ngens(),f.parent().variable_names()) != f:
if check and not f.is_symmetric():
raise ValueError("%s is not a symmetric polynomial"%f)
out = self.sum_of_terms((Partition(e), c)
for (e,c) in f.dict().items()
if all(e[i+1] <= e[i] for i in range(len(e) - 1)))
return out

def from_polynomial_exp(self, p):
Expand Down

0 comments on commit 4e3cffe

Please sign in to comment.