aboutsummaryrefslogtreecommitdiffstats
path: root/main.cpp
diff options
context:
space:
mode:
authorBertrand <bertrand.horel@gmail.com>2016-02-19 15:03:51 +0000
committerBertrand <bertrand.horel@gmail.com>2016-02-19 15:03:51 +0000
commitd2b133901a65244934eb642ec8e20c797efaf650 (patch)
treef8d186f8e8ca0886f8f0a464261ba8747242b4e6 /main.cpp
parent355e4567e68a76356714e2e58a42dcd78533cf6c (diff)
downloadprojet_C++-d2b133901a65244934eb642ec8e20c797efaf650.tar.gz
nettoyage du dépôt
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp53
1 files changed, 0 insertions, 53 deletions
diff --git a/main.cpp b/main.cpp
deleted file mode 100644
index f81f1dd..0000000
--- a/main.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-#include <iostream>
-#include <gsl/gsl_rng.h>
-#include <vector>
-#include <gsl/gsl_cdf.h>
-#include <gsl/gsl_math.h>
-#include "stratified_sampling.hpp"
-#include <cmath>
-#include <algorithm>
-
-using namespace std;
-//--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);
- }
- return q;
-}
-
-int main()
-{
- //--- GSL random init ---
- gsl_rng_env_setup();
- vector<double> q = quantile_norm(10, 1);
- vector<double> p(10, 0.1);
- vector<gaussian_truncated> rvar;
- rvar.push_back(gaussian_truncated(GSL_NEGINF, q[0],0,1,0));
- for (int i=1; i<10; i++){
- rvar.push_back(gaussian_truncated(q[i-1], q[i],0,1,i));
- }
- stratified_sampling<gaussian_truncated> S(p,rvar);
- //S.update(100);
- S.draw(100);
- double x = 1.64*S.estimator().second;
- cout<<"l'estimateur de la moyenne est :"<<S.estimator().first<<endl;
- cout<<"Son intervalle de confiance à 95% est :"<<"["<<S.estimator().first-(x/10)<<" ,"<<S.estimator().first+(x/10)<<"]"<<endl;
- //S.update(1000);
- S.draw(1000);
- x = 1.64*S.estimator().second;
- cout<<"l'estimateur de la moyenne est :"<<S.estimator().first<<endl;
- cout<<"Son intervalle de confiance à 95% est :"<<"["<<S.estimator().first-(x/sqrt(1100))<<" ,"<<S.estimator().first+(x/sqrt(1100))<<"]"<<endl;
- //S.update(10000);
- S.draw(10000);
- x = 1.64*S.estimator().second;
- cout<<"l'estimateur de la moyenne est :"<<S.estimator().first<<endl;
- cout<<"Son intervalle de confiance à 95% est :"<<"["<<S.estimator().first-(x/sqrt(11100))<<" ,"<<S.estimator().first+(x/sqrt(11100))<<"]"<<endl;
-
- //~ S.draw();
- //~ for(int i=0;i<10;i++){
- //~ cout<<S.get_mean()[i]<<endl;
- //~ }
- return 0;
-}