summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNao Pross <np@0hm.ch>2024-05-04 22:29:52 +0200
committerNao Pross <np@0hm.ch>2024-05-04 22:29:52 +0200
commit662f53a880943264a4a1eec0f6a020f4e7cd4557 (patch)
treea111f891c3acb2c2d91fcbd9b1d631e454467fa8
parentFix regression in ElemMultExpr (diff)
downloadpolymatrix-662f53a880943264a4a1eec0f6a020f4e7cd4557.tar.gz
polymatrix-662f53a880943264a4a1eec0f6a020f4e7cd4557.zip
Remove circularity in FromSympyExpr by using polymatrix.variable
-rw-r--r--polymatrix/expression/mixins/fromsympyexprmixin.py7
1 files changed, 2 insertions, 5 deletions
diff --git a/polymatrix/expression/mixins/fromsympyexprmixin.py b/polymatrix/expression/mixins/fromsympyexprmixin.py
index 5625651..784ba00 100644
--- a/polymatrix/expression/mixins/fromsympyexprmixin.py
+++ b/polymatrix/expression/mixins/fromsympyexprmixin.py
@@ -15,6 +15,7 @@ from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin
from polymatrix.polymatrix.abc import PolyMatrix
from polymatrix.polymatrix.init import init_poly_matrix
from polymatrix.polymatrix.typing import PolyMatrixDict, PolyDict, MonomialIndex, VariableIndex
+from polymatrix.variable.init import init_variable
class FromSympyExprMixin(ExpressionBaseMixin):
@@ -75,12 +76,8 @@ class FromSympyExprMixin(ExpressionBaseMixin):
"into a polynomial, are you sure it is a polynomial?") from e
# Convert sympy variables to our variables, i.e VariableMixin
- # FIXME: This import cannot be above because of circular imports
- # not sure how I am supposed to fit this in correctly into the
- # dataclass + mixin pattern structure
- from polymatrix.expression.init import init_variable_expr
sympy_to_var = {
- sympy_idx: init_variable_expr(var.name)
+ sympy_idx: init_variable(var.name, shape=(1,1))
for sympy_idx, var in enumerate(sympy_poly.gens)
}