MCPcopy Create free account
hub / github.com/cloud-hypervisor/cloud-hypervisor / std_deviation

Function std_deviation

performance-metrics/src/main.rs:341–359  ·  view source on GitHub ↗
(data: &[f64])

Source from the content-addressed store, hash-verified

339}
340
341fn std_deviation(data: &[f64]) -> Option<f64> {
342 let count = data.len();
343
344 if count > 0 {
345 let mean = mean(data).unwrap();
346 let variance = data
347 .iter()
348 .map(|value| {
349 let diff = mean - *value;
350 diff * diff
351 })
352 .sum::<f64>()
353 / count as f64;
354
355 Some(variance.sqrt())
356 } else {
357 None
358 }
359}
360
361mod adjuster {
362 pub fn identity(v: f64) -> f64 {

Callers 1

runMethod · 0.85

Calls 4

meanFunction · 0.85
iterMethod · 0.80
lenMethod · 0.45
mapMethod · 0.45

Tested by

no test coverage detected