diff options
| author | Guillaume Horel <guillaume.horel@gmail.com> | 2016-04-29 08:25:01 -0400 |
|---|---|---|
| committer | Guillaume Horel <guillaume.horel@gmail.com> | 2016-04-29 08:25:01 -0400 |
| commit | f100a36a823ddf7e69f83d860e008c3be0de873d (patch) | |
| tree | 5df51935aed7ab5b180a30aeb5269a0e2a0f6d5f | |
| parent | c7da1e6bdf492d11a585cd43bf4ee0608c242f53 (diff) | |
| download | projet_C++-f100a36a823ddf7e69f83d860e008c3be0de873d.tar.gz | |
répare indentation
| -rw-r--r-- | src/stratified_sampling.hpp | 37 |
1 files changed, 9 insertions, 28 deletions
diff --git a/src/stratified_sampling.hpp b/src/stratified_sampling.hpp index 9175f75..c6b9c19 100644 --- a/src/stratified_sampling.hpp +++ b/src/stratified_sampling.hpp @@ -82,7 +82,7 @@ private: template <typename L> void stratified_sampling<L>::update(int Nk) { bool first_step = M.empty(); - //reinitialistation du vecteur M du nombre de tirages par strates + //reinitialisation du vecteur M du nombre de tirages par strates if (first_step) { M.resize(I,1); cumM.resize(I,0); @@ -102,15 +102,14 @@ void stratified_sampling<L>::update(int Nk) { } } else { - //On remplit un vecter des écarts types à parti de notre vecteur de variance - std::vector<double> sigma(p.size(),0); - for (int i=0; i < I; i++) { - sigma[i]=sqrt(sigma2[i]); - } + //On remplit un vecteur des écarts types à partir de notre vecteur de variance + std::vector<double> sigma(p.size(),0); + for (int i=0; i < I; i++) { + sigma[i]=sqrt(sigma2[i]); + } double scal = std::inner_product(p.begin(), p.end(), sigma.begin(), (double) 0); for (int i=0; i < I; i++) { m[i] = (Nk-I)*p[i]*sigma[i]/scal; - //std::cout<<m[i]<<std::endl; } } M[0]+=floor(m[0]); @@ -124,7 +123,7 @@ void stratified_sampling<L>::update(int Nk) { template <typename L> void stratified_sampling<L>::draw(int N) { - update(N); + update(N); double m, s, oldmean; for(int i=0;i<I;i++){ m=0; @@ -151,24 +150,6 @@ vector<double> stratified_sampling<L>::get_var() const { }; template <typename L> -void stratified_sampling<L>::print_mean() const { - cout<<"les espérances :"<<endl; - for(int i=0;i<I;i++){ - cout<<mean[i]<<"\t"; - } - cout<<endl; -}; - -template <typename L> -void stratified_sampling<L>::print_sigma() const { - cout<<"les écarts types :"<<endl; - for(int i=0;i<I;i++){ - cout<<sqrt(sigma2[i])<<"\t"; - } - cout<<endl; -}; - -template <typename L> pair<double,double> stratified_sampling<L>::estimator() const { double est_mean = 0; double est_std = 0; @@ -194,7 +175,7 @@ struct exponential_tilt : public std::unary_function<std::vector<double>, double double scal = 0; for (unsigned int i=0; i<X.size(); i++){ Y[i] = X[i] + mu[i]; - scal+=X[i]*mu[i]; + scal += X[i]*mu[i]; } return f(Y) * exp(-scal-0.5*norm_mu); }; @@ -203,4 +184,4 @@ struct exponential_tilt : public std::unary_function<std::vector<double>, double std::vector<double> mu; Fct f; double norm_mu; - }; +}; |
