summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Schneeberger <michael.schneeberger@fhnw.ch>2022-08-17 17:32:12 +0200
committerMichael Schneeberger <michael.schneeberger@fhnw.ch>2022-08-17 17:32:12 +0200
commit80eb68e1601e38bd790bb39250656d711bd2697c (patch)
treeea8bb2ecd8be2123cd2f5b26c07b94c7fa369d7c
parentbugfix: 'get_variable_indices' returns updated state instead of the old state (diff)
downloadpolymatrix-80eb68e1601e38bd790bb39250656d711bd2697c.tar.gz
polymatrix-80eb68e1601e38bd790bb39250656d711bd2697c.zip
add function 'get_key_from_offset'
Diffstat (limited to '')
-rw-r--r--polymatrix/expressionstate/mixins/expressionstatemixin.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/polymatrix/expressionstate/mixins/expressionstatemixin.py b/polymatrix/expressionstate/mixins/expressionstatemixin.py
index 6d2ded3..e08e1eb 100644
--- a/polymatrix/expressionstate/mixins/expressionstatemixin.py
+++ b/polymatrix/expressionstate/mixins/expressionstatemixin.py
@@ -31,11 +31,9 @@ class ExpressionStateMixin(
def auxillary_equations(self) -> dict[int, dict[tuple[int], float]]:
...
- def get_variable_from_offset(self, offset: int):
+ def get_key_from_offset(self, offset: int):
for variable, (start, end) in self.offset_dict.items():
- if offset == start:
- assert end - start == 1, f'{start=}, {end=}, {variable=}'
-
+ if start <= offset < end:
return variable
def register(