From 46ea1406b393c716ff0d4c718a73ec5367643bdb Mon Sep 17 00:00:00 2001 From: Michael Schneeberger Date: Tue, 27 Feb 2024 06:27:10 +0100 Subject: implement function in --- polymatrix/expression/expression.py | 3 +++ polymatrix/expression/utils/getderivativemonomials.py | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/polymatrix/expression/expression.py b/polymatrix/expression/expression.py index f5318ae..6231714 100644 --- a/polymatrix/expression/expression.py +++ b/polymatrix/expression/expression.py @@ -28,6 +28,9 @@ class Expression( def apply(self, state: ExpressionState) -> tuple[ExpressionState, PolyMatrix]: return self.underlying.apply(state) + def read(self, state: ExpressionState) -> PolyMatrix: + return self.apply(state)[1] + def __add__(self, other: ExpressionBaseMixin) -> 'Expression': return self._binary(polymatrix.expression.init.init_addition_expr, self, other) diff --git a/polymatrix/expression/utils/getderivativemonomials.py b/polymatrix/expression/utils/getderivativemonomials.py index 0b74135..a8b2e16 100644 --- a/polymatrix/expression/utils/getderivativemonomials.py +++ b/polymatrix/expression/utils/getderivativemonomials.py @@ -121,5 +121,5 @@ def get_derivative_monomials( ) derivation_terms[diff_monomial] += value - # return state, dict(derivation_terms) - return state, derivation_terms \ No newline at end of file + return state, dict(derivation_terms) + # return state, derivation_terms \ No newline at end of file -- cgit v1.2.1