summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNao Pross <np@0hm.ch>2024-05-28 11:53:06 +0200
committerNao Pross <np@0hm.ch>2024-05-28 11:53:06 +0200
commita7a78348e7f957442c9b0d60b6734599fb730c32 (patch)
treeec1db4f26eb2acf47e90c006b0ab4481b4c1ac1c
parentRewrite BlockDiagExpr with BlockPolyMatrix (diff)
downloadpolymatrix-a7a78348e7f957442c9b0d60b6734599fb730c32.tar.gz
polymatrix-a7a78348e7f957442c9b0d60b6734599fb730c32.zip
Allow any iterable as argument of poly.block_diag
-rw-r--r--polymatrix/expression/__init__.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/polymatrix/expression/__init__.py b/polymatrix/expression/__init__.py
index b44aa3e..da1dce6 100644
--- a/polymatrix/expression/__init__.py
+++ b/polymatrix/expression/__init__.py
@@ -109,10 +109,9 @@ def concatenate(expressions: Iterable[Iterable]):
return init_expression(init_concatenate_expr(blocks))
-@convert_args_to_expression
-def block_diag(expressions: tuple[Expression]) -> Expression:
+def block_diag(expressions: Iterable[Expression]) -> Expression:
""" Create a block diagonal matrix. """
- return init_expression(init_block_diag_expr(expressions))
+ return init_expression(init_block_diag_expr(tuple(e.underlying for e in expressions)))
def product(