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..
Something like this:
(disclaimer, written in browser, never compiled or tested, use at own risk)
should give you the sequence you are looking for by computing
[0..N]//3and outputting the result onmyvector.Seeing as you are having trouble compiling your version, here is a complete example which compiles and runs: