From 820892a61abd33579659e05ad89fa176c6a2efb0 Mon Sep 17 00:00:00 2001 From: Alberto Luaces Date: Thu, 29 Jun 2017 18:20:30 +0200 Subject: [PATCH] Fix for TypeError: 'sage.rings.polynomial.polydict.ETupleIter' object is not iterable It seems that `m.degrees()` in `expansion.monomials()` was once a list, but now it is an iterator. This fix solves the problem. Nevertheless, SoS is still Greek to me :-) --- simplicity.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simplicity.py b/simplicity.py index ff0f8fd..9c0cd4d 100755 --- a/simplicity.py +++ b/simplicity.py @@ -397,7 +397,7 @@ def simplify(e): with scope('analyze'): permutations = sorted(all_permutations(range(n)),key=permutation_id) sequences = [None]*len(permutations) - unordered = zip([coef_to_id[c] for c in coefficients],[numpy.asarray(m.degrees()).reshape(n,d) for m in expansion.monomials()]) + unordered = zip([coef_to_id[c] for c in coefficients],[numpy.asarray(list(m.degrees())).reshape(n,d) for m in expansion.monomials()]) assert numpy.all(unordered[-1][1]==0) unordered = unordered[:-1] weights = numpy.int64(n)**numpy.arange(n*d).reshape(n,d)