From 9f089cd7d65d5dea957b7cd159f65868e57e1fae Mon Sep 17 00:00:00 2001 From: Michael Schneeberger Date: Tue, 7 Feb 2023 10:40:42 +0100 Subject: accept polymatrix.Expression in from_sympy_expr() --- polymatrix/expression/init/initfromsympyexpr.py | 4 ++++ 1 file changed, 4 insertions(+) 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)=}') -- cgit v1.2.1