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$
7
$\begingroup$

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

| cite | improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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