Skip to content

Commit

Permalink
Merge pull request #3246 from stan-dev/stansummary-segfault
Browse files Browse the repository at this point in the history
PSR: Return early if no draws
  • Loading branch information
WardBrian authored Jan 3, 2024
2 parents 1c85085 + aad5d48 commit 267722a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/stan/analyze/mcmc/compute_potential_scale_reduction.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ inline double compute_potential_scale_reduction(
std::vector<const double*> draws, std::vector<size_t> sizes) {
int num_chains = sizes.size();
size_t num_draws = sizes[0];
if (num_draws == 0) {
return std::numeric_limits<double>::quiet_NaN();
}
for (int chain = 1; chain < num_chains; ++chain) {
num_draws = std::min(num_draws, sizes[chain]);
}
Expand Down

0 comments on commit 267722a

Please sign in to comment.