diff options
-rw-r--r-- | polymatrix/denserepr/utils/monomialtoindex.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/polymatrix/denserepr/utils/monomialtoindex.py b/polymatrix/denserepr/utils/monomialtoindex.py index 151e8bf..5520dd9 100644 --- a/polymatrix/denserepr/utils/monomialtoindex.py +++ b/polymatrix/denserepr/utils/monomialtoindex.py @@ -8,13 +8,19 @@ def monomial_to_monomial_vector_indices( ) -> set[int]: """ Given a monomial of degree d, this function returns the indices of a monomial - vector containing monomial of the same degree. + vector containing monomials of the same degree. Given the variable mapping {x : 0, y : 1}, the monomial x*y of the monomial vector - z = [x**2 x*y x*y y**2] + z = [x**2, x*y, x*y, y**2] - results in indices = (1, 2). + results in indices = (1, 2). + + Or, the monomial x*y**2 of the monomial vector + + z = [x**3, x**2*y, x**2*y, x*y**2, x**2*y, x*y**2, x*y**2, y**3] + + results in indices = (3, 5, 6) """ variable_indices_perm = itertools.permutations(variable_indices) |