pub struct KernelDensity {
pub x: Vec<f64>,
pub y: Vec<f64>,
}Expand description
Kernel Density Estimation using Gaussian kernel with FFT acceleration
This is a simplified implementation of R’s density() function with automatic bandwidth selection using Silverman’s rule of thumb. Uses FFT-based convolution for O(n log n) performance instead of O(n*m).
Fields§
§x: Vec<f64>Grid points
y: Vec<f64>Density values
Implementations§
Source§impl KernelDensity
impl KernelDensity
Sourcepub fn estimate(data: &[f64], adjust: f64, n_points: usize) -> KdeResult<Self>
pub fn estimate(data: &[f64], adjust: f64, n_points: usize) -> KdeResult<Self>
Compute kernel density estimate using FFT-based convolution
§Arguments
data- Input dataadjust- Bandwidth adjustment factor (default: 1.0)n_points- Number of grid points (default: 512)
Sourcepub fn find_peaks(&self, peak_removal: f64) -> Vec<f64>
pub fn find_peaks(&self, peak_removal: f64) -> Vec<f64>
Auto Trait Implementations§
impl Freeze for KernelDensity
impl RefUnwindSafe for KernelDensity
impl Send for KernelDensity
impl Sync for KernelDensity
impl Unpin for KernelDensity
impl UnsafeUnpin for KernelDensity
impl UnwindSafe for KernelDensity
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more