diff options
Diffstat (limited to 'polymatrix/expression/mixins/degreeexprmixin.py')
-rw-r--r-- | polymatrix/expression/mixins/degreeexprmixin.py | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/polymatrix/expression/mixins/degreeexprmixin.py b/polymatrix/expression/mixins/degreeexprmixin.py index 273add2..71b936a 100644 --- a/polymatrix/expression/mixins/degreeexprmixin.py +++ b/polymatrix/expression/mixins/degreeexprmixin.py @@ -26,26 +26,24 @@ class DegreeExprMixin(ExpressionBaseMixin): ) -> tuple[ExpressionState, PolyMatrix]: state, underlying = self.underlying.apply(state=state) - terms = {} + poly_matrix_data = {} for row in range(underlying.shape[0]): for col in range(underlying.shape[1]): - underlying_terms = underlying.get_poly(row, col) + polynomial = underlying.get_poly(row, col) - if underlying_terms is None or len(underlying_terms) == 0: + if polynomial is None or len(polynomial) == 0: continue def gen_degrees(): - for monomial, _ in underlying_terms.items(): + for monomial, _ in polynomial.items(): yield sum(count for _, count in monomial) - # degrees = tuple(gen_degrees()) - - terms[row, col] = {tuple(): max(gen_degrees())} + poly_matrix_data[row, col] = {tuple(): max(gen_degrees())} poly_matrix = init_poly_matrix( - terms=terms, + data=poly_matrix_data, shape=underlying.shape, ) |