2 __device__ void Bisection_device(T z, T* t, int mi,int ma,int* l)
14 // Kernel to evaluate monotone spline for a sequence of query points
15 // residing in the array z of size m
17 template<typename Tx, typename Ty>
18 __global__ void d_MonSplineValue(Tx* z, int K, double* t, double * alpha, double * beta, double * gamma, int T, Ty *value)
20 int tid = threadIdx.x + blockIdx.x * blockDim.x;
25 Bisection_device(z[tid], t, mi, ma, &i);
27 r= alpha[i] + r*(beta[i] + gamma[i]*r);
29 tid += blockDim.x * gridDim.x;
34 template<typename Tx, typename Ty>
35 void MonotoneSplineValue(Tx *z, int K, double* t, double * alpha, double * beta, double * gamma, int T, Ty* result)
37 int blocks,threads=256;
38 blocks=(K-1)/threads+1;
39 d_MonSplineValue<<<blocks,threads>>>(z,K,t,alpha,beta,gamma,T,result);