I thought of this but it's only true if there are no duplicate booleans.
It's highly unlikely there would be a duplicate but it's possible.
CBM=: (0{CBM),~CBM=: 0=5|?10 50$1000 NB. 10 (probably) unique booleans,
\:"1 (+/ . *.)"1/ ~CBM NB. 1 dupe.
0 10 9 6 1 5 8 3 4 7 2
1 5 6 0 3 4 8 9 10 2 7
2 4 5 1 8 3 6 0 7 9 10
3 9 1 5 6 7 0 10 2 8 4
4 5 1 2 0 6 8 10 7 9 3
5 1 4 0 2 3 6 8 10 9 7
6 1 0 7 10 3 5 8 4 9 2
7 6 3 9 1 0 4 10 2 5 8
8 0 1 5 6 10 2 4 3 9 7
9 0 10 3 1 7 6 4 5 8 2
0 10 9 6 1 5 8 3 4 7 2
The first column is (almost) the same as the index number.
If the data were random, a duplicate would be so unlikely as to not be worth
coding for.
On 12/6/06, Roger Hui <[EMAIL PROTECTED]> wrote:
Since item ii is the maximum match with itself
and therefore ii={.51{.\:blah, the following
expression
scores=: ii,ii-.~51{.\:CBM(+/ . *.)&> ii{CBM
is equivalent to
scores=: 51{.\:CBM (+/ .*)&> ii{CBM
----- Original Message -----
From: Devon McCormick <[EMAIL PROTECTED]>
Date: Tuesday, December 5, 2006 12:47 pm
Subject: Re: [Jprogramming] C-code to process J array
> for_ii. i. #CBM do.
> NB. Prefix closest 50 or 51 by customer index; exclude self from
closest.
> scores=: ii,ii-.~51{.\:CBM(+/ . *.)&> ii{CBM
> cumsc=. cumsc,<scores
> end.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
--
Devon McCormick
^me^ at acm.
org is my
preferred e-mail
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm