Missing signature support for poisson_binomial
Cleaning up last few things before the release I tried to add poission_binomial to the language but C++ issue arose and should be cleaned up so we can finally expose it (no rush though):
-
poisson_binomial_rng(int)andpoisson_binomial_rng(real)fail to compile to C++ (I think the C++ was not written with these in mind but we typically support rngs for scalars as well) -
poisson_binomial_rng(vector)andpoisson_binomial_rng(row_vector)fail with expressions tests (I think the input is evaluated multiple times) -
poisson_binomial_lpmf(int, int),poisson_binomial_lpmf(int, real),poisson_binomial_lpmf(array[] int, int),poisson_binomial_lpmf(array[] int, int)and the same for_cdf,_lcdf,_lccdffail to compile to C++ (I think the C++ was not written with these in mind) - the
_lpmf/_cdf/_lcdf/_lccdfdo not compile forarray[] realas the second argument.
Hey Rok, my bad, I thought this was fixed in https://github.com/stan-dev/math/pull/2318. I'll look into it. Cheers, Simon
Yeah me too. We missed this when reviewing. Sorry about that. Thanks!
And dont apologize, its all good!
Hey @rok-cesnovar , is there a way to autogenerate all expression tests that have to pass for a function? Thanks, Simon
If the function is already exposed in stan language, the testing framework can get the list of signatures from the compiler. In that case you can run runTests.py ./test/expressions --only-functions poisson_binomial_rng. This one, however, is new, so you need to list all the signatures yourself like runTests.py ./test/expressions --only-functions "poisson_binomial_rng(int) => double" "poisson_binomial_lpmf(array[] int, int) => array[] double" ...
Cool, thanks @t4c1
@t4c1 is correct, only replace "double" with "real" (too much c++ in Tadej's blood :) ).
These are the full tests that should run successfully (some of them already do):
./runTests.py ./test/expressions --only-functions "poisson_binomial_cdf(int, real) => real"
./runTests.py ./test/expressions --only-functions "poisson_binomial_cdf(int, vector) => real"
./runTests.py ./test/expressions --only-functions "poisson_binomial_cdf(int, row_vector) => real"
./runTests.py ./test/expressions --only-functions "poisson_binomial_cdf(int, array[] real) => real"
./runTests.py ./test/expressions --only-functions "poisson_binomial_cdf(array[] int, real) => real"
./runTests.py ./test/expressions --only-functions "poisson_binomial_cdf(array[] int, vector) => real"
./runTests.py ./test/expressions --only-functions "poisson_binomial_cdf(array[] int, row_vector) => real"
./runTests.py ./test/expressions --only-functions "poisson_binomial_cdf(array[] int, array[] real) => real"
./runTests.py ./test/expressions --only-functions "poisson_binomial_lcdf(int, real) => real"
./runTests.py ./test/expressions --only-functions "poisson_binomial_lcdf(int, vector) => real"
./runTests.py ./test/expressions --only-functions "poisson_binomial_lcdf(int, row_vector) => real"
./runTests.py ./test/expressions --only-functions "poisson_binomial_lcdf(int, array[] real) => real"
./runTests.py ./test/expressions --only-functions "poisson_binomial_lcdf(array[] int, real) => real"
./runTests.py ./test/expressions --only-functions "poisson_binomial_lcdf(array[] int, vector) => real"
./runTests.py ./test/expressions --only-functions "poisson_binomial_lcdf(array[] int, row_vector) => real"
./runTests.py ./test/expressions --only-functions "poisson_binomial_lcdf(array[] int, array[] real) => real"
./runTests.py ./test/expressions --only-functions "poisson_binomial_lccdf(int, real) => real"
./runTests.py ./test/expressions --only-functions "poisson_binomial_lccdf(int, vector) => real"
./runTests.py ./test/expressions --only-functions "poisson_binomial_lccdf(int, row_vector) => real"
./runTests.py ./test/expressions --only-functions "poisson_binomial_lccdf(int, array[] real) => real"
./runTests.py ./test/expressions --only-functions "poisson_binomial_lccdf(array[] int, real) => real"
./runTests.py ./test/expressions --only-functions "poisson_binomial_lccdf(array[] int, vector) => real"
./runTests.py ./test/expressions --only-functions "poisson_binomial_lccdf(array[] int, row_vector) => real"
./runTests.py ./test/expressions --only-functions "poisson_binomial_lccdf(array[] int, array[] real) => real"
./runTests.py ./test/expressions --only-functions "poisson_binomial_lpmf(int, real) => real"
./runTests.py ./test/expressions --only-functions "poisson_binomial_lpmf(int, vector) => real"
./runTests.py ./test/expressions --only-functions "poisson_binomial_lpmf(int, row_vector) => real"
./runTests.py ./test/expressions --only-functions "poisson_binomial_lpmf(int, array[] real) => real"
./runTests.py ./test/expressions --only-functions "poisson_binomial_lpmf(array[] int, real) => real"
./runTests.py ./test/expressions --only-functions "poisson_binomial_lpmf(array[] int, vector) => real"
./runTests.py ./test/expressions --only-functions "poisson_binomial_lpmf(array[] int, row_vector) => real"
./runTests.py ./test/expressions --only-functions "poisson_binomial_lpmf(array[] int, array[] real) => real"
./runTests.py ./test/expressions --only-functions "poisson_binomial_rng(int) => int"
./runTests.py ./test/expressions --only-functions "poisson_binomial_rng(real) => int"
./runTests.py ./test/expressions --only-functions "poisson_binomial_rng(vector) => array[] int"
./runTests.py ./test/expressions --only-functions "poisson_binomial_rng(row_vector) => array[] int"
./runTests.py ./test/expressions --only-functions "poisson_binomial_rng(array[] int) => array[] int"
./runTests.py ./test/expressions --only-functions "poisson_binomial_rng(array[] real) => array[] int"
EDIT: fixed names from bernoulii to poisson_binomial
Have these functions made it into a release yet? Not seeing it on my end, but apologies if I've missed it. I see here plans for including poisson_binomial_* in v2.27