Yes, a way of describing this issue here is that when you use an outer
product to form a matrix product, you want to sum along a diagonal
(and discard non-diagonal elements).
For example:
2{"2+//."3 (i.2 3)*/|.i.3 4
20 23 26 29
56 68 80 92
is equivalent to
(i.2 3)+/ .*i.3 4
20 23 26 29
56 68 80 92
(Note that I am reversing an axis in the right argument so that the
middle elements resulting from u/. correspond to the desired
diagonal.)
(I am ignoring efficiency issues, here, because I've got an outer
product as an intermediate result.)
I hope this helps,
--
Raul
On Fri, Feb 7, 2020 at 9:44 AM Rudolf Sykora <[email protected]> wrote:
>
>
> R.E. Boss <[email protected]> writes:
>
> > a =. i. 2 3 4 5
> > b =. i. 2 4 3 5 6
> > $a *"0 _ b
> > 2 3 4 5 2 4 3 5 6
> > $+/"6 +/"4 a *"0 _ b
> > 2 3 5 2 3 5 6
>
> This is an interesting take on the subject.
>
>
> If I understand, the first part does an outer product, P,
>
> P_ijklmnopq = A_ijkl * B_mnopq .
>
> And I believe it does it right.
>
>
> However, what I now want to do is
>
> C_ijlmopq = sum_k P_ijklmkopq
>
> while, it seems to me, you do something different,
> something like
>
> D_ijlmnpq = sum_kn P_ijklmnopq,
>
> which is not what is wanted.
>
> In any case, the result of yours and of Henry Rich's, although having the
> same shape, differ. At this moment I think the latter is the right one,
> but I am not quite sure, yet.
>
>
> Thanks for trying!
> 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