diff options
author | Nao Pross <np@0hm.ch> | 2024-06-06 00:14:13 +0200 |
---|---|---|
committer | Nao Pross <np@0hm.ch> | 2024-06-06 00:14:13 +0200 |
commit | 05a188792a2a3eee0a4ea9a0b69d5dc82b4119fc (patch) | |
tree | 74ab95cc2a4e40d2a4cb1b3edd7f4f5ac6a10ac4 | |
parent | Allow construction from mixed tuples in from_any (diff) | |
download | polymatrix-05a188792a2a3eee0a4ea9a0b69d5dc82b4119fc.tar.gz polymatrix-05a188792a2a3eee0a4ea9a0b69d5dc82b4119fc.zip |
Fix bug in from_name
-rw-r--r-- | polymatrix/expression/from_.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/polymatrix/expression/from_.py b/polymatrix/expression/from_.py index ce35a83..03091c7 100644 --- a/polymatrix/expression/from_.py +++ b/polymatrix/expression/from_.py @@ -117,6 +117,16 @@ def from_name( if isinstance(shape, Expression): shape = shape.underlying + elif isinstance(shape, tuple): + nrows, ncols = shape + if isinstance(nrows, Expression): + nrows = nrows.underlying + + if isinstance(ncols, Expression): + ncols = ncols.underlying + + shape = (nrows, ncols) + return init_variable_expression(init.init_variable_expr(Symbol(name), shape)) |