use crate::Dataset;
use tenflowers_core::Result;
use super::computation::DatasetStatisticsComputer;
use super::core::{DatasetStats, StatisticsConfig};
pub trait DatasetStatisticsExt<T> {
fn compute_statistics(&self) -> Result<DatasetStats<T>>;
fn compute_statistics_with_config(&self, config: StatisticsConfig) -> Result<DatasetStats<T>>;
}
impl<T, D> DatasetStatisticsExt<T> for D
where
T: Clone
+ Default
+ scirs2_core::numeric::Zero
+ scirs2_core::numeric::Float
+ std::fmt::Debug
+ Send
+ Sync
+ 'static,
D: Dataset<T>,
{
fn compute_statistics(&self) -> Result<DatasetStats<T>> {
DatasetStatisticsComputer::compute(self, StatisticsConfig::default())
}
fn compute_statistics_with_config(&self, config: StatisticsConfig) -> Result<DatasetStats<T>> {
DatasetStatisticsComputer::compute(self, config)
}
}