MCPcopy Create free account
hub / github.com/alandefreitas/matplotplusplus / mean

Function mean

source/matplot/util/common.cpp:207–213  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

205 }
206
207 double mean(const std::vector<double> &x) {
208 double sum = 0;
209 for (const double &xi : x) {
210 sum += xi / static_cast<double>(x.size());
211 }
212 return sum;
213 }
214
215 double stddev(const std::vector<double> &x) {
216 double m = mean(x);

Callers 1

stddevFunction · 0.70

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected