It's not so simple to describe. In fact, you haven't described it.
Your example seems to have a rank-4 array times a rank-5 array producing
a rank-7 array. Is this result the sum of rank-7 arrays created by
multiplying rank-3 times rank-4? I don't know how to make that jibe
with 'the usual multiplication of numbers', which applies to atoms.
To start with I want to know: Does my example do what you want it to do?
The formal definition of u/ . v is
x u/@(v"(1+lv,_)) y
and with u=+ and v=*, which have rank 0, this is
x +/@(*"1 _) y
Each atom of the last row of x is applied to one item of y. That is why
the trailing row of x and the leading row of y need to have the same length.
Henry Rich
On 2/6/2020 4:44 PM, [email protected] wrote:
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
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm