diff options
author | Nao Pross <np@0hm.ch> | 2024-05-05 18:25:16 +0200 |
---|---|---|
committer | Nao Pross <np@0hm.ch> | 2024-05-05 18:25:16 +0200 |
commit | d3799e1f18a826a399a4553b8ed3cefac003457d (patch) | |
tree | a849d78dec8802174891f487f65a144a8e41a301 | |
parent | Rename polymatrix.typing to polymatrix.index (diff) | |
download | polymatrix-d3799e1f18a826a399a4553b8ed3cefac003457d.tar.gz polymatrix-d3799e1f18a826a399a4553b8ed3cefac003457d.zip |
Fix indexing bug in VariableMixin
-rw-r--r-- | polymatrix/expression/mixins/variablemixin.py | 3 | ||||
-rw-r--r-- | 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]) |