const Array in functor THRUST

Hi everybody,

i would like to write a thrust functor where a tuple of three real values x,y,z (saved as three vectors) is multiplied by a matrix which is constant for the whole for_each call. So i write a functor that looks like the following;

struct my_functor : thrust::unary_function<thrust::tuple<Real,Real,Real,Real,Real,Real> >
 {
     const Real m11,m12,m13,m21,m22,m23,m31,m32,m33;
   //  Real  mm[9] ; !DOES NOT WORK
   my_functor(	      Real m11_,Real m12_,Real m13_,
		      Real m21_,Real m22_,Real m23_,
		      Real m31_,Real m32_,Real m33_,):
     m11(m11_),m21(m21_),m31(m31_),
     m12(m12_),m22(m22_),m32(m32_),
     m13(m13_),m23(m23_),m33(m33_){};
   
  __host__  __device__
  Real operator()( const thrust::tuple<Real,Real,Real,Real,Real,Real>t)
    {
         thrust::get<0>t=m11*thrust::get<3>(t)+m12*thrust::get<4>(t)+m13*thrust::get<5>(t);
         thrust::get<1>t=m21*thrust::get<3>(t)+m22*thrust::get<4>(t)+m23*thrust::get<5>(t);
         thrust::get<2>t=m31*thrust::get<3>(t)+m32*thrust::get<4>(t)+m33*thrust::get<5>(t);
    }
};

and the for each call is

thrust::for_each(
thrust::make_zip_iterator(thrust::make_tuple(result_x.begin(),result_y.begin(),result_z.begin(),
                                             vec_x.begin(),vec_y.begin(),vec_z.begin())),
thrust::make_zip_iterator(thrust::make_tuple(result_x.end(),result_y.end(),result_z.end(),	
                                             vec_x.end(),vec_y.end(),vec_z.end())),
			    my_functor(m11,m12,m13,m21,m22,m23,m31,m32,m33));

So this works. But as indicated above i was wondering if there is a chance to do the same thing without having to declare single values of the matrix and instead have an array as the member of the functor?
I found some stuff on the internet about this but i havent really found an answer (i think).
I dont care if the matrix is saved as a const array, array, some kind of vector, device_vector or whatever. Obviously a solution that uses the fact that the matrix is constant for the call is preffered. I intend to make even more matrix operations in the functor so i would like to ease the programming up here.

Maybe i should add what i have tried allready. Itried to make a const Real mm[9] but htere i have the biggest problems to initialize the array when calling the functor.

best regards

Franz

best regards

Ever figure this out? I’m struggling with a similar problem. I only want to run my functor on the device and declared operator() a device function. I’m storing a reference to a passed-in thrust::device_vector<> as state.