summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNao Pross <np@0hm.ch>2024-05-05 18:25:16 +0200
committerNao Pross <np@0hm.ch>2024-05-05 18:25:16 +0200
commitd3799e1f18a826a399a4553b8ed3cefac003457d (patch)
treea849d78dec8802174891f487f65a144a8e41a301
parentRename polymatrix.typing to polymatrix.index (diff)
downloadpolymatrix-d3799e1f18a826a399a4553b8ed3cefac003457d.tar.gz
polymatrix-d3799e1f18a826a399a4553b8ed3cefac003457d.zip
Fix indexing bug in VariableMixin
Diffstat (limited to '')
-rw-r--r--polymatrix/expression/mixins/variablemixin.py3
-rw-r--r--polymatrix/expressionstate/mixins.py2
2 files changed, 3 insertions, 2 deletions
diff --git a/polymatrix/expression/mixins/variablemixin.py b/polymatrix/expression/mixins/variablemixin.py
index ffac1f8..6a79f27 100644
--- a/polymatrix/expression/mixins/variablemixin.py
+++ b/polymatrix/expression/mixins/variablemixin.py
@@ -19,7 +19,8 @@ class VariableMixin(ExpressionBaseMixin, Variable):
@override
def apply(self, state: ExpressionStateMixin) -> tuple[ExpressionStateMixin, PolyMatrixMixin]:
- state, indices = state.index(self)
+ state = state.register(self)
+ indices = state.get_indices(self)
p = PolyMatrixDict()
rows, cols = self.shape
diff --git a/polymatrix/expressionstate/mixins.py b/polymatrix/expressionstate/mixins.py
index e4da232..71add07 100644
--- a/polymatrix/expressionstate/mixins.py
+++ b/polymatrix/expressionstate/mixins.py
@@ -70,7 +70,7 @@ class ExpressionStateMixin(
the variables, one for each entry.
"""
if var not in self.indices:
- raise IndexError(f"There is no variable with index {index}.")
+ raise IndexError(f"There is no variable {var} in this state object.")
yield from range(*self.indices[var])