blob: 1c8e67086da2df7437ac18fb6ee0c5a0c3de202b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
#include "stratified_sampling.hpp"
std::pair<double, double> mean_var( std::vector<double> r){
std::pair<double, double> p;
for(auto &x: r){
p.first += x;
p.second += x*x;
}
p.first /= r.size();
p.second /= r.size();
p.second -= p.first * p.first;
return p;
}
|