data partitioning?

hello.
I have this problem :
I have a sequence of float and i must find all the pair next values that differ of more than a delta.
I do this for separating some tokens in a sequence of float.
Each token that differs more than a delta to the next must be separed.

my principal problems that i’m not understand in opencl (Because in opencl there aren’t containers)are these:

1)I don’t know how many tokens are in the sequence , then how i can set all the sequences in a out buffers ? and how many big must be the out buffer?
2)if I have some values that aren’t sequential how i can create a buffer that is sequential?I must use prefix sum?how?
for ex:

if i have
values: 1 0 0 2 3
indexes: 1 2 3 4 5

how i can create this sequence :

values: 1 2 3 0 0
indexes: 1 2 3 4 5

thanks.

If you really want the sequnce you wrote down there, you just have to sort your value array. Look for some sort algorithms for openCL. If you want to trach the changes made by the sort algorithm (change the index values in another array) you have to extend the sortingalgorithm a bit.

After sorting you could iterate the array and check each delta. for that, you could use arraysize-1 threads that check its own element to its neigbour