diff options
Diffstat (limited to 'src/statistics/math.rs')
-rw-r--r-- | src/statistics/math.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/statistics/math.rs b/src/statistics/math.rs index 3760ca3..6e7e666 100644 --- a/src/statistics/math.rs +++ b/src/statistics/math.rs @@ -45,7 +45,7 @@ struct Record<X, T, D> { /// * `T` tag for each data point. Can be arbitrary. /// * `D` actual data. Must be [`Monoid`](trait.Monoid.html), so that it can be /// summed up. -#[derive(Clone)] +#[derive(Clone, Default)] pub struct RecordFunc<X, T, D> { data: Vec<Record<X, T, D>>, } @@ -84,6 +84,11 @@ where self.data.len() } + /// Check whether there are no records. + pub fn is_emtpy(&self) -> bool { + self.data.is_empty() + } + /// Get the absolute value at the specific point. #[inline] pub fn get(&self, x: &X) -> D { |