kernel_density_estimation/bandwidth/
mod.rs

1//! Bandwidth selection strategies.
2
3pub mod scott;
4pub mod silverman;
5
6use crate::float::KDEFloat;
7
8/// Shared behavior for bandwidth selection strategies.
9pub trait Bandwidth<F: KDEFloat> {
10    /// Returns a bandwidth value estimated from the points in `data`.
11    fn bandwidth(&self, data: &[F]) -> F;
12}
13
14impl<T, F> Bandwidth<F> for T
15where
16    T: Fn(&[F]) -> F,
17    F: KDEFloat,
18{
19    fn bandwidth(&self, data: &[F]) -> F {
20        self(data)
21    }
22}