Extracting points from a matrix

Hi everybody!

I think i need some help, and maybe anyone here can give me a hand with my problem.

I need to process a float matrix, find some maximum points, and put these points into a vector.

“Sequentially” thinking, it should be something like that:

point = matrix[index]

if (point is max) {
vector[n] = point
n++
}

But here is the problem, it’s not sequential and now i don’t know how can i get these. I tried to compute it on CPU and it was correct but terrorificly slow, causing unnecesary memory transactions.

Thanks for all.

Run a sort, then take the first n elements. The SDK includes a bitonic sort and a radix sort (in the particles example) - you may be able to use one or adapt one of those.