Thrust reduction on customized double2_ class

I have a customized double2_ class defined as follows

class double2_ {
	
        public:
            double2 c;
	    
            __host__ __device__ __forceinline __forceinline__ double2_(const double x_,const double y_) { c.x=x_; c.y=y_; };

            // operator overloads...

    }

Also, I have the Dmatrix GPU class defined as follows

template <typename OutType=DefaultType>
    class Dmatrix
    {

        private :
            int Rows_;						// Number of rows
            int Columns_;					// Number of columns
            OutType *data_;					// Row-major order allocation
		
        public:
    
            // Constructor
            Dmatrix(const int Rows,const int Columns) { 
                Rows_		= Rows;
                Columns_	= Columns;
                CudaSafeCall(cudaMalloc((void **)&data_, Rows_*Columns_*sizeof(OutType))); 
            }
    }

I want to use thrust to perform a reduction of a Dmatrix<double2_> object. So, I have set up the following code

struct SumOperator
    {
        SumOperator() {};
        __host__ __device__ double2 operator()(const double2& a,const double2& b) const { 
        
        double2 r;  r.x = a.x+b.x; r.y = a.y+b.y;
        return r; }
    };

    double2_ SumAll(const Dmatrix<double2_> &v)
    {
        double2 Zero = {0.0,0.0};
        thrust::device_ptr<double2> dev_ptr_1((double2*)v.GetDataPointer());
        thrust::device_ptr<double2> dev_ptr_2((double2*)(v.GetDataPointer()+v.GetNumElements()-1));
    	
        double2 out = thrust::reduce(dev_ptr_1,dev_ptr_2,Zero,SumOperator());
        double2_ outcast; outcast.c.x = out.x; outcast.c.y = out.y;
        return outcast;
     };

I receive a large number of compilation errors, like

no suitable conversion function from "thrust::device_ptr<double2>" to "size_t" exists	
     no suitable constructor exists to convert from "unsigned int" to "thrust::device_ptr<double2>"	
     no operator "==" matches these operands 
     no instance of overloaded function "thrust::min" matches the argument list
     "thrust::detail::backend::cuda::unordered_reduce_closure<InputIterator, Size, T, OutputIterator, BinaryFunction>::unordered_reduce_closure [with InputIterator=thrust::detail::normal_iterator<thrust::device_ptr<double2>>, Size=thrust::device_ptr<double2>, T=double2, OutputIterator=thrust::detail::normal_iterator<thrust::device_ptr<double2>>, BinaryFunction=BB::SumOperator]" matches the argument list

which apparently do not have much to do directly with the code snippet above. All the errors are related, the compiler says, to the file reduce.inl.

What I’m doing wrong?

Thank you very much in advance.

I have discovered that Thrust namespace conflicts with my own library namespace. I think I will use the reduction algorithms already available in the CUDA SDK.