gf=: (#&> # [EMAIL PROTECTED]) /: ;
h1=: [: |: gf&>

   (h -: h1) jjss
1



----- Original Message ----- 
From: "John Randall" <[EMAIL PROTECTED]>
To: "Programming forum" <[email protected]>
Sent: Thursday, May 25, 2006 3:41 PM
Subject: RE: [Jprogramming] Connect the dots

...
This can be improved substantially, but here's the general idea.  You can
also get m more directly from the original data.

jjss   =:  (<0 1;(,2);,3),(<0 1 2;,3),(<0 3;1 2),(<0 1 3;,2),<0 1;2 3
f=:[: ; ] ,"0&.>~ [: i. #
g=:[: /:/ |:
h=:[: |: [: > g@:f&.>  NB. h jjss gives rows (identities), columns
(attribute values)
c=:[: (+/%#) =    NB. correlate two vectors
C=:c"1/~          NB. correlation matrix

   ]m=:h jjss
0 0 0 0 0
0 0 1 0 0
1 0 1 1 1
2 1 0 0 1
   C m
  1 0.8 0.2 0.4
0.8   1 0.4 0.2
0.2 0.4   1 0.2
0.4 0.2 0.2   1


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

Reply via email to