proper thrust call for subtraction
问题 Following from here. Assuming that dev_X is a vector. int * X = (int*) malloc( ThreadsPerBlockX * BlocksPerGridX * sizeof(*X) ); for ( int i = 0; i < ThreadsPerBlockX * BlocksPerGridX; i++ ) X[ i ] = i; // create device vectors thrust::device_vector<int> dev_X ( ThreadsPerBlockX * BlocksPerGridX ); //copy to device thrust::copy( X , X + theThreadsPerBlockX * theBlocksPerGridX , dev_X.begin() ); The following is making a subtraction: thrust::transform( dev_Kx.begin(), dev_Kx.end(), dev_X.begin