I'd like to partition an array of n-tuples based on whether the one of the elements of a tuple is a specified number m.
For example the sequence of 2-tuples:
1 , 4 ,
1 , 3 ,
2 , 3 ,
1 , 2 ,
2 , 2 ,
3 , 2 ,
1 , 1 ,
2 , 1 ,
3 , 1 ,
4 , 1
Will be partitioned as follows, if m = 4:
1 , 4 ,
4 , 1 ,_________
1 , 3 ,
2 , 3 ,
1 , 2 ,
2 , 2 ,
3 , 2 ,
1 , 1 ,
2 , 1 ,
3 , 1
Unfortunately the examples given in the docs are based
on partitioning arrays of scalars. FYI, my data is not laid out as a
structure of arrays because I think doing so will kill coalescence of
read requests because each element of a tuple will be equally spaced
throughout the array. The partition can either be in-place or a copy of
the input -- whichever is easier to implement.