From 906c2dee383a7eb72632bfbdf61916a576a5460d Mon Sep 17 00:00:00 2001 From: Bertrand Date: Sun, 21 Feb 2016 16:35:30 +0000 Subject: création de la struct f_mu MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/stratified_sampling.hpp | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) (limited to 'src/stratified_sampling.hpp') diff --git a/src/stratified_sampling.hpp b/src/stratified_sampling.hpp index cebee8d..7573ef2 100644 --- a/src/stratified_sampling.hpp +++ b/src/stratified_sampling.hpp @@ -5,6 +5,7 @@ #include "rtnorm.hpp" #include "var_alea.hpp" #include +#include "option.hpp" using namespace std; @@ -45,14 +46,14 @@ struct multi_gaussian_truncated : public var_alea > double v = V(); double Z = gsl_cdf_gaussian_Pinv(v,1); std::vector Y(d); - double scal = 0; for(int i=0; i X(d); + double scal = 0; for(int j=0; j X(d); for(int i=0; i estimator() const; private: - void update(int N); + void update(int N); vector p; vector X; vector M; @@ -187,3 +188,29 @@ pair stratified_sampling::estimator() const { } return {est_mean, est_std}; } + +struct f_mu : public std::unary_function, double> +{ + f_mu(std::vector mu, asian_option A) : mu(mu), A(A){ + double norm_mu = 0; + for(int i=0; i<16; i++) { + norm_mu += mu[i]*mu[i]; + } + }; + + double operator()(std::vector X) { + std::vector Y(X.size()); + double scal = 0; + for (unsigned int i=0; i mu; + asian_option A; + double norm_mu; + }; + -- cgit v1.2.3-70-g09d2