Did you happen to notice David's use of the word "pages" at the end of his
message?  It makes a great visual image to explain the array.

I was wondering if it has been used in this context before, or does it have
a long and checkered APL or J history?

Linda


-----Original Message-----
From: programming-boun...@forums.jsoftware.com
[mailto:programming-boun...@forums.jsoftware.com] On Behalf Of David Ward
Lambert
Sent: Wednesday, September 05, 2012 9:57 PM
To: programming
Subject: Re: [Jprogramming] duplicate row of matrix

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

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

Reply via email to