Closed chvandorp closed 1 month ago
Name | Old Result | New Result | Ratio | Performance change( 1 - new / old ) |
---|---|---|---|---|
arma/arma.stan | 0.19 | 0.2 | 0.96 | -4.08% slower |
low_dim_corr_gauss/low_dim_corr_gauss.stan | 0.01 | 0.01 | 1.02 | 1.91% faster |
gp_regr/gen_gp_data.stan | 0.02 | 0.02 | 0.99 | -1.22% slower |
gp_regr/gp_regr.stan | 0.11 | 0.11 | 0.97 | -2.99% slower |
sir/sir.stan | 79.42 | 80.42 | 0.99 | -1.26% slower |
irt_2pl/irt_2pl.stan | 4.1 | 3.84 | 1.07 | 6.44% faster |
eight_schools/eight_schools.stan | 0.06 | 0.05 | 1.04 | 4.06% faster |
pkpd/sim_one_comp_mm_elim_abs.stan | 0.26 | 0.25 | 1.04 | 3.99% faster |
pkpd/one_comp_mm_elim_abs.stan | 18.41 | 17.81 | 1.03 | 3.26% faster |
garch/garch.stan | 0.47 | 0.45 | 1.04 | 3.94% faster |
low_dim_gauss_mix/low_dim_gauss_mix.stan | 2.86 | 2.76 | 1.03 | 3.32% faster |
arK/arK.stan | 1.64 | 1.61 | 1.02 | 1.71% faster |
gp_pois_regr/gp_pois_regr.stan | 2.6 | 2.5 | 1.04 | 3.81% faster |
low_dim_gauss_mix_collapse/low_dim_gauss_mix_collapse.stan | 9.15 | 9.09 | 1.01 | 0.62% faster |
performance.compilation | 180.85 | 186.07 | 0.97 | -2.88% slower |
Mean result: 1.0149077305597232
Jenkins Console Log Blue Ocean Commit hash: a336d9a814ea6e70dee68d8dbdc632f2e97dca52
Summary
This PR fixes a small bug in
multinomial_rng
andmultinomial_logit_rng
. While the lpmf functions accept a zero count vector, the RNGs do not accept a zero total count. This is fixed by replacingcheck_positive
withcheck_nonnegative
for the parameterN
. In addition the doc strings ofmultinomial_rng
admultinomial_logit_rng
are updated to indicate which exceptions are thrown under what conditions. I've also updated a comment indirichlet_multinomial_rng
, which was no longer relevant because of this bug fix.Tests
For both
multinomial_rng
andmultinomial_logit_rng
a test is added (calledRNGZero
) to test that no exceptions are thrown whenN == 0
, and that the result is a zero count vector.Side Effects
There should be no side effects
Release notes
The RNGs for the multinomial and multinomial_logit distributions now accept a zero total count, resulting in a zero integer vector.
Checklist
[x] Copyright holder: Christiaan H. van Dorp
By submitting this pull request, the copyright holder is agreeing to the license the submitted work under the following licenses:
[x] the basic tests are passing
./runTests.py test/unit
)make test-headers
)make test-math-dependencies
)make doxygen
)make cpplint
)[x] the code is written in idiomatic C++ and changes are documented in the doxygen
[x] the new changes are tested