If i is a random walk like below (each index is not unique), and there is a device vector A filled with zeros.
{0, 1, 0, 2, 3, 3, ....}
Is it possible that thrust can make A[i] auto-increment, after the operation A may look like
//2 means appears count of 0's
//1 means appears count of 1's
//1 means appears count of 2's
//2 means appears count of 3's
{2, 1, 1, 2}
I had tried several cases, but these case only works fine when A is a host vector, I guess that because thrust do the parallel, that it previous result can't affect the new one, the result may look like
//only count once no matter the index appear how many times
{1, 1, 1, 1}
Could thrust achieve my goal with device vector A and a random walk index vector?