1
$\begingroup$

Lets say I have four matrices A, B, C and D, and I want to combine them together into one new matrix for computation: $$ \left( \begin{matrix} A & B\\ C & D \end{matrix}\right) $$ How can I do this in Numpy? The only thing I can think of now is to loop through each element in every matrix.

$\endgroup$

1 Answer 1

7
$\begingroup$

They are commonly called block matrices. You can create them with hstack, vstack, and block.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.