I answered the mail you refer to, so I read it carefully, and I am glad you now 
made it explicitly clear that it's the inner product you are referring to.

So back to the example.
    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

and with Rich's solution as a point of reference, this is apparently what you 
mean

   $ +/"1(<2 5)|: a *"0 _ b
2 3 5 2 3 5 6

since 

  (+/"1(<2 5)|:a *"0 _ b)  -:   (2 |: a) +/ . * ((|:~   1 -.~ i.@(#@$)) b)
1


R.E Boss


> -----Oorspronkelijk bericht-----
> Van: Programming <[email protected]>
> Namens Rudolf Sykora
> Verzonden: vrijdag 7 februari 2020 22:37
> Aan: [email protected]
> Onderwerp: Re: [Jprogramming] multiply two multidimensional matrices
> 
> 
> R.E. Boss <[email protected]> writes:
> 
> > What I did was translate your
> >
> > C_ijlmnop = sum_k A_ijkl * B_mknop
> >
> > in J-terms. If that's not what you want, then your specs are imprecise.
> >
> > Perhaps what you want to do (with thanks to Lochbaum), is
> >
> > (('ijkl i. ijlk')|: A_ijkl ) (+/ . *) ('mknop i. kmnop')|: B_mknop
> >
> > which is what Rich calculated.
> > This cannot be derived (in an easy way) from the outer product A_ijkl *
> B_mknop.
> > I would love to know how you would specify sum_k A_ijkl * B_mknop
> >
> 
> Please, read
> 
> http://www.jsoftware.com/pipermail/programming/2020-
> February/055000.html
> 
> for clarification.
> I believe I could not be more explicit there.
> 
> (
> In mathematics / physics A and A_ijkl regularly mean two different things.
> If the former A denotes a rank-4 matrix, the latter is a number.
> 
> Eg., two rank-1 matrices, call them v and w, i.e. what people usually call
> vectors, have components (in some implicit coordinate system) called v_i and
> w_i, which are numbers. We can have an outer product of v and w, which is a
> rank-2 object, a matrix M (wrt. the mentioned coordinate system), with
> components (numbers) M_ij = v_i * w_j. And, of course we can opt for
> contracting the indices of M if we like, and create, in this case an object
> without any index left, a number (scalar), defined by sum_i M_ii = sum_i v_i
> * w_i, which is actually the
> (usual) dot product of v and w.
> 
> [here I again dare to not distinguish co- and contravariant indices, for
> simplicity]
> )
> 
> Thanks
> 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

Reply via email to