Skip to content

Commit

Permalink
Fix a bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
bangerth committed Dec 16, 2024
1 parent 3046cdd commit b7a5ce5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -233,12 +233,14 @@ namespace SampleFlow
b_dist(0, n_chains - 3);

typename std::vector<OutputType>::size_type b = b_dist(rng);
if (b >= std::min<typename std::vector<OutputType>::size_type>(a, chain))
++b;
if (b >= std::max(a, chain))
b += 2;
else if (b >= std::min<typename std::vector<OutputType>::size_type>(a, chain))
b += 1;
++b;
const OutputType trial_b = current_samples[b];

assert (a!=b);

// Combine trial a and trial b
const OutputType crossover_result = crossover(current_samples[chain], trial_a, trial_b);
trial_sample_and_ratio = propose_sample(crossover_result);
Expand Down
2 changes: 1 addition & 1 deletion tests/differential_evaluation_mh_producer_01.output
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Mean value = 1.9881
Mean value = 1.98196

0 comments on commit b7a5ce5

Please sign in to comment.