MCPcopy Create free account
hub / github.com/1a1a11a/libCacheSim / mean

Function mean

libCacheSim/traceAnalyzer/utils/include/utilsMath.h:30–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28
29template<typename T>
30static inline T mean(const std::vector<T> &v, size_t ignore_n_first, size_t ignore_n_last) {
31 if (v.size() == 0) {
32 return 0;
33 }
34 if (v.size() <= ignore_n_first + ignore_n_last) {
35 return 0;
36 }
37
38 T sum = accumulate(v.begin() + ignore_n_first, v.end() - ignore_n_last, (T) 0.0);
39 return sum / (v.size() - ignore_n_first - ignore_n_last);
40}
41
42template<typename T>
43static inline T median(const std::vector<T> &v) {

Callers 6

stdevFunction · 0.85
cal_group_metric_taskFunction · 0.85

Calls 3

sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected