thrust::sequence - how to increase the step after each N elements
问题 I am using thrust::sequence(myvector.begin(), myvector.end(), 0, 1) and achieve good ordered list like: 0, 1, 2, 3, 4 My question is how can I achieve such a list below (the best way?) 0, 0, 0, 1, 1, 1, 2, 2 ,2, 3, 3, 3 I know how to make it with functors, so please do not try to answer it with functor. I want to learn if there is an optimized way for it in Thrust, or am I missing a simple way.. 回答1: Something like this: thrust::device_vector<int> myvector(N); thrust::transform( thrust::make