Commit 8953dd19 authored by stefanow's avatar stefanow
Browse files

sampling

parent 42a5e6fb
......@@ -110,10 +110,10 @@ inline static numeric_t prior(const ThetaVector & theta){
/// Does the resampling
inline static void resample(const WeightVector & weights, CountVector & resample_count){
resample_count.setZero();
std::discrete_distribution<int> dist(weights.data(), weights.data() + weights.size());
#pragma omp parallel for
std::discrete_distribution<index_t> dist(weights.data(), weights.data() + weights.size());
#pragma omp parallel for schedule(static)
for(index_t i = 0; i < weights.size(); ++i){
numeric_t idx = dist(GEN);
index_t idx = dist(GEN);
#pragma omp atomic
resample_count(idx)++;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment