From b9d47ae42eb9e4602503c377f0ebd49a1c687a67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Adjemian=20=28Charybdis=29?= Date: Fri, 23 Dec 2011 11:16:06 +0100 Subject: [PATCH] Fixed the inverse Gaussian Cumulative Distribution Function. Return -Inf/Inf if input is equal to 0/1. --- mex/sources/sobol/gaussian.hh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mex/sources/sobol/gaussian.hh b/mex/sources/sobol/gaussian.hh index 745ee0e10..ccd8f3ade 100644 --- a/mex/sources/sobol/gaussian.hh +++ b/mex/sources/sobol/gaussian.hh @@ -112,6 +112,14 @@ template T icdf( const T uniform ) tmp_ = tmp*sqrt(2*M_PI)*exp(.5*gaussian*gaussian); gaussian = gaussian - tmp_/(1+.5*gaussian*tmp_); } + if ( uniform==0) + { + gaussian = -INFINITY; + } + if ( uniform==1) + { + gaussian = INFINITY; + } return(gaussian); }