diff options
Diffstat (limited to '')
-rw-r--r-- | mdpoly/types.py | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/mdpoly/types.py b/mdpoly/types.py index 14847fa..29e7b83 100644 --- a/mdpoly/types.py +++ b/mdpoly/types.py @@ -50,13 +50,31 @@ class MatrixIndex(NamedTuple): return cls(row, col) -class PolyTermIndex(NamedTuple): - term: int +class PolyVarIndex(NamedTuple): + """ + Tuple to index a power of a variable. + + Concretely this represents things like x^2, y^4 + """ + varindex: int power: Number -class PolyIndex: +class PolyIndex(tuple[PolyVarIndex]): """ Tuple to index a coefficient of a polynomial. + + Example: + + Suppose there are two variables x, y with indices 0, 1 respectively. + Then the monomal xy^2 has PolyIndex + + (PolyVarIndex(varindex=0, power=1), PolyVarIndex(varindex=1, power=2) + + Then given the polynomial + + p(x, y) = 3x^2 + 5xy^2 + + The with the PolyIndex above we can retrieve the coefficient 5 in front + of xy^2. """ - indices: tuple[PolyTermIndex] |