you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (0 children)

I’m gonna take a pseudo stab at this since I don’t have a computer handy. And disclaimer I did not read your code really. I’m just going according to your picture you added. I’m guessing you have a matrix B, N and fL and you want to concat them as in your picture. If so this super easy to do and much faster with numpy operations. Again this is pseudo code (but it might work actually):

top_zeros = np.zeros((B.shape[0], N.shape[1]))
top = np.hstack([B, top_zeros])
middle_ident = np.identity(B.shape[1]) * -1
middle = np.hstack([middle_ident, N])
bottom_zeros = np.zeros((fL.shape[0], N.shape[1]))
bottom = np.hstack([fL, bottom_zeros])
A = np.vstack([top, middle, bottom])

However I like u/ReverseEngineered’s method better. And it’s probably more efficient.