Hi, I am trying to come up with an iterator which traverses an array in strided manner and which treats stride consecutive elements of the array as one big element. The stride is determined at runtime.
Let me give you a simple example.
indices = [2,0,1]
array = [0,1,2,3,4,5,6,7,8,9,10,11]
resultarray = [0,0,0,0,0,0,0,0,0,0,0]
stride = 4
CustomIterator(array, stride), //create “virtual” array [[0,1,2,3], [4,5,6,7], [8,9,10,11]]
After this, resultarray should be [8,9,10,11,0,1,2,3,4,5,6,7]
Is there a way to combine Thrust iterators to achieve this? So far, I only found the example code for strided iterators which performs strided access, but uses only 1 element instead of stride elements. https://github.com/thrust/thrust/blob/master/examples/strided_range.cu