scirs2_datasets/utils/extensions.rs
1//! Trait extensions for ndarray and other types
2//!
3//! This module provides trait extensions that add useful methods to existing types,
4//! particularly for statistical operations and data manipulation that complement
5//! the core ndarray functionality.
6
7// Re-export the StatsExt trait from scaling where it's defined
8pub use crate::utils::scaling::StatsExt;
9
10// Additional trait extensions can be added here in the future
11// For example: Extensions for DataFrame operations, specialized array operations, etc.
12
13#[cfg(test)]
14mod tests {
15 use ndarray::array;
16
17 #[test]
18 fn test_stats_ext_integration() {
19 let data = array![1.0, 2.0, 3.0, 4.0, 5.0];
20 let view = data.view();
21
22 // Test that we can use the StatsExt trait methods
23 let mean = view.mean().unwrap();
24 assert!((mean - 3.0_f64).abs() < 1e-10);
25
26 let std = view.std(0.0);
27 assert!(std > 0.0);
28 }
29}