We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 07585a9 + f942abc commit c997e3bCopy full SHA for c997e3b
src/stan/services/pathfinder/multi.hpp
@@ -343,11 +343,13 @@ inline int pathfinder_lbfgs_multi(
343
sample_row.tail(uc_param_size) = approx_samples_constrained_col;
344
safe_write(sample_row);
345
// If we see the same draw idx more than once, just increment j and
346
- // write again
347
- while (j < (single_path_psis_idxs[i].second)
348
- && draw_idx == psis_draw_idxs.coeff(j + 1)) {
349
- safe_write(sample_row);
350
- ++j;
+ // write again if there are remaining draws
+ if (j < (psis_draw_idxs.size() - 1)) {
+ while (j < (single_path_psis_idxs[i].second)
+ && draw_idx == psis_draw_idxs.coeff(j + 1)) {
+ safe_write(sample_row);
351
+ ++j;
352
+ }
353
}
354
355
0 commit comments