irox_stats/
lib.rs

1// SPDX-License-Identifier: MIT
2// Copyright 2025 IROX Contributors
3//
4
5//!
6//! A collection of digital signals processing and statistics functions
7
8#![forbid(unsafe_code)]
9#![warn(clippy::alloc_instead_of_core)]
10#![warn(clippy::std_instead_of_alloc)]
11#![warn(clippy::std_instead_of_core)]
12#![cfg_attr(not(feature = "std"), no_std)]
13#![cfg_attr(docsrs, feature(doc_cfg))]
14
15extern crate alloc;
16extern crate core;
17
18use alloc::vec::Vec;
19
20pub use gaussian as standard;
21
22pub mod abg;
23pub mod decay;
24pub mod filter;
25pub mod fitting;
26pub mod gaussian;
27pub mod lttb;
28mod macros;
29pub mod points;
30pub mod pyramid;
31pub mod rects;
32pub mod sampling;
33pub mod streaming;
34pub mod streams;
35#[cfg(any(all(doc, docsrs), all(feature = "std", feature = "miniz")))]
36#[cfg_attr(docsrs, doc(cfg(all(feature = "std", feature = "miniz"))))]
37pub mod tsdf;
38#[cfg(any(all(doc, docsrs), feature = "std"))]
39#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
40pub mod windows;
41
42#[derive(Debug, Copy, Clone, PartialEq)]
43pub enum DistributionParams {
44    Mean(f64),
45    StandardDeviation(f64),
46    Variance(f64),
47    Other(&'static str, f64),
48}
49
50/// This trait represents a statistical distribution
51pub trait Distribution {
52    /// computes the probability distribution function for a particular value
53    fn pdf(&self, value: f64) -> f64;
54
55    /// Returns a set of the known parameters of this distribution.
56    fn get_params(&self) -> Vec<DistributionParams>;
57}