From d3799e1f18a826a399a4553b8ed3cefac003457d Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Sun, 5 May 2024 18:25:16 +0200 Subject: Fix indexing bug in VariableMixin --- polymatrix/expression/mixins/variablemixin.py | 3 ++- polymatrix/expressionstate/mixins.py | 2 +- 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]) -- cgit v1.2.1