How to sort two arrays/vectors in respect to values in one of the arrays, using CUDA/Thrust

ε祈祈猫儿з 提交于 2019-12-05 16:16:00

Create a vector of integer indexes, initialised to { 0, 1, 2, 3, etc }. Each integer represents one position in your vector. Sort your vector of indexes using a custom comparision function that uses the indexes to refer to vector1. When finished you can use the sorted indexes to reorder vector1 and vector2.

But I don't think you can do this reordering in place, so you going to have to copy from vector to vector anyway, so I think Kerrek's suggestion is good too.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!