Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions include/sampleflow/producers/differential_evaluation_mh.h
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ namespace SampleFlow
// "generations" and an inner loop over the individual chains. We
// exit from the inner loop when we have reached the desired number of
// samples.
for (types::sample_index generation=0; true; ++generation)
for (types::sample_index generation=0; generation * n_chains < n_samples; ++generation)
{
// A vector that will contain the std::future objects used to
// hold results of either synchronous or asynchronous
Expand Down Expand Up @@ -315,11 +315,10 @@ namespace SampleFlow
// guarantees a stable order.
for (typename std::vector<OutputType>::size_type chain = 0; chain < n_chains; ++chain)
{
// Return if we have already generated the desired number of
// samples. The ScopeExit object above also makes sure that
// we flush the downstream consumers.
// Break the loop if we have already generated the desired number of
// samples:
if (generation * n_chains + chain >= n_samples)
return;
break;

// Wait for the futures to be ready. Then output the new sample
// (which may of course be equal to the old sample).
Expand Down
Loading