diff options
| author | Bertrand <bertrand.horel@gmail.com> | 2016-02-13 17:45:17 +0000 |
|---|---|---|
| committer | Bertrand <bertrand.horel@gmail.com> | 2016-02-13 17:45:17 +0000 |
| commit | 9f7ae751a0d6f7d27ad5f19d4fc697e722286b39 (patch) | |
| tree | 4b7e92a3d341c76b3714dc80addf01da028a96f4 /stratified_sampling.hpp | |
| parent | fc58c91b6a87c93ccb0a5fba025cf223716d0f5b (diff) | |
| download | projet_C++-9f7ae751a0d6f7d27ad5f19d4fc697e722286b39.tar.gz | |
Ajout de update dans la fonction draw
Diffstat (limited to 'stratified_sampling.hpp')
| -rw-r--r-- | stratified_sampling.hpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/stratified_sampling.hpp b/stratified_sampling.hpp index e7b3978..81080fc 100644 --- a/stratified_sampling.hpp +++ b/stratified_sampling.hpp @@ -49,14 +49,14 @@ template <typename L> struct stratified_sampling { stratified_sampling(vector<double> p, vector<L> X) :p(p), X(X), mean(p.size(), 0), sigma2(p.size(), 0), I(p.size()){}; - void update(int N); - void draw(); + void draw(int N); vector<double> get_mean() const; vector<double> get_var() const; void print_mean() const; void print_sigma() const; pair<double,double> estimator() const; private: + void update(int N); vector<double> p; vector<L> X; vector<int> M; @@ -111,7 +111,8 @@ void stratified_sampling<L>::update(int Nk) { } template <typename L> -void stratified_sampling<L>::draw() { +void stratified_sampling<L>::draw(int N) { + update(N); double m, s, oldmean; for(int i=0;i<I;i++){ m=0; |
