aboutsummaryrefslogtreecommitdiffstats
path: root/stratified_sampling.hpp
diff options
context:
space:
mode:
authorGuillaume Horel <guillaume.horel@serenitascapital.com>2016-02-10 11:11:31 -0500
committerGuillaume Horel <guillaume.horel@serenitascapital.com>2016-02-10 11:11:31 -0500
commitfc58c91b6a87c93ccb0a5fba025cf223716d0f5b (patch)
tree50a0b1b2fab18f9a8d1da5fb7d384e4baf316aac /stratified_sampling.hpp
parent285fb5cdc5f88d9591c5173c8952931b1d97edeb (diff)
downloadprojet_C++-fc58c91b6a87c93ccb0a5fba025cf223716d0f5b.tar.gz
Fix error reported by -Wall
- initialize the member variables in the order they are declared
Diffstat (limited to 'stratified_sampling.hpp')
-rw-r--r--stratified_sampling.hpp10
1 files changed, 3 insertions, 7 deletions
diff --git a/stratified_sampling.hpp b/stratified_sampling.hpp
index 76fafbf..e7b3978 100644
--- a/stratified_sampling.hpp
+++ b/stratified_sampling.hpp
@@ -40,8 +40,8 @@ struct gaussian_truncated : public var_alea_real
~gaussian_truncated() { gsl_rng_free(gen); }
private:
+ double a, b, mean, sigma2;
int seed;
- double mean, sigma2, a, b;
gsl_rng *gen;
};
@@ -58,11 +58,11 @@ struct stratified_sampling {
pair<double,double> estimator() const;
private:
vector<double> p;
+ vector<L> X;
vector<int> M;
vector<int> cumM;
vector<double> mean;
vector<double> sigma2;
- vector<L> X;
const int I;
};
@@ -107,7 +107,7 @@ void stratified_sampling<L>::update(int Nk) {
M[i] += floor(current+m[i]) - floor(current);
current += m[i];
}
- M[I-1]+=Nk-I-floor(current);
+ M[I-1]+=Nk-I-floor(current);
}
template <typename L>
@@ -164,7 +164,3 @@ pair<double,double> stratified_sampling<L>::estimator() const {
}
return {est_mean, est_std};
}
-
-
-
-