parent
57f9d13434
commit
5656156660
@ -60,9 +60,9 @@ impl Quantile {
|
|||||||
#[inline]
|
#[inline]
|
||||||
fn linear(&self, i: usize, d: f64) -> f64 {
|
fn linear(&self, i: usize, d: f64) -> f64 {
|
||||||
debug_assert_eq!(d.abs(), 1.);
|
debug_assert_eq!(d.abs(), 1.);
|
||||||
let s: usize = d.approx().unwrap();
|
let sum = if d < 0. { i - 1 } else { i + 1 };
|
||||||
self.q[i] + d * (self.q[i + s] - self.q[i])
|
self.q[i] + d * (self.q[sum] - self.q[i])
|
||||||
/ f64::approx_from(self.n[i + s] - self.n[i]).unwrap()
|
/ f64::approx_from(self.n[sum] - self.n[i]).unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Estimate the p-quantile of the population.
|
/// Estimate the p-quantile of the population.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user