diff options
| author | Guillaume Horel <guillaume.horel@gmail.com> | 2016-02-01 08:36:32 -0500 |
|---|---|---|
| committer | Guillaume Horel <guillaume.horel@gmail.com> | 2016-02-01 08:36:32 -0500 |
| commit | 9910f253fa0223f42b72831a55319852dc3dcc0b (patch) | |
| tree | aaa55d58e6d002cc61e336a54de777b9ae3c3410 | |
| parent | be1296b2ad318a84f862e3ca768ca5eb7ba5972b (diff) | |
| download | projet_C++-9910f253fa0223f42b72831a55319852dc3dcc0b.tar.gz | |
wip
| -rw-r--r-- | stratified_sampling.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/stratified_sampling.cpp b/stratified_sampling.cpp index 1ba7360..98e5442 100644 --- a/stratified_sampling.cpp +++ b/stratified_sampling.cpp @@ -5,14 +5,13 @@ #include <gsl/gsl_cdf.h> - //--génération quantiles-- std::vector<double> quantile_norm(int n, double sigma){ - vector<double> quantile_norm(n); - for (int i=0, i<n, i++) { - quantile_norm[i]=gsl_cdf_gaussian_Pinv (i/n, sigma); - } - return quantile_norm; + std::vector<double> q(n); + for (int i=1; i<n; i++) { + q[i] = gsl_cdf_gaussian_Pinv ((double)i/n, sigma); + } + return q; } int main() @@ -21,8 +20,9 @@ int main() gsl_rng_env_setup(); // Read variable environnement const gsl_rng_type* type = gsl_rng_default; // Default algorithm 'twister' gsl_rng *gen = gsl_rng_alloc (type); // Rand generator allocation - - + std::vector<double> q; + q = quantile_norm(10, 1); + std::cout<<q[1]<<std::endl; return 0; } |
