use CompactVec for all modes
This commit is contained in:
@@ -10,7 +10,7 @@ pub(crate) struct CompactVec {
|
||||
}
|
||||
|
||||
impl CompactVec {
|
||||
const ACCEPTABLE_DIFFERENCE: f64 = 1e-7;
|
||||
const ACCEPTABLE_DIFFERENCE: f64 = 1e-16;
|
||||
|
||||
pub(crate) fn new() -> Self {
|
||||
Self::default()
|
||||
@@ -54,6 +54,12 @@ impl CompactVec {
|
||||
|
||||
nums
|
||||
}
|
||||
|
||||
pub(crate) fn sum(&self) -> f64 {
|
||||
self.inner
|
||||
.iter()
|
||||
.fold(0.0, |sum, entry| sum + entry.value * entry.count as f64)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
|
||||
Reference in New Issue
Block a user