@@ -54,6 +54,7 @@ using std::unordered_map;
5454using std::runtime_error;
5555using std::to_string;
5656using std::mt19937;
57+ using std::max;
5758
5859static const string preseq_version = " 3.0.2" ;
5960
@@ -126,6 +127,7 @@ vector_median_and_ci(const vector<vector<double> > &bootstrap_estimates,
126127
127128 const size_t n_est = bootstrap_estimates.size ();
128129 vector<double > estimates_row (n_est, 0.0 );
130+ double prev_estimate = 0 ;
129131 for (size_t i = 0 ; i < bootstrap_estimates[0 ].size (); i++) {
130132
131133 // estimates is in wrong order, work locally on const val
@@ -137,9 +139,14 @@ vector_median_and_ci(const vector<vector<double> > &bootstrap_estimates,
137139 lower_ci_estimate, upper_ci_estimate);
138140 sort (begin (estimates_row), end (estimates_row));
139141
142+ if (median_estimate - prev_estimate < 1.0 )
143+ break ;
144+
140145 yield_estimates.push_back (median_estimate);
141146 lower_ci_lognorm.push_back (lower_ci_estimate);
142147 upper_ci_lognorm.push_back (upper_ci_estimate);
148+
149+ prev_estimate = median_estimate;
143150 }
144151}
145152
@@ -350,7 +357,6 @@ extrap_bootstrap(const bool VERBOSE, const bool allow_defects,
350357 extrapolate_curve (defect_cf, initial_distinct, sample_vals_sum,
351358 curr_sample_sz, bin_step_size,
352359 max_extrap, yield_vector);
353-
354360 // no checking of curve in defect mode
355361 bootstrap_estimates.push_back (yield_vector);
356362 successful_bootstrap = true ;
0 commit comments