aboutsummaryrefslogtreecommitdiffstats
path: root/rqmc.hpp
diff options
context:
space:
mode:
authorBertrand <bertrand.horel@gmail.com>2016-02-19 14:36:20 +0000
committerBertrand <bertrand.horel@gmail.com>2016-02-19 14:36:20 +0000
commit355e4567e68a76356714e2e58a42dcd78533cf6c (patch)
treea10914b61699aea703459a82204a5310ef5587e6 /rqmc.hpp
parentf79ce2d22cd224b9b8f46700d53a1e35a77ef801 (diff)
downloadprojet_C++-355e4567e68a76356714e2e58a42dcd78533cf6c.tar.gz
un peu de nettoyage
Diffstat (limited to 'rqmc.hpp')
-rw-r--r--rqmc.hpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/rqmc.hpp b/rqmc.hpp
index 415ab00..1b33713 100644
--- a/rqmc.hpp
+++ b/rqmc.hpp
@@ -79,22 +79,26 @@ std::vector<double> monte_carlo(int n, Fct f, L X)
//Les classes de quasi-mean
-
+template <typename LDS>
struct quasi_gaussian : public var_alea<std::vector<double> >
{
quasi_gaussian (int d, double mean = 0, double std =1)
- : d(d), mean(mean), std(std), sob(d) {};
+ : d(d), mean(mean), std(std), s(d), U(0,1), seed(d) {
+ for(int i=0; i<d; i++) {seed[i]=U();}
+ };
std::vector<double> operator ()(){
- std::vector<double> result = sob();
+ std::vector<double> result = s();
for(int i=0;i<d; i++){
- result[i] = mean + gsl_cdf_gaussian_Pinv(result[i], std);
+ result[i] = mean + gsl_cdf_gaussian_Pinv(frac_part(result[i]+seed[i]), std);
}
return value = result;
}
private:
int d;
double mean, std;
- sobol sob;
+ LDS s;
+ uniform U;
+ std::vector<double> seed;
};