From a7a78348e7f957442c9b0d60b6734599fb730c32 Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Tue, 28 May 2024 11:53:06 +0200 Subject: Allow any iterable as argument of poly.block_diag --- polymatrix/expression/__init__.py | 5 ++--- 1 file 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( -- cgit v1.2.1