use crate::errors::{EmptyInput, MultiInputError};
use ndarray::{Array, ArrayBase, Axis, Data, Dimension, Ix1, RemoveAxis};
use num_traits::{Float, FromPrimitive, Zero};
use std::ops::{Add, Div, Mul};
pub trait SummaryStatisticsExt<A, S, D>
where
S: Data<Elem = A>,
D: Dimension,
{
fn mean(&self) -> Result<A, EmptyInput>
where
A: Clone + FromPrimitive + Add<Output = A> + Div<Output = A> + Zero;
fn weighted_mean(&self, weights: &Self) -> Result<A, MultiInputError>
where
A: Copy + Div<Output = A> + Mul<Output = A> + Zero;
fn weighted_sum(&self, weights: &Self) -> Result<A, MultiInputError>
where
A: Copy + Mul<Output = A> + Zero;
fn weighted_mean_axis(
&self,
axis: Axis,
weights: &ArrayBase<S, Ix1>,
) -> Result<Array<A, D::Smaller>, MultiInputError>
where
A: Copy + Div<Output = A> + Mul<Output = A> + Zero,
D: RemoveAxis;
fn weighted_sum_axis(
&self,
axis: Axis,
weights: &ArrayBase<S, Ix1>,
) -> Result<Array<A, D::Smaller>, MultiInputError>
where
A: Copy + Mul<Output = A> + Zero,
D: RemoveAxis;
fn harmonic_mean(&self) -> Result<A, EmptyInput>
where
A: Float + FromPrimitive;
fn geometric_mean(&self) -> Result<A, EmptyInput>
where
A: Float + FromPrimitive;
fn kurtosis(&self) -> Result<A, EmptyInput>
where
A: Float + FromPrimitive;
fn skewness(&self) -> Result<A, EmptyInput>
where
A: Float + FromPrimitive;
fn central_moment(&self, order: u16) -> Result<A, EmptyInput>
where
A: Float + FromPrimitive;
fn central_moments(&self, order: u16) -> Result<Vec<A>, EmptyInput>
where
A: Float + FromPrimitive;
private_decl! {}
}
mod means;