Compose matrix out of several subarrays in J

Viewed 97

I want to compose a 12x12 matrix named F out of 4 given smaller submatrices which should be located at different positions:

  • array A of shape 3x6 should be from (0;0) to (2;5)
  • array B of shape 4x9 should be from (3;3) to (6;11)
  • array C of shape 3x3 should be from (7;0) to (9;2)
  • array D of shape 2x3 should be from (10;6) to (11;8)

All other atoms are zeros. I started setting up F =: 12 12 $ 0 but failed trying the amend verb. What would be best practice for this?

My subarrays are: A =: 3 6 $ _1 1 0 0 0 0 0 0 _1 0 0 1 0 0 0.99 0 _1 0 B =: 4 9 $ 1 0 0 1 0 0 _1 0 0 0 1 0 0 0 0 0 _1 0 0 1 0 0 _1 0 0 0 0 1 0 1 1 0 1 1 0 1 C =: 3 3 $ 1 0 0 0 1 0 0 0 1 D =: 2 3 $ 1 0 0 0 0 1

2 Answers
Related