Making the number of key occurances equal using CUDA / Thrust
Is there an efficient way to take a sorted key/value array pair and ensure that each key has an equal number of elements using the CUDA Thrust library? For instance, assume we have the following pair of arrays: ID: 1 2 2 3 3 3 VN: 6 7 8 5 7 8 If we want to have two of each key appear, this would be the result: ID: 2 2 3 3 VN: 7 8 5 7 The actual arrays will be much larger, containing millions of elements or more. I'm able to do this using nested for-loops easily, but I'm interested in knowing whether or not there's a more efficient way to convert the arrays using a GPU. Thrust seems as though