fdars_core/lib.rs
1//! # fdars-core
2//!
3//! Core algorithms for Functional Data Analysis in Rust.
4//!
5//! This crate provides pure Rust implementations of various FDA methods including:
6//! - Functional data operations (mean, derivatives, norms)
7//! - Depth measures (Fraiman-Muniz, modal, band, random projection, etc.)
8//! - Distance metrics (Lp, Hausdorff, DTW, Fourier, etc.)
9//! - Basis representations (B-splines, P-splines, Fourier)
10//! - Clustering (k-means, fuzzy c-means)
11//! - Smoothing (Nadaraya-Watson, local linear/polynomial regression)
12//! - Outlier detection
13//! - Regression (PCA, PLS, ridge)
14//! - Seasonal analysis (period estimation, peak detection, seasonal strength)
15//! - Detrending and decomposition for non-stationary data
16//!
17//! ## Data Layout
18//!
19//! Functional data is represented using the [`FdMatrix`] type, a column-major matrix
20//! wrapping a flat `Vec<f64>` with safe `(i, j)` indexing and dimension tracking:
21//! - For n observations with m evaluation points: `data[(i, j)]` gives observation i at point j
22//! - 2D surfaces (n observations, m1 x m2 grid): stored as n x (m1*m2) matrices
23//! - Zero-copy column access via `data.column(j)`, row gather via `data.row(i)`
24//! - nalgebra interop via `to_dmatrix()` / `from_dmatrix()` for SVD operations
25
26#![allow(clippy::needless_range_loop)]
27#![allow(clippy::too_many_arguments)]
28#![allow(clippy::type_complexity)]
29
30pub mod matrix;
31pub mod parallel;
32
33pub mod basis;
34pub mod clustering;
35pub mod depth;
36pub mod detrend;
37pub mod fdata;
38pub mod helpers;
39pub mod irreg_fdata;
40pub mod metric;
41pub mod outliers;
42pub mod regression;
43pub mod seasonal;
44pub mod simulation;
45pub mod smoothing;
46pub mod streaming_depth;
47pub mod utility;
48
49// Re-export matrix type
50pub use matrix::FdMatrix;
51
52// Re-export commonly used items
53pub use helpers::{
54 extract_curves, l2_distance, simpsons_weights, simpsons_weights_2d, DEFAULT_CONVERGENCE_TOL,
55 NUMERICAL_EPS,
56};
57
58// Re-export seasonal analysis types
59pub use seasonal::{
60 autoperiod, autoperiod_fdata, cfd_autoperiod, cfd_autoperiod_fdata, hilbert_transform, sazed,
61 sazed_fdata, AutoperiodCandidate, AutoperiodResult, CfdAutoperiodResult, ChangeDetectionResult,
62 ChangePoint, ChangeType, DetectedPeriod, InstantaneousPeriod, Peak, PeakDetectionResult,
63 PeriodEstimate, SazedComponents, SazedResult, StrengthMethod,
64};
65
66// Re-export detrending types
67pub use detrend::{DecomposeResult, TrendResult};
68
69// Re-export simulation types
70pub use simulation::{EFunType, EValType};
71
72// Re-export irregular fdata types
73pub use irreg_fdata::IrregFdata;
74
75// Re-export streaming depth types
76pub use streaming_depth::{
77 FullReferenceState, RollingReference, SortedReferenceState, StreamingBd, StreamingDepth,
78 StreamingFraimanMuniz, StreamingMbd,
79};