For x +/ .* y the length of the trailing dimension
of x must equal the length of the leading dimension of y,
and the shape of the result is ($x),}.$y .  (Or else
x or y is scalar, and the shape of the result is
}:$x or }.$y.)  

For general u . v the conformability requirements depend 
on the left rank of v and the shape of the result depend 
on the shapes of results produced by u and v , as
the definition u . v <->  u@(v"(1+lv,_)) would indicate.

See also  http://www.jsoftware.com/papers/innerproduct/



----- Original Message -----
From: "Leigh J. Halliwell" <[email protected]>
Date: Monday, February 22, 2010 7:04
Subject: [Jprogramming] Generalized Matrix Multiplication
To: 'Programming forum' <[email protected]>

> 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
> |   A     mmult B
>  
> I'm not even clear what this product means, much less whether 
> with the rank
> adverb I could make it work in J.  Can anyone help me with 
> these questions?
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to