diff options
| author | Bertrand <bertrand.horel@gmail.com> | 2016-04-12 16:58:43 +0000 |
|---|---|---|
| committer | Bertrand <bertrand.horel@gmail.com> | 2016-04-12 16:58:43 +0000 |
| commit | bb87c9576a735fe9827db0d27d180b47f9884161 (patch) | |
| tree | 439cbee54582f19aa008b0c9a6b0cbfe8633f533 /src/rqmc.hpp | |
| parent | 85a3697125dce0f6478115a50b8309e38e97c709 (diff) | |
| download | projet_C++-bb87c9576a735fe9827db0d27d180b47f9884161.tar.gz | |
suite nettoyage, écriture exemple normale rqmc, transformation de la fonction monte_carlo en quasi_mean
Diffstat (limited to 'src/rqmc.hpp')
| -rw-r--r-- | src/rqmc.hpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/rqmc.hpp b/src/rqmc.hpp index 1b33713..03f7e81 100644 --- a/src/rqmc.hpp +++ b/src/rqmc.hpp @@ -56,7 +56,7 @@ mean(int n, VA X){ //Les classes de monte-Carlo template <typename L> -std::vector<double> monte_carlo(int n, L X) +std::vector<double> quasi_mean(int n, L X, double p=0.05) { std::vector<double> result(3,0); double x; @@ -67,14 +67,14 @@ std::vector<double> monte_carlo(int n, L X) } result[0] /= (double) n; result[1] = (result[1] - n*result[0]*result[0])/(double)(n-1); - result[2] = 1.96*sqrt(result[1]/(double) n); + result[2] = gsl_cdf_gaussian_Pinv(1-p/2,1)*sqrt(result[1]/(double) n); return result; }; template <typename L, typename Fct> -std::vector<double> monte_carlo(int n, Fct f, L X) +std::vector<double> quasi_mean(int n, Fct f, L X, double p=0.05) { - return monte_carlo(n, compose(f, X)); + return quasi_mean(n, compose(f, X), p); }; //Les classes de quasi-mean |
