diff options
author | Nao Pross <np@0hm.ch> | 2024-05-04 19:11:26 +0200 |
---|---|---|
committer | Nao Pross <np@0hm.ch> | 2024-05-04 19:11:26 +0200 |
commit | 24487bd6466298a66276c5b044011c752fa9aa69 (patch) | |
tree | 48e3c1cc7ee138279f19d3d91b20a21cde1559b0 | |
parent | Remove useless cast (diff) | |
download | polymatrix-24487bd6466298a66276c5b044011c752fa9aa69.tar.gz polymatrix-24487bd6466298a66276c5b044011c752fa9aa69.zip |
Fix regression in polymatrix.to_sympy
-rw-r--r-- | polymatrix/expression/to.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/polymatrix/expression/to.py b/polymatrix/expression/to.py index 2a43c0e..2707fb4 100644 --- a/polymatrix/expression/to.py +++ b/polymatrix/expression/to.py @@ -49,7 +49,8 @@ def to_sympy( expr: Expression, ) -> StateMonadMixin[ExpressionState, sympy.Expr | sympy.Matrix]: - def polymatrix_to_sympy(state: ExpressionState) -> sympy.Expr | sympy.Matrix: + def polymatrix_to_sympy(state: ExpressionState) -> tuple[ExpressionState, sympy.Expr | sympy.Matrix]: + # Convert to polymatrix state, pm = expr.apply(state) @@ -72,7 +73,7 @@ def to_sympy( if math.prod(pm.shape) == 1: # just return the expression - return m[0, 0] + return state, m[0, 0] - return m + return state, m return init_state_monad(polymatrix_to_sympy) |