Move functions around
This commit is contained in:
@@ -224,28 +224,6 @@ impl SumFactor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn v_win(t: f64, e: f64) -> f64 {
|
|
||||||
math::pdf(t - e) / math::cdf(t - e)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn w_win(t: f64, e: f64) -> f64 {
|
|
||||||
let vwin = v_win(t, e);
|
|
||||||
|
|
||||||
vwin * (vwin + t - e)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn v_draw(t: f64, e: f64) -> f64 {
|
|
||||||
(math::pdf(-e - t) - math::pdf(e - t)) / (math::cdf(e - t) - math::cdf(-e - t))
|
|
||||||
}
|
|
||||||
|
|
||||||
fn w_draw(t: f64, e: f64) -> f64 {
|
|
||||||
let vdraw = v_draw(t, e);
|
|
||||||
let n = (vdraw * vdraw) + ((e - t) * math::pdf(e - t) + (e + t) * math::pdf(e + t));
|
|
||||||
let d = math::cdf(e - t) - math::cdf(-e - t);
|
|
||||||
|
|
||||||
n / d
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct TruncateFactor {
|
pub struct TruncateFactor {
|
||||||
variable_msg: MessageId,
|
variable_msg: MessageId,
|
||||||
variable: VariableId,
|
variable: VariableId,
|
||||||
@@ -319,3 +297,25 @@ impl TruncateFactor {
|
|||||||
delta
|
delta
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn v_win(t: f64, e: f64) -> f64 {
|
||||||
|
math::pdf(t - e) / math::cdf(t - e)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn w_win(t: f64, e: f64) -> f64 {
|
||||||
|
let vwin = v_win(t, e);
|
||||||
|
|
||||||
|
vwin * (vwin + t - e)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn v_draw(t: f64, e: f64) -> f64 {
|
||||||
|
(math::pdf(-e - t) - math::pdf(e - t)) / (math::cdf(e - t) - math::cdf(-e - t))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn w_draw(t: f64, e: f64) -> f64 {
|
||||||
|
let vdraw = v_draw(t, e);
|
||||||
|
let n = (vdraw * vdraw) + ((e - t) * math::pdf(e - t) + (e + t) * math::pdf(e + t));
|
||||||
|
let d = math::cdf(e - t) - math::cdf(-e - t);
|
||||||
|
|
||||||
|
n / d
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user