summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--polymatrix/expression/__init__.py5
-rw-r--r--polymatrix/expression/expression.py3
-rw-r--r--polymatrix/expression/init.py3
3 files changed, 10 insertions, 1 deletions
diff --git a/polymatrix/expression/__init__.py b/polymatrix/expression/__init__.py
index a731191..6f7eae2 100644
--- a/polymatrix/expression/__init__.py
+++ b/polymatrix/expression/__init__.py
@@ -6,7 +6,9 @@ from collections.abc import Iterable
from polymatrix.utils.getstacklines import get_stack_lines
from polymatrix.expression.expression import init_expression, Expression
+# NP: Why are these functions here?
+# FIXME: move in the correct file
def v_stack(
expressions: Iterable[Expression],
) -> Expression:
@@ -24,12 +26,14 @@ def v_stack(
)
+# FIXME: move in the correct file
def h_stack(
expressions: Iterable[Expression],
) -> Expression:
return v_stack((expr.T for expr in expressions)).T
+# FIXME: move in the correct file
def block_diag(
expressions: tuple[Expression],
) -> Expression:
@@ -40,6 +44,7 @@ def block_diag(
)
+# FIXME: move in the correct file
def product(
expressions: Iterable[Expression],
degrees: tuple[int, ...] = None,
diff --git a/polymatrix/expression/expression.py b/polymatrix/expression/expression.py
index fe3957c..e8f2e42 100644
--- a/polymatrix/expression/expression.py
+++ b/polymatrix/expression/expression.py
@@ -120,7 +120,8 @@ class Expression(
# delegate to upper level
# NP: what is upper level? Class inherits from ABC and base class,
- # NP: neither has a notion of left / right
+ # NP: neither has binary operators, also NotImplemented IIRC is only for __lt__
+ # NP: and other comparison methods and not for overloadings like __add__
if right is None:
return NotImplemented
diff --git a/polymatrix/expression/init.py b/polymatrix/expression/init.py
index 17e7ae7..75b63b6 100644
--- a/polymatrix/expression/init.py
+++ b/polymatrix/expression/init.py
@@ -154,9 +154,12 @@ def init_from_symmetric_matrix_expr(
)
+# NP: replace with FromDataTypes?
DATA_TYPE = str | np.ndarray | sympy.Matrix | sympy.Expr | tuple | ExpressionBaseMixin
+# NP: this function should be split up into smaller functions, one for each "from" type
+# NP: and each "from" should be documented, explaining how it is interpreted.
def init_from_expr_or_none(
data: DATA_TYPE,
) -> ExpressionBaseMixin | None: