From 4e46d95dacff22187d94630cf432887bba0a6681 Mon Sep 17 00:00:00 2001 From: Aditya Atluri Date: Sat, 11 Jun 2016 17:05:46 -0500 Subject: [PATCH] added normcdf support Change-Id: I4887bc588589ed067eaa339d5eccd988c1c5d649 [ROCm/clr commit: 20b991e99ae1f9003fe2903c0c36f4ace74cc94c] --- projects/clr/hipamd/src/device_util.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/projects/clr/hipamd/src/device_util.cpp b/projects/clr/hipamd/src/device_util.cpp index cd57e54af3..29a125dce7 100644 --- a/projects/clr/hipamd/src/device_util.cpp +++ b/projects/clr/hipamd/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);