Henry Rich <[email protected]> writes:

> It depends on what the '*' means in the definition of the product.

>> C_ijlmnop = sum_k A_ijkl * B_mknop

I really mean the usual multiplication (of numbers).


> Have a look at
> 
> a =. i. 2 3 4 5
> b =. i. 2 4 3 5 6
> $ (2 |: a) +/ . * ((|:~ 1 -.~ i.@(#@$)) b)
> 2 3 5 2 3 5 6

Well, I hoped for seeing something simpler. :)

If I understand your example a bit, you sum along the 4-long axis, and
you make this axis the last in the case of 'a', ie. by (2 |: a), then
use the so called dot product (+/ . *), and then something I cannot
easily decipher, but I guess it must, among other things, make the
4-long axis (number 1) the first.

Does one really has to shuffle with the axes?
Does one really need to use the for me almost incomprehensible
conjunction . (which no one dares to explain simply enough...)?

Why is it so simple to say what I want mathematically, and so awkward
to do it programmatically?  

Thanks!
Ruda


> On 2/6/2020 2:46 PM, [email protected] wrote:
>> having two multidimensional matrices A and B,
>> with some indices, say, A_ijkl and B_mknop,
>> how can I obtain a matrix C, where
>> 
>> C_ijlmnop = sum_k A_ijkl * B_mknop
>> 
>> ie., C has all indices of A and B but for the index k,
>> which was summed over.
>> 
>> Thanks for your suggestions.
>> 
>> Best regards
>> Ruda
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
> 
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to