summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Schneeberger <michael.schneeberger@fhnw.ch>2024-02-27 06:27:10 +0100
committerMichael Schneeberger <michael.schneeberger@fhnw.ch>2024-02-27 06:27:10 +0100
commit46ea1406b393c716ff0d4c718a73ec5367643bdb (patch)
treea4c7fa149f8ecf5d3ad8349d59ee841777e8462a
parentupdate readme (diff)
downloadpolymatrix-46ea1406b393c716ff0d4c718a73ec5367643bdb.tar.gz
polymatrix-46ea1406b393c716ff0d4c718a73ec5367643bdb.zip
implement function in
-rw-r--r--polymatrix/expression/expression.py3
-rw-r--r--polymatrix/expression/utils/getderivativemonomials.py4
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