Even closer to get example "basic" up and running!
This commit is contained in:
27
src/utils.rs
27
src/utils.rs
@@ -38,7 +38,7 @@ const QS: [f64; 6] = [
|
||||
fn normcdf(x: f64) -> f64 {
|
||||
// If X ~ N(0,1), returns P(X < x).
|
||||
// erfc(-x / SQRT2) / 2.0
|
||||
|
||||
// https://docs.rs/statrs/0.12.0/statrs/function/erf/fn.erfc.html
|
||||
todo!();
|
||||
}
|
||||
|
||||
@@ -85,29 +85,4 @@ pub fn logphi(z: f64) -> (f64, f64) {
|
||||
|
||||
(res, dres)
|
||||
}
|
||||
|
||||
/*
|
||||
if z * z < 0.0492:
|
||||
# First case: z close to zero.
|
||||
coef = -z / SQRT2PI
|
||||
val = 0
|
||||
for c in CS:
|
||||
val = coef * (c + val)
|
||||
res = -2 * val - log(2)
|
||||
dres = exp(-(z * z) / 2 - res) / SQRT2PI
|
||||
elif z < -11.3137:
|
||||
# Second case: z very small.
|
||||
num = 0.5641895835477550741
|
||||
for r in RS:
|
||||
num = -z * num / SQRT2 + r
|
||||
den = 1.0
|
||||
for q in QS:
|
||||
den = -z * den / SQRT2 + q
|
||||
res = log(num / (2 * den)) - (z * z) / 2
|
||||
dres = abs(den / num) * sqrt(2.0 / pi)
|
||||
else:
|
||||
res = log(normcdf(z))
|
||||
dres = exp(-(z * z) / 2 - res) / SQRT2PI
|
||||
return res, dres
|
||||
*/
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user