Why does decode of a matrix work by column and not row
Posted: Sun Feb 25, 2024 7:38 pm
I have matrix ← 4 3 ⍴ 0 0 0 1 1 0 0 1 1 1 1 1
I wish to convert each row from binary to decimal with the ⊥ primitive. The result is
I thought/expected to get 0 6 3 7. I had to transpose the matrix to get what I thought.
Yet if I sum reduce the matrix, it operates by rows
So why does the ⊥ seem to function on rank 2, while the / functions on rank 1? There is a separate ⌿ function to operate on rank 2.
This seems inconsistent between the two primitives with one operating column-wise and the other row-wise.
Code: Select all
0 0 0
1 1 0
0 1 1
1 1 1
Code: Select all
2⊥ matrix
5 7 3
Code: Select all
2⊥⍉matrix
0 6 3 7
Code: Select all
+/matrix
0 2 2 3
Code: Select all
+⌿matrix
2 3 2