aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/projet.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/projet.cpp b/src/projet.cpp
index a89c793..6bcd90a 100644
--- a/src/projet.cpp
+++ b/src/projet.cpp
@@ -112,12 +112,13 @@ 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"(\begin{tabular}{|r|rr|rr|r|})"<<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;
+ fs<<"N"<<" & "<<R"($\mu_{strat}$)"<<" & "<<R"($\mu_{rqmc}$)"<<" & "<<R"($\textrm{IC}_{strat}$)"<<" & "<<R"($\textrm{IC}_{rqmc}$)"<<" & "<< R"($\textrm{IC}_{strat}/\textrm{IC}_{rqmc}$)"<<R"(\\ \hline)"<<std::endl;
+ fs.precision(2);
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<<(int)data1[i][0]<<"&"<<scientific<<data1[i][1]<<"&"<<data2[i][0]<<"&"<<ic_strat<<"&"<<data2[i][2]/2<<"&"<<fixed<<ic_strat/(data2[i][2]/2)<<R"(\\ \hline)"<<std::endl;
}
fs<<R"(\end{tabular})"<<std::endl;
fs.close();