Oops, my variant on the ridiculous won't work correctly with duplicates.

On 8/26/2011 10:32 PM, David Ward Lambert wrote:
> Is there a shorter sentence?    [: |: [: (i.>./)"1 |:
>
> I'm thinking this could work:  i."SOME RANK>./
>
>     ]a=: (?.@$ */)2 3 6  NB. data, rank 3
> 18 20 28 30 29 28
> 22 28  8  7 21 32
> 31 17 25 32 33 28
>
> 13 17 29 15  1 25
> 18 28 33 26 22  9
> 17  6 34 15 23 35
>
>     >./a  NB. want the index of a plane having these maximums
> 18 20 29 30 29 28
> 22 28 33 26 22 32
> 31 17 34 32 33 35
>
>     NB. this works but involves two transposes
>     |: (i.>./)"1 |: a
> 0 0 1 0 0 0
> 0 0 1 1 1 0
> 0 0 1 0 0 1
>
>     NB. this version is ridiculous
>     <./ (<:@+>:@# * 0 = ]) (>:@i.@# * (="2>./)) a
> 0 0 1 0 0 0
> 0 0 1 1 1 0
> 0 0 1 0 0 1
>
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>

-- 
Clifford A. Reiter
Lafayette College, Easton, PA 18042
http://webbox.lafayette.edu/~reiterc/

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

Reply via email to