What is the optimal way to use additional data fields in functors in Thrust?
问题 What is the proper (or optimal) way to use some constant data in functors used in thrust algorithms like thrust::transform ? The naive way I used was simply allocate required arrays inside the functor's operator() method, like this: struct my_functor { __host__ __device__ float operator()(thrust::tuple<float, float> args) { float A[2][10] = { { 4.0, 1.0, 8.0, 6.0, 3.0, 2.0, 5.0, 8.0, 6.0, 7.0 }, { 4.0, 1.0, 8.0, 6.0, 7.0, 9.0, 5.0, 1.0, 2.0, 3.6 }}; float x1 = thrust::get<0>(args); float x2 =