diff --git a/src/device_util.cpp b/src/device_util.cpp index cd57e54af3..29a125dce7 100644 --- a/src/device_util.cpp +++ b/src/device_util.cpp @@ -228,7 +228,14 @@ __device__ float norm4df(float a, float b, float c, float d) float y = c*c + d*d; return hc::precise_math::sqrtf(x+y); } -__device__ float normcdff(float y); +/* +The below conversion seems easy, takes a +full page of integral calculus to deduce the following equation +*/ +__device__ float normcdff(float y) +{ + return ((hc::precise_math::erff(y)/1.41421356237) + 1)/2; +} __device__ float normcdfinvf(float y); __device__ float normf(int dim, const float *a) { @@ -541,6 +548,10 @@ __device__ double norm4d(double a, double b, double c, double d) double y = c*c + d*d; return hc::precise_math::sqrt(x+y); } +__device__ double normcdf(float y) +{ + return ((hc::precise_math::erf(y)/1.41421356237) + 1)/2; +} __device__ double pow(double x, double y) { return hc::precise_math::pow(x, y);