Re: [sympy] Create a Matrix from blocks

2019-03-26 Thread Chris Smith
``` >>> BlockMatrix([[eye(2),2*eye(2)],[3*eye(2),4*eye(2)]]).as_explicit() Matrix([ [1, 0, 2, 0], [0, 1, 0, 2], [3, 0, 4, 0], [0, 3, 0, 4]]) ``` See also #16454 On Thursday, November 8, 2018 at 1:40:49 AM UTC-6, Aaron Meurer wrote: > > I think a

Re: [sympy] Create a Matrix from blocks

2018-11-07 Thread Aaron Meurer
I think a fromblocks classmethod would be useful. Also I don't see why BlockMatrix shouldn't automatically flatten when all the entries are explicit matrices. Or at the least have a method that does so. As for Matrix([[eye(2), eye(2)], [eye(2), eye(2)]]), it seems it should either auto-flatten,

[sympy] Create a Matrix from blocks

2018-11-07 Thread Oscar Benjamin
Is there a straight-forward way to create a matrix from blocks? The Matrix.diag function is nice for creating a block diagonal matrix: In [1]: Matrix.diag(2*eye(2),3*eye(3)) Out[1]: ⎡2 0 0 0 0⎤ ⎢ ⎥ ⎢0 2 0 0 0⎥ ⎢ ⎥ ⎢0 0 3 0 0⎥ ⎢ ⎥ ⎢0 0 0 3 0⎥ ⎢