fix
This commit is contained in:
parent
e4ed6fd1b8
commit
5f341bc144
@ -83,7 +83,7 @@ impl Variance0 {
|
|||||||
/// This is an unbiased estimator of the variance of the population.
|
/// This is an unbiased estimator of the variance of the population.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn sample_variance(&self) -> f64 {
|
pub fn sample_variance(&self) -> f64 {
|
||||||
if self.avg.len() < 1 + ddof as usize {
|
if self.avg.len() < 1 + ddof as u64 {
|
||||||
return 0.;
|
return 0.;
|
||||||
}
|
}
|
||||||
self.sum_2 / f64::approx_from(self.avg.len() - ddof).unwrap()
|
self.sum_2 / f64::approx_from(self.avg.len() - ddof).unwrap()
|
||||||
@ -95,7 +95,7 @@ impl Variance0 {
|
|||||||
#[inline]
|
#[inline]
|
||||||
pub fn population_variance(&self) -> f64 {
|
pub fn population_variance(&self) -> f64 {
|
||||||
let n = self.avg.len();
|
let n = self.avg.len();
|
||||||
if n < 1 + ddof as usize {
|
if n < 1 + ddof as u64 {
|
||||||
return 0.;
|
return 0.;
|
||||||
}
|
}
|
||||||
self.sum_2 / f64::approx_from(n).unwrap()
|
self.sum_2 / f64::approx_from(n).unwrap()
|
||||||
|
@ -83,7 +83,7 @@ impl Variance1 {
|
|||||||
/// This is an unbiased estimator of the variance of the population.
|
/// This is an unbiased estimator of the variance of the population.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn sample_variance(&self) -> f64 {
|
pub fn sample_variance(&self) -> f64 {
|
||||||
if self.avg.len() < 1 + ddof as usize {
|
if self.avg.len() < 1 + ddof as u64 {
|
||||||
return 0.;
|
return 0.;
|
||||||
}
|
}
|
||||||
self.sum_2 / f64::approx_from(self.avg.len() - ddof).unwrap()
|
self.sum_2 / f64::approx_from(self.avg.len() - ddof).unwrap()
|
||||||
@ -95,7 +95,7 @@ impl Variance1 {
|
|||||||
#[inline]
|
#[inline]
|
||||||
pub fn population_variance(&self) -> f64 {
|
pub fn population_variance(&self) -> f64 {
|
||||||
let n = self.avg.len();
|
let n = self.avg.len();
|
||||||
if n < 1 + ddof as usize {
|
if n < 1 + ddof as u64 {
|
||||||
return 0.;
|
return 0.;
|
||||||
}
|
}
|
||||||
self.sum_2 / f64::approx_from(n).unwrap()
|
self.sum_2 / f64::approx_from(n).unwrap()
|
||||||
|
Loading…
Reference in New Issue
Block a user