pub fn std<F>(
x: &ArrayBase<ViewRepr<&F>, Dim<[usize; 1]>>,
ddof: usize,
workers: Option<usize>,
) -> Result<F, StatsError>Expand description
Compute the standard deviation of a data set.
§Arguments
x- Input dataddof- Delta degrees of freedom (0 for population standard deviation, 1 for sample standard deviation)workers- Number of threads to use for parallel computation (None for automatic selection)
§Returns
- The standard deviation of the data
§Examples
use scirs2_core::ndarray::array;
use scirs2_stats::std;
let data = array![1.0f64, 2.0, 3.0, 4.0, 5.0];
// Population standard deviation (ddof = 0)
let pop_std = std(&data.view(), 0, None).expect("Operation failed");
assert!((pop_std - 1.414213562373095).abs() < 1e-10);
// Sample standard deviation (ddof = 1)
let sample_std = std(&data.view(), 1, None).expect("Operation failed");
assert!((sample_std - 1.5811388300841898).abs() < 1e-10);