template<typename Tx>
-__device__ Tx Aver(Tx z,int i,int j, Tx *z) {return (z-z[j+1])/(j-i+1);}
+__device__ Tx Aver(Tx z,int i,int j, Tx *z)
+ { return (z-z[j+1])/(j-i+1); }
template<typename Tx>
__global__ void monotonizekernel(Tx *y, Tx *z, Tx *u, int *key, int n)
-{ int i = threadIdx.x + blockIdx.x * blockDim.x;
+{
+ int i = threadIdx.x + blockIdx.x * blockDim.x;
if(i<n) {
int smallestJ = i;
Tx curP, smallestP, curz=z[i];
}
template< typename Tx >
-void MonotonizeData(Tx *y, int n, Tx *u) {
+void MonotonizeData(Tx *y, int n, Tx *u)
+{
thrust::less_equal<int> binary_pred;
thrust::maximum<Tx> binary_op2;
thrust::device_vector<Tx> z_d(n+1);
thrust::fill(u_d, u_d+n, -1e100);
thrust::fill(keys_d.begin(), keys_d.end(), 0);
- thrust::reverse_iterator< typename thrust::device_vector<Tx>::iterator > y_reverse_b(y_d+n), y_reverse_end(y_d), z_reverse_b(z_d.end());
+ thrust::reverse_iterator< typename thrust::device_vector<Tx>::iterator> y_reverse_b(y_d+n), y_reverse_end(y_d), z_reverse_b(z_d.end());
- thrust::inclusive_scan(y_reverse_b, y_reverse_end, z_reverse_b+1);
+ thrust::inclusive_scan(y_reverse_b,y_reverse_end,z_reverse_b+1);
monotonizekernel<<<grid, block>>>(y, thrust::raw_pointer_cast(&z_d[0]), u, thrust::raw_pointer_cast(&keys_d[0]), n );