Sorry for replying to my own post again, but after a nice shower (where I do my best thinking), I think I have almost figured out what Oleg wrote...

First, he compares each row of the table with each other row with the following expression:
   ="1/~ t
Next, he sums up the resulting planes into a single table:
   +/@:="1/~ t
He then takes the identity matrix (using the size of the original table... which makes me wonder if this solution will work for a non-square table) and inverts it:
   (-.=i.1{$t)
He multiplies this with the sums above to remove the main diagonal (which represents each row matching itself):
   (-.=i.1{$t)*.+/@:="1/~ t
This now contains the number of times that each row matches other rows for each column. Then he marks the maximums in this table with ones and everything else with zeros:
   (= >./@,)(-.=i.1{$t)*.+/@:="1/~ t
Now, things start to get a little fuzzy for me...
This would sum the rows:
   +/s
And this would perform the logical and of the columns:
   >./s
But the expression (i.>./s) seems to generate the empty list, and i turns out to be zero. So I think I'm lost. Can anyone please shed some more light on this one for me?
Thanks!
-- Glenn

Glenn M. Lewis wrote:
Wow!!! That is very impressive! I tried pulling apart the line (by executing tiny bits at a time and displaying the line in boxed format), and I still don't fully understand it yet, but I was able to tweak it slightly to get it to produce a result... Here's my minor tweak:

  t
1 0 1 1 1 1 1 0
0 1 1 1 1 0 1 1
1 1 1 1 0 1 1 0
1 1 1 1 0 1 1 1
1 1 0 0 1 1 1 1
1 0 1 1 1 1 1 1
1 1 1 1 1 1 1 0
0 1 0 1 1 0 1 1
  ]j=. i,I.s{~i=.(i.>./)@:(+/) s=.(= >./@,)(-.=i.1{$t)*.+/@:="1/~t
0 5 6
  ]k=. I.*./ j{t
0 2 3 4 5 6

Thanks a bunch, Oleg! Hopefully before my next birthday I will have figured out what you just wrote. :-)
-- Glenn

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

Reply via email to