Hi David,
This doesn't use index but it is short and I think gives the result you are
looking for:
a
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
0 0 1 0 0 0
0 0 1 1 1 0
0 0 1 0 0 1
Cheers, bob
On 2011-08-26, at 7: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
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm