summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Schneeberger <michael.schneeberger@fhnw.ch>2023-02-07 10:40:42 +0100
committerMichael Schneeberger <michael.schneeberger@fhnw.ch>2023-02-07 10:40:42 +0100
commit9f089cd7d65d5dea957b7cd159f65868e57e1fae (patch)
tree91b2179b92046a3197d30882aa2c58017ca0d0a9
parentbugfix in eval/substitution operator (diff)
downloadpolymatrix-9f089cd7d65d5dea957b7cd159f65868e57e1fae.tar.gz
polymatrix-9f089cd7d65d5dea957b7cd159f65868e57e1fae.zip
accept polymatrix.Expression in from_sympy_expr()
-rw-r--r--polymatrix/expression/init/initfromsympyexpr.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/polymatrix/expression/init/initfromsympyexpr.py b/polymatrix/expression/init/initfromsympyexpr.py
index 3fb52f7..f8dbd94 100644
--- a/polymatrix/expression/init/initfromsympyexpr.py
+++ b/polymatrix/expression/init/initfromsympyexpr.py
@@ -3,6 +3,7 @@ import numpy as np
import sympy
from polymatrix.expression.impl.fromsympyexprimpl import FromSympyExprImpl
+from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin
def init_from_sympy_expr(
@@ -39,6 +40,9 @@ def init_from_sympy_expr(
case np.number:
data = ((float(data),),)
+ case ExpressionBaseMixin():
+ return data
+
case _:
if not isinstance(data, (float, int, sympy.Expr)):
raise Exception(f'{data=}, {type(data)=}')