how to calculate an average from a int2 array using Thrust
问题 I'm trying to calculate the average of a certain array which contains points (x,y). is it possible to use thrust to find the average point represented as a (x,y) point? i could also represent the array as a thrust::device_vector<int> when each cell contains the absolute position of the point, meaning i*numColumns + j though I'm not sure that the average number represents the average cell. Thanks! 回答1: #include <iostream> #include <thrust/device_vector.h> #include <thrust/reduce.h> struct add