diff options
| author | Bertrand <bertrand.horel@gmail.com> | 2016-03-01 14:37:15 +0000 |
|---|---|---|
| committer | Bertrand <bertrand.horel@gmail.com> | 2016-03-01 14:37:15 +0000 |
| commit | 91c7bd065174f861bd3e64c289e417d1a990e02f (patch) | |
| tree | 1a581f3d8902028fd3ed60a08fab37060625df3e | |
| parent | 4675240a7ae8794773fbd871efc0cdcb8751f6c9 (diff) | |
| download | projet_C++-91c7bd065174f861bd3e64c289e417d1a990e02f.tar.gz | |
rajout quantile_norm
| -rw-r--r-- | src/stratified_sampling.cpp | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/stratified_sampling.cpp b/src/stratified_sampling.cpp index 1c8e670..9586a86 100644 --- a/src/stratified_sampling.cpp +++ b/src/stratified_sampling.cpp @@ -1,16 +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; +//--génération quantiles-- +vector<double> quantile_norm(int n, double sigma){ + vector<double> q(n); + for (int i=0; i<n; i++) { + q[i] = gsl_cdf_gaussian_Pinv ((double)(i+1)/n, sigma); } - p.first /= r.size(); - p.second /= r.size(); - p.second -= p.first * p.first; - return p; + return q; } |
