Skip to content Skip to sidebar Skip to footer

Create A Larger Matrix From Smaller Matrices In Numpy

I have 3 matrices A,B,C. I wish to create a larger matrix of the form D = | 0 A | | B C | How to do this in Numpy ?

Solution 1:

This:

numpy.bmat([[numpy.zeros(appropriate_shape), A], [B, C]])

works, but I'm not sure how to avoid the creation of that big, useless array of zeros. Also, it returns a matrix instead of an array, so make sure to call asarray on it if you want an array.

Post a Comment for "Create A Larger Matrix From Smaller Matrices In Numpy"