Reputation:
Starting with something simple:
a =: 3 4 $ i.12
This creates a nice 3 x 4 matrix.
So when I try
b=: a $ i.5
I get a very long output for b. I do not understand what the output is (by the way, i.5 was arbitrary). By which I mean, I don't nderstand what $ means when it has a 2+ dimensional array as a left hand argument. Can someone explain what b is describing?
Upvotes: 3
Views: 262
Reputation: 539
Here is what happens: a becomes matrix
0 1 2 3
4 5 6 7
8 9 10 11
as you just described.
$ has dyadic rank of 1 _, which means it applies rows of left argument to the entire right argument and pastes result together.
a $ i.5
is (0 1 2 3 $ i.5),(4 5 6 7 $ i.5),:(8 9 10 11 $ i.5)
All the subarrays have different shape, so they are coerced into least common shape that would fit them all, which in this case is 8 9 10 11
. Therefore, the result has shape 3 8 9 10 11
Upvotes: 4