Somehow, this makes sense, yes. We don't know how to divide by anything but a matrix, so the right rank is 2, but we know how to multiply two things that are more than matrices, so it's ok to have a left right _.

It took me some time to understand why you were mentioning A%.A, as matrix multiplication is not commutative. Turns out, by reading the documentation, that x%.y is actually (%.y) +/ .* x, not x +/ .* %.y as I implicitly assumed. Btw, why is that? Why does dividing on the right by y actually multiplies on the left by the inverse? Isn't that weird?

So, in the end, I have the impressions that it all boils down to the rank of u .v, and how . works in general.

Adrien Mathieu

On 16/05/2022 21:50, Raul Miller wrote:
First off, this is a good question.

That said, it's matrix divide because we are "dividing by" a matrix.

But maybe it's easier to illustrate this than explain it:


    'A B C'=:ABC=: p:i.3 3 3
    ABC%.A
  3.92308         4   2.25641
        2   1.84615   1.58974
0.923077 _0.410256 _0.974359

  5.23077         5   6.23077
        6   3.46154   3.23077
  2.23077   3.23077  0.923077

_4.30769        _4  _3.64103
       _3 _0.615385  0.025641
  1.69231   2.02564    4.4359
     A+/ .*ABC%.A
  2   3   5
  7  11  13
17  19  23

29  31  37
41  43  47
53  59  61

67  71  73
79  83  89
97 101 103

Compare this with:

    A%.A
1 0 0
0 1 0
0 0 1

In other words, %. would not work for higher ranked arrays if its left
rank was 2.

I hope this makes sense,

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to