Dear Raul and J Forum: I don't know why my 'A mmult B' didn't work a first. I've retried it, and gotten the 2x3x5x6 array. I can see that J wants conformity of the last/first dimension. I'm looking for something more general (actually a way of avoiding the Vec function for vectorizing matrices), but I'm glad to understand what J does -- it's a start. Thanks.
Sincerely, Leigh -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Raul Miller Sent: Monday, February 22, 2010 10:13 AM To: Programming forum Subject: Re: [Jprogramming] Generalized Matrix Multiplication On Mon, Feb 22, 2010 at 10:03 AM, Leigh J. Halliwell <[email protected]> wrote: > Dear J Forum: > > Wishing to generalize matrix multiplication to arrays of higher rank than 2, > I tried the following: > > mmult =. +/ . * > A =. i. 2 3 4 > B =. i. 3 4 5 > > A mmult B NB. Hopefully a 2-by-5 array > |length error: mmult Try (i.2 3 4) +/ .* i.4 5 6 Why would you expect a rank 2 array when multiplying arrays of higher rank? Raul ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
