diff options
author | Michael Schneeberger <michael.schneeberger@fhnw.ch> | 2022-08-17 17:32:12 +0200 |
---|---|---|
committer | Michael Schneeberger <michael.schneeberger@fhnw.ch> | 2022-08-17 17:32:12 +0200 |
commit | 80eb68e1601e38bd790bb39250656d711bd2697c (patch) | |
tree | ea8bb2ecd8be2123cd2f5b26c07b94c7fa369d7c | |
parent | bugfix: 'get_variable_indices' returns updated state instead of the old state (diff) | |
download | polymatrix-80eb68e1601e38bd790bb39250656d711bd2697c.tar.gz polymatrix-80eb68e1601e38bd790bb39250656d711bd2697c.zip |
add function 'get_key_from_offset'
-rw-r--r-- | polymatrix/expressionstate/mixins/expressionstatemixin.py | 6 |
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( |