II have come across a feature of J that I didn't expect. When I add rows of
a matrix, I use +/"1 

   a

1 2 3 4

1 2 3 4

1 2 3 4

 

   +/"1 a

10 10 10

 

And columns,

  +/"2 a

3 6 9 12

 

By chance, I happened to 'misplace' insert and got an unexpected result

 

   +"1/a

3 6 9 12

 

which is the addition of the columns. However, 

 

   +"2/ a

3 6 9 12

 

Now take another matrix b

   b

1 1 1 1

2 2 2 2

3 3 3 3

4 4 4 4

 

I would like to multiply every row of b by every row of a, but 

 

   a*/"1 b

|length error

|   a    */"1 b

 

While 

 

   a*"1 / b

1 2  3  4

2 4  6  8

3 6  9 12

4 8 12 16

 

1 2  3  4

2 4  6  8

3 6  9 12

4 8 12 16

 

1 2  3  4

2 4  6  8

3 6  9 12

4 8 12 16

 

Which appears to work.

 

I am obviously missing something with rank and insert. Could someone
enlighten me? Any insight is much appreciated, as always.

 

Bob

 

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

Reply via email to