Re: Partition of multi dimension list
- To: mathgroup at smc.vnet.net
- Subject: [mg52807] Re: Partition of multi dimension list
- From: "Ray Koopman" <koopman at sfu.ca>
- Date: Mon, 13 Dec 2004 04:23:40 -0500 (EST)
- References: <cpeje6$6sb$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Bruyndonckx P. wrote:
> I have a list of about 5 million items. Each item is a list of
> 7 integer numbers (hence a 5000000x7 array). I want to partition
> this array on the values of two numbers in each item. The third
> number (out of seven) goes from 0 to 63 and the fifth number is
> either 0 or 1. So I want to end up with 64*2 partitions. The
> fastest solution I have found up to now to do this on the list 'c'
> is Flatten[CategoryLists[c, {_}, {_}, Range[64] - 1, {_}, {0,1},
> {_}, {_}][[1, 1]], 4].
Split[Sort[c, OrderedQ[{#1[[{3,5}]],#2[[{3,5}]]}]&],
Equal[#1[[{3,5}]],#2[[{3,5}]]]&]