stan-dev / stan

Stan development repository. The master branch contains the current release. The develop branch contains the latest stable development. See the Developer Process Wiki for details.
https://mc-stan.org
BSD 3-Clause "New" or "Revised" License
2.55k stars 365 forks source link

PSR: Return early if no draws #3246

Closed andrjohns closed 6 months ago

andrjohns commented 7 months ago

Submission Checklist

Summary

stan::analyze::compute_potential_scale_reduction still attempts to calculate the PSR if there are 0 draws passed, which is currently causing a segfault when calling stansummary on the output from optimize:

andrew@Andrews-MacBook-Air bernoulli % ./bernoulli optimize data file=bernoulli.data.json
...

andrew@Andrews-MacBook-Air bernoulli % ../../bin/stansummary output.csv
Warning: non-fatal error reading adaptation data
Assertion failed: (index >= 0 && index < size()), function operator(), file DenseCoeffsBase.h, line 181.
zsh: abort      ../../bin/stansummary output.csv

Intended Effect

No segfault

How to Verify

Call stansummary with this applied.

Side Effects

N/A

Documentation

N/A

Copyright and Licensing

Please list the copyright holder for the work you are submitting (this will be you or your assignee, such as a university or company): Andrew Johnson

By submitting this pull request, the copyright holder is agreeing to license the submitted work under the following licenses: