summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Schneeberger <michael.schneeberger@fhnw.ch>2024-05-07 15:16:40 +0200
committerMichael Schneeberger <michael.schneeberger@fhnw.ch>2024-05-07 15:16:40 +0200
commit5b400c6da87a524ca6fee02bad18b9adfc90bff7 (patch)
tree05c00fed7ed0266b257fb7925c4fc0b40aecac8b
parentrename and comment monomial_to_monomial_vector_indices (diff)
downloadpolymatrix-5b400c6da87a524ca6fee02bad18b9adfc90bff7.tar.gz
polymatrix-5b400c6da87a524ca6fee02bad18b9adfc90bff7.zip
add example of degree 3 in docstring of monomial_to_monomial_vector_indices
-rw-r--r--polymatrix/denserepr/utils/monomialtoindex.py12
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)