Devon had shared a kx example of performing matrix multiplication backing out the loops from a wikipedia pseudocode. Providing an elegant solution in K.
You can see it in the NYCJUG notes here: https://code.jsoftware.com/wiki/NYCJUG/2022-07-12 <https://code.jsoftware.com/wiki/NYCJUG/2022-07-12> The Kx solution is as follows: matmul: {x{+/x*y}/:\:+y} The each right (/:) and each left operators (\:) in sequence appear to perform in a similar way to Jās table operator ā/ā. After some messing around with rank I came up with the following J equivalent: matmul =: {{x {{+/x*y}}ā1 1/ |:y}} (1+i. 4 3) matmul 1+i. 3 4 38 44 50 56 83 98 113 128 128 152 176 200 173 206 239 272 (1+i. 4 3) +/ . * 1+i. 3 4 38 44 50 56 83 98 113 128 128 152 176 200 173 206 239 272 By transposing the y operand I deliver columns of y to rows of x which gets operated on by the inner anonymous dfns. Wondering if there is a more elegant way that does not play around with rank? Tom McGuire ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm