The two statements are executing two different procedures which happen to be 
mathematically equivalent:

u=: ((mp~ |:) (-"1 mean)) % #
v=: (mp~ |:)@(-"1 mean) % #

If (u -: v) A for a matrix A, then
(((mp~ |:) (-"1 mean)) -: (mp~ |:)@(-"1 mean)) A.

Let
C=: A - B=: (E=: (m,m) $ 1) mp A % m=: #A
then u is
(|:C) mp A
and v is
(|:C) mp C.

Let's look at u:
(|:C) mp A
(|:A-B) mp A
((At=: |:A) - Bt=: |:B) mp A
(At mp A) - Bt mp A

Now for v:
(|:C) mp C
(At - Bt) mp A - B
(At mp A) - (At mp B) - (Bt mp A) + Bt mp B

We can see that if 
(Bt mp B) -: At mp B
then (u -: v) A.

At mp B
At mp E mp A % m

Bt mp B
(|: E mp A % m) mp E mp A % m
At mp (Et=: |:E) mp E mp A % *:m
At mp (E mp E % m) mp A % m

Now (and for the coup de grace):
(<i,j) { E mp E % m
+/ (i{Et) * j {"1 E
+/ (m$1) * m $ 1 % m
1 for all i and j between 0 and m.
Therefor
E -: E mp E % m.

And thus
Bt mp B
At mp E mp A % m
At mp B

(u -: v) A for all matrices A. #

Cheers,
Louis

PS: I hope I didn't make and mistakes, but I might have. Thanks for checking!

> On 12 Feb 2017, at 18:54, Raul Miller <[email protected]> wrote:
> 
> It's not so much that it's of no use, but that it's redundant.
> 
> When your hook is a train where the first verb is a hook, you can
> restructure either of them so that the other of those two hooks takes
> over the responsibility of obtaining the hook's "left argument"
> (presumably, this would eliminate the other hook).
> 
> I hope this helps,
> 
> -- 
> Raul
> 
> 
>> On Sun, Feb 12, 2017 at 10:18 AM, R.E. Boss <[email protected]> wrote:
>> I think the problem is that the big hook is of no use, that's what creates 
>> confusion.
>> 
>>   (data mp1 mn data)% # data
>> 504 360 180
>> 360 360   0
>> 180   0 720
>> 
>>   data mp1 mn data
>> 2520 1800  900
>> 1800 1800    0
>> 900    0 3600
>> 
>>   mp1 mn data
>> 2520 1800  900
>> 1800 1800    0
>> 900    0 3600
>> 
>> 
>> R.E. Boss
>> 
>> 
>> -----Original Message-----
>> From: Programming [mailto:[email protected]] On 
>> Behalf Of 'Mike Day' via Programming
>> Sent: zondag 12 februari 2017 12:02
>> To: [email protected]
>> Subject: Re: [Jprogramming] Hooked again
>> 
>> It looks to me as if the two left hooks form one big left hook, not that I'm 
>> into boxing:
>> 
>>    mn =: -"1 mean
>>    mp1=: mp~|:
>> 
>>    ((mp1 mn)%#)data    NB. big "hook"
>> 504 360 180
>> 360 360   0
>> 180   0 720
>> 
>>    ((mp1 @: mn)%#)data   NB. mp1 after mn using @:
>> 504 360 180
>> 360 360   0
>> 180   0 720
>> 
>>    (([: mp1 mn)%#)data    NB. mp1 after mn using [:
>> 504 360 180
>> 360 360   0
>> 180   0 720
>> 
>> Any use?
>> 
>> Mike
>> 
>> 
>>> On 12/02/2017 08:06, Lippu Esa wrote:
>>> ]data=. 5 3 $ 90 60 90 90 90 30 60 60 60 60 60 90 30 30 30
>>> 
>>> mean=: +/%#
>>> mp=:  +/ . *
>>> covmat=: ((mp~|:)(-"1 mean))%# NB. divede by n not n-1 to comply with
>>> the example
>> 
>> 
>> ---
>> This email has been checked for viruses by Avast antivirus software.
>> https://www.avast.com/antivirus
>> 
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> 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