diff options
| author | Bertrand <bertrand.horel@gmail.com> | 2016-02-19 15:03:51 +0000 |
|---|---|---|
| committer | Bertrand <bertrand.horel@gmail.com> | 2016-02-19 15:03:51 +0000 |
| commit | d2b133901a65244934eb642ec8e20c797efaf650 (patch) | |
| tree | f8d186f8e8ca0886f8f0a464261ba8747242b4e6 /src/stratified_sampling.cpp | |
| parent | 355e4567e68a76356714e2e58a42dcd78533cf6c (diff) | |
| download | projet_C++-d2b133901a65244934eb642ec8e20c797efaf650.tar.gz | |
nettoyage du dépôt
Diffstat (limited to 'src/stratified_sampling.cpp')
| -rw-r--r-- | src/stratified_sampling.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/stratified_sampling.cpp b/src/stratified_sampling.cpp new file mode 100644 index 0000000..c1c8dc1 --- /dev/null +++ b/src/stratified_sampling.cpp @@ -0,0 +1,13 @@ +#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; +} |
