aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBertrand <bertrand.horel@gmail.com>2016-04-16 18:45:24 +0200
committerBertrand <bertrand.horel@gmail.com>2016-04-16 18:45:24 +0200
commit2de4eb353c3e94e401c1d5efd499b8c7ae880a4c (patch)
tree1e0355a2dd1ab7d768ffd5d4b522527e27b91986
parentaaebcdc7ae71dc48c871882ad94b062a683b9e31 (diff)
downloadprojet_C++-2de4eb353c3e94e401c1d5efd499b8c7ae880a4c.tar.gz
1ere version de 1ere table
-rw-r--r--src/projet.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/projet.cpp b/src/projet.cpp
index 4a5889e..a89c793 100644
--- a/src/projet.cpp
+++ b/src/projet.cpp
@@ -1,4 +1,5 @@
#include <iostream>
+#include <fstream>
#include <vector>
#include <gsl/gsl_cdf.h>
#include <gsl/gsl_math.h>
@@ -109,14 +110,31 @@ void exemple2_rqmc() {
}
};
+int make_table(vector< vector<double> > data1, vector< vector<double> > data2) {
+ std::fstream fs("doc/table.tex", std::fstream::out);;
+ fs<<R"(\begin{tabular}{|l|ll|ll|l|})"<<std::endl;
+ fs<<R"(\hline)"<<endl;
+ fs<<"N"<<" & "<<R"($\mu_{strat}$)"<<" & "<<R"($\mu_{rqmc}$)"<<" & "<<R"($IC_{strat}$)"<<" & "<<R"($IC_{rqmc}$)"<<" & "<<"Ratio strat/rqmc"<<R"(\\ \hline)"<<std::endl;
+ for (int i=0; i< 4; i++) {
+ double ic_strat = 1.95996*sqrt(data1[i][2]/(double) data1[i][0]);
+ fs<<data1[i][0]<<"&"<<data1[i][1]<<"&"<<data2[i][0]<<"&"<<ic_strat<<"&"<<data2[i][2]/2<<"&"<<ic_strat/(data2[i][2]/2)<<R"(\\ \hline)"<<std::endl;
+ }
+ fs<<R"(\end{tabular})"<<std::endl;
+ fs.close();
+ return 0;
+}
int main()
{
init_alea(1);
+ cout<<gsl_cdf_gaussian_Pinv(0.975,1)<<endl;
cout<<"Stratified_sampling sur l'exemple 1 de la normale"<<endl;
- exemple1_stratified();
+ vector< vector<double> > data1 = exemple1_stratified();
cout<<"Randomised quasi Monte-Carlo sur l'exemple 1 de la normale"<<endl;
- exemple1_rqmc();
+ vector< vector<double> > data2 = exemple1_rqmc();
+ make_table(data1, data2);
return 0;
}
+
+