MCPcopy Create free account
hub / github.com/bloomen/transwarp / stddev

Function stddev

examples/benchmark_statistical.cpp:30–35  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28}
29
30double stddev(data_t data, double average) {
31 double sum = 0;
32 std::for_each(data->begin(), data->end(),
33 [average,&sum](double x) { sum += std::pow(x - average, 2.); });
34 return std::sqrt(sum / static_cast<double>(data->size()));
35}
36
37double median(data_t data) {
38 auto copy = *data;

Callers 1

calculate_via_functionsFunction · 0.70

Calls 4

for_eachFunction · 0.85
beginMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected