diff options
author | Nao Pross <np@0hm.ch> | 2024-05-28 11:53:06 +0200 |
---|---|---|
committer | Nao Pross <np@0hm.ch> | 2024-05-28 11:53:06 +0200 |
commit | a7a78348e7f957442c9b0d60b6734599fb730c32 (patch) | |
tree | ec1db4f26eb2acf47e90c006b0ab4481b4c1ac1c | |
parent | Rewrite BlockDiagExpr with BlockPolyMatrix (diff) | |
download | polymatrix-a7a78348e7f957442c9b0d60b6734599fb730c32.tar.gz polymatrix-a7a78348e7f957442c9b0d60b6734599fb730c32.zip |
Allow any iterable as argument of poly.block_diag
-rw-r--r-- | polymatrix/expression/__init__.py | 5 |
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( |