aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mdpoly/leaves.py2
-rw-r--r--mdpoly/types.py6
2 files changed, 4 insertions, 4 deletions
diff --git a/mdpoly/leaves.py b/mdpoly/leaves.py
index 4032ead..8a018e6 100644
--- a/mdpoly/leaves.py
+++ b/mdpoly/leaves.py
@@ -49,7 +49,7 @@ class Var(Leaf, HasRepr):
def to_repr(self, repr_type: type[T], state: State) -> T:
r = repr_type()
- idx = PolyVarIndex(varindex=state.index(self), power=1)
+ idx = PolyVarIndex.of_var(self, state),
r.set(MatrixIndex.scalar, PolyIndex(idx), 1)
return r, state
diff --git a/mdpoly/types.py b/mdpoly/types.py
index a0ea671..0a4c68e 100644
--- a/mdpoly/types.py
+++ b/mdpoly/types.py
@@ -70,18 +70,18 @@ class PolyVarIndex(NamedTuple):
Concretely this represents things like x^2, y^4
"""
- varindex: int
+ var_idx: int # Index in State.variables, not variable!
power: Number
@classmethod
@property
def constant(cls):
""" Special index for constants, which have no variable """
- return cls(varindex=-1, power=0)
+ return cls(var_idx=-1, power=0)
@classmethod
def of_var(cls, variable: Var, state: State, power: Number =1) -> Self:
- return cls(varindex=state.index(variable), power=power)
+ return cls(var_idx=state.index(variable), power=power)
class PolyIndex(tuple[PolyVarIndex]):