Alright. I think I've got a better handle on matrix
multiplication now. At the risk of heresy, I think
it's not such a problem to have defined results
where other APLs yield an error. The reverse is more
likely to be problematical.
But I still need to fix my dot operator to work on
matrices. For this I think I've found two different
approaches. The textbook definition of the matrix
multiply is "f reduce row_i_of_a g column_j_of_w".
And this is applied for each (i,j) pair in the
resulting matrix. An example (ASCII art).
1 2 3 1 2 3
4 5 6 +.× 4 5 6
7 8 9 7 8 9
+/1 2 3×1 +/1 2 3×2 +/1 2 3×3
4 5 6
7 8 9
+/4 5 6×1 +/4 5 6×2 +/4 5 6×3
4 5 6
7 8 9
+/7 8 9×1 +/7 8 9×2 +/7 8 9×3
4 5 6
7 8 9
=>
30 36 42
66 81 96
102 126 150
But there's another way that I think could work.
If I transform a and w into 3x3x3 arrays, then reduce
should collapse the result back down to 3x3.
+/ 1 2 3 1 1 1
1 2 3 4 4 4
1 2 3 7 7 7
4 5 6 2 2 2
4 5 6 × 5 5 5
4 5 6 8 8 8
7 8 9 3 3 3
7 8 9 6 6 6
7 8 9 9 9 9
=>
+/ 1 2 3
4 8 12
7 14 21
8 10 12
20 25 30
32 40 48
21 24 27
42 48 54
63 72 81
=>
30 36 42
66 81 96
102 126 150
And this may be more efficient in inca by allocating fewer
temporary arrays.