Right!  "Matrix multiplication" usually means something else.
You want a sort of element-by-corresponding-element multiplication.

   B ; A
+-------+-------+
|1 1 0 0|1 1 1 1|
|0 0 1 1|1 1 2 2|
|       |1 1 3 3|
|       |1 1 4 4|
+-------+-------+
   
A solution uses rank conjunction twice.  I couldn't begin to understand
it the first time I saw this sort of construction.  Then one day I wrote
rank rank and retrospectively realized what I'd written and understood.
I practiced rank with sentences like   'abc' "2 i. 2 3 4

My thoughts to construct this sentence:
First I realized that you need to multiply row by row.
The ("1) adverb ensures this.  The frames of these two matrices disagree
because there are 2 rows in B and 4 in A.  The next adverb ("_ 1) means
(because ultimately the final verb is dyadic) "use all of the left array
with each row of the right hand array".

   B * ("1) ("_ 1) A
1 1 0 0
0 0 1 1

1 1 0 0
0 0 2 2

1 1 0 0
0 0 3 3

1 1 0 0
0 0 4 4

Finally, inserting append between the pages gives

   ,/B*"1"_ 1 A
1 1 0 0
0 0 1 1
1 1 0 0
0 0 2 2
1 1 0 0
0 0 3 3
1 1 0 0
0 0 4 4


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

Reply via email to