Skip to content

Commit

Permalink
Merge pull request #1467 from stan-dev/feature/beta_neg_binomial_rng
Browse files Browse the repository at this point in the history
Expose beta_neg_binomial_rng
  • Loading branch information
SteveBronder authored Nov 22, 2024
2 parents 31c5e3d + bb80ffd commit 96e409a
Show file tree
Hide file tree
Showing 4 changed files with 290 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/middle/Stan_math_signatures.ml
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ let full_lpmf = [Lpmf; Rng; Ccdf; Cdf]

let distributions =
[ (full_lpmf, "beta_binomial", [DVInt; DVInt; DVReal; DVReal], Mem_pattern.SoA)
; ( [Lpmf; Ccdf; Cdf]
; ( [Lpmf; Ccdf; Cdf; Rng]
, "beta_neg_binomial"
, [DVInt; DVReal; DVReal; DVReal]
, SoA ); (full_lpdf, "beta", [DVReal; DVReal; DVReal], SoA)
Expand Down
72 changes: 72 additions & 0 deletions test/integration/good/function-signatures/distributions/rngs.stan
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,78 @@ generated quantities {
N = beta_binomial_rng(3, 3.5, u);
n = beta_binomial_rng(3, 3.5, 3);
n = beta_binomial_rng(3, 3.5, 3.5);
N = beta_neg_binomial_rng(ns, alpha, alpha);
N = beta_neg_binomial_rng(ns, alpha, nu);
N = beta_neg_binomial_rng(ns, alpha, ns);
N = beta_neg_binomial_rng(ns, alpha, u);
N = beta_neg_binomial_rng(ns, alpha, 3);
N = beta_neg_binomial_rng(ns, alpha, 3.5);
N = beta_neg_binomial_rng(ns, nu, alpha);
N = beta_neg_binomial_rng(ns, nu, nu);
N = beta_neg_binomial_rng(ns, nu, ns);
N = beta_neg_binomial_rng(ns, nu, u);
N = beta_neg_binomial_rng(ns, nu, 3);
N = beta_neg_binomial_rng(ns, nu, 3.5);
N = beta_neg_binomial_rng(ns, ns, alpha);
N = beta_neg_binomial_rng(ns, ns, nu);
N = beta_neg_binomial_rng(ns, ns, ns);
N = beta_neg_binomial_rng(ns, ns, u);
N = beta_neg_binomial_rng(ns, ns, 3);
N = beta_neg_binomial_rng(ns, ns, 3.5);
N = beta_neg_binomial_rng(ns, u, alpha);
N = beta_neg_binomial_rng(ns, u, nu);
N = beta_neg_binomial_rng(ns, u, ns);
N = beta_neg_binomial_rng(ns, u, u);
N = beta_neg_binomial_rng(ns, u, 3);
N = beta_neg_binomial_rng(ns, u, 3.5);
N = beta_neg_binomial_rng(ns, 3, alpha);
N = beta_neg_binomial_rng(ns, 3, nu);
N = beta_neg_binomial_rng(ns, 3, ns);
N = beta_neg_binomial_rng(ns, 3, u);
N = beta_neg_binomial_rng(ns, 3, 3);
N = beta_neg_binomial_rng(ns, 3, 3.5);
N = beta_neg_binomial_rng(ns, 3.5, alpha);
N = beta_neg_binomial_rng(ns, 3.5, nu);
N = beta_neg_binomial_rng(ns, 3.5, ns);
N = beta_neg_binomial_rng(ns, 3.5, u);
N = beta_neg_binomial_rng(ns, 3.5, 3);
N = beta_neg_binomial_rng(ns, 3.5, 3.5);
N = beta_neg_binomial_rng(3, alpha, alpha);
N = beta_neg_binomial_rng(3, alpha, nu);
N = beta_neg_binomial_rng(3, alpha, ns);
N = beta_neg_binomial_rng(3, alpha, u);
N = beta_neg_binomial_rng(3, alpha, 3);
N = beta_neg_binomial_rng(3, alpha, 3.5);
N = beta_neg_binomial_rng(3, nu, alpha);
N = beta_neg_binomial_rng(3, nu, nu);
N = beta_neg_binomial_rng(3, nu, ns);
N = beta_neg_binomial_rng(3, nu, u);
N = beta_neg_binomial_rng(3, nu, 3);
N = beta_neg_binomial_rng(3, nu, 3.5);
N = beta_neg_binomial_rng(3, ns, alpha);
N = beta_neg_binomial_rng(3, ns, nu);
N = beta_neg_binomial_rng(3, ns, ns);
N = beta_neg_binomial_rng(3, ns, u);
N = beta_neg_binomial_rng(3, ns, 3);
N = beta_neg_binomial_rng(3, ns, 3.5);
N = beta_neg_binomial_rng(3, u, alpha);
N = beta_neg_binomial_rng(3, u, nu);
N = beta_neg_binomial_rng(3, u, ns);
N = beta_neg_binomial_rng(3, u, u);
N = beta_neg_binomial_rng(3, u, 3);
N = beta_neg_binomial_rng(3, u, 3.5);
N = beta_neg_binomial_rng(3, 3, alpha);
N = beta_neg_binomial_rng(3, 3, nu);
N = beta_neg_binomial_rng(3, 3, ns);
N = beta_neg_binomial_rng(3, 3, u);
n = beta_neg_binomial_rng(3, 3, 3);
n = beta_neg_binomial_rng(3, 3, 3.5);
N = beta_neg_binomial_rng(3, 3.5, alpha);
N = beta_neg_binomial_rng(3, 3.5, nu);
N = beta_neg_binomial_rng(3, 3.5, ns);
N = beta_neg_binomial_rng(3, 3.5, u);
n = beta_neg_binomial_rng(3, 3.5, 3);
n = beta_neg_binomial_rng(3, 3.5, 3.5);
n = hypergeometric_rng(5, 4, 9);
n = ordered_logistic_rng(1.9, theta);
N = bernoulli_rng(alpha);
Expand Down
2 changes: 1 addition & 1 deletion test/integration/signatures/stan_math_distributions.t
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Display all Stan math distributions exposed in the language
bernoulli_logit_glm: lpmf
beta: lpdf, rng, ccdf, cdf
beta_binomial: lpmf, rng, ccdf, cdf
beta_neg_binomial: lpmf, ccdf, cdf
beta_neg_binomial: lpmf, ccdf, cdf, rng
beta_proportion: lpdf, ccdf, cdf
binomial: lpmf, rng, ccdf, cdf
binomial_logit: lpmf
Expand Down
216 changes: 216 additions & 0 deletions test/integration/signatures/stan_math_signatures.t
Original file line number Diff line number Diff line change
Expand Up @@ -2229,6 +2229,222 @@ Display all Stan math signatures exposed in the language
beta_neg_binomial_lpmf(array[] int, array[] real, array[] real, vector) => real
beta_neg_binomial_lpmf(array[] int, array[] real, array[] real, row_vector) => real
beta_neg_binomial_lpmf(array[] int, array[] real, array[] real, array[] real) => real
beta_neg_binomial_rng(int, int, int) => int
beta_neg_binomial_rng(int, int, real) => int
beta_neg_binomial_rng(int, real, int) => int
beta_neg_binomial_rng(int, real, real) => int
beta_neg_binomial_rng(real, int, int) => int
beta_neg_binomial_rng(real, int, real) => int
beta_neg_binomial_rng(real, real, int) => int
beta_neg_binomial_rng(real, real, real) => int
beta_neg_binomial_rng(int, int, vector) => array[] int
beta_neg_binomial_rng(int, int, row_vector) => array[] int
beta_neg_binomial_rng(int, int, array[] int) => array[] int
beta_neg_binomial_rng(int, int, array[] real) => array[] int
beta_neg_binomial_rng(int, real, vector) => array[] int
beta_neg_binomial_rng(int, real, row_vector) => array[] int
beta_neg_binomial_rng(int, real, array[] int) => array[] int
beta_neg_binomial_rng(int, real, array[] real) => array[] int
beta_neg_binomial_rng(int, vector, int) => array[] int
beta_neg_binomial_rng(int, vector, real) => array[] int
beta_neg_binomial_rng(int, vector, vector) => array[] int
beta_neg_binomial_rng(int, vector, row_vector) => array[] int
beta_neg_binomial_rng(int, vector, array[] int) => array[] int
beta_neg_binomial_rng(int, vector, array[] real) => array[] int
beta_neg_binomial_rng(int, row_vector, int) => array[] int
beta_neg_binomial_rng(int, row_vector, real) => array[] int
beta_neg_binomial_rng(int, row_vector, vector) => array[] int
beta_neg_binomial_rng(int, row_vector, row_vector) => array[] int
beta_neg_binomial_rng(int, row_vector, array[] int) => array[] int
beta_neg_binomial_rng(int, row_vector, array[] real) => array[] int
beta_neg_binomial_rng(int, array[] int, int) => array[] int
beta_neg_binomial_rng(int, array[] int, real) => array[] int
beta_neg_binomial_rng(int, array[] int, vector) => array[] int
beta_neg_binomial_rng(int, array[] int, row_vector) => array[] int
beta_neg_binomial_rng(int, array[] int, array[] int) => array[] int
beta_neg_binomial_rng(int, array[] int, array[] real) => array[] int
beta_neg_binomial_rng(int, array[] real, int) => array[] int
beta_neg_binomial_rng(int, array[] real, real) => array[] int
beta_neg_binomial_rng(int, array[] real, vector) => array[] int
beta_neg_binomial_rng(int, array[] real, row_vector) => array[] int
beta_neg_binomial_rng(int, array[] real, array[] int) => array[] int
beta_neg_binomial_rng(int, array[] real, array[] real) => array[] int
beta_neg_binomial_rng(real, int, vector) => array[] int
beta_neg_binomial_rng(real, int, row_vector) => array[] int
beta_neg_binomial_rng(real, int, array[] int) => array[] int
beta_neg_binomial_rng(real, int, array[] real) => array[] int
beta_neg_binomial_rng(real, real, vector) => array[] int
beta_neg_binomial_rng(real, real, row_vector) => array[] int
beta_neg_binomial_rng(real, real, array[] int) => array[] int
beta_neg_binomial_rng(real, real, array[] real) => array[] int
beta_neg_binomial_rng(real, vector, int) => array[] int
beta_neg_binomial_rng(real, vector, real) => array[] int
beta_neg_binomial_rng(real, vector, vector) => array[] int
beta_neg_binomial_rng(real, vector, row_vector) => array[] int
beta_neg_binomial_rng(real, vector, array[] int) => array[] int
beta_neg_binomial_rng(real, vector, array[] real) => array[] int
beta_neg_binomial_rng(real, row_vector, int) => array[] int
beta_neg_binomial_rng(real, row_vector, real) => array[] int
beta_neg_binomial_rng(real, row_vector, vector) => array[] int
beta_neg_binomial_rng(real, row_vector, row_vector) => array[] int
beta_neg_binomial_rng(real, row_vector, array[] int) => array[] int
beta_neg_binomial_rng(real, row_vector, array[] real) => array[] int
beta_neg_binomial_rng(real, array[] int, int) => array[] int
beta_neg_binomial_rng(real, array[] int, real) => array[] int
beta_neg_binomial_rng(real, array[] int, vector) => array[] int
beta_neg_binomial_rng(real, array[] int, row_vector) => array[] int
beta_neg_binomial_rng(real, array[] int, array[] int) => array[] int
beta_neg_binomial_rng(real, array[] int, array[] real) => array[] int
beta_neg_binomial_rng(real, array[] real, int) => array[] int
beta_neg_binomial_rng(real, array[] real, real) => array[] int
beta_neg_binomial_rng(real, array[] real, vector) => array[] int
beta_neg_binomial_rng(real, array[] real, row_vector) => array[] int
beta_neg_binomial_rng(real, array[] real, array[] int) => array[] int
beta_neg_binomial_rng(real, array[] real, array[] real) => array[] int
beta_neg_binomial_rng(vector, int, int) => array[] int
beta_neg_binomial_rng(vector, int, real) => array[] int
beta_neg_binomial_rng(vector, int, vector) => array[] int
beta_neg_binomial_rng(vector, int, row_vector) => array[] int
beta_neg_binomial_rng(vector, int, array[] int) => array[] int
beta_neg_binomial_rng(vector, int, array[] real) => array[] int
beta_neg_binomial_rng(vector, real, int) => array[] int
beta_neg_binomial_rng(vector, real, real) => array[] int
beta_neg_binomial_rng(vector, real, vector) => array[] int
beta_neg_binomial_rng(vector, real, row_vector) => array[] int
beta_neg_binomial_rng(vector, real, array[] int) => array[] int
beta_neg_binomial_rng(vector, real, array[] real) => array[] int
beta_neg_binomial_rng(vector, vector, int) => array[] int
beta_neg_binomial_rng(vector, vector, real) => array[] int
beta_neg_binomial_rng(vector, vector, vector) => array[] int
beta_neg_binomial_rng(vector, vector, row_vector) => array[] int
beta_neg_binomial_rng(vector, vector, array[] int) => array[] int
beta_neg_binomial_rng(vector, vector, array[] real) => array[] int
beta_neg_binomial_rng(vector, row_vector, int) => array[] int
beta_neg_binomial_rng(vector, row_vector, real) => array[] int
beta_neg_binomial_rng(vector, row_vector, vector) => array[] int
beta_neg_binomial_rng(vector, row_vector, row_vector) => array[] int
beta_neg_binomial_rng(vector, row_vector, array[] int) => array[] int
beta_neg_binomial_rng(vector, row_vector, array[] real) => array[] int
beta_neg_binomial_rng(vector, array[] int, int) => array[] int
beta_neg_binomial_rng(vector, array[] int, real) => array[] int
beta_neg_binomial_rng(vector, array[] int, vector) => array[] int
beta_neg_binomial_rng(vector, array[] int, row_vector) => array[] int
beta_neg_binomial_rng(vector, array[] int, array[] int) => array[] int
beta_neg_binomial_rng(vector, array[] int, array[] real) => array[] int
beta_neg_binomial_rng(vector, array[] real, int) => array[] int
beta_neg_binomial_rng(vector, array[] real, real) => array[] int
beta_neg_binomial_rng(vector, array[] real, vector) => array[] int
beta_neg_binomial_rng(vector, array[] real, row_vector) => array[] int
beta_neg_binomial_rng(vector, array[] real, array[] int) => array[] int
beta_neg_binomial_rng(vector, array[] real, array[] real) => array[] int
beta_neg_binomial_rng(row_vector, int, int) => array[] int
beta_neg_binomial_rng(row_vector, int, real) => array[] int
beta_neg_binomial_rng(row_vector, int, vector) => array[] int
beta_neg_binomial_rng(row_vector, int, row_vector) => array[] int
beta_neg_binomial_rng(row_vector, int, array[] int) => array[] int
beta_neg_binomial_rng(row_vector, int, array[] real) => array[] int
beta_neg_binomial_rng(row_vector, real, int) => array[] int
beta_neg_binomial_rng(row_vector, real, real) => array[] int
beta_neg_binomial_rng(row_vector, real, vector) => array[] int
beta_neg_binomial_rng(row_vector, real, row_vector) => array[] int
beta_neg_binomial_rng(row_vector, real, array[] int) => array[] int
beta_neg_binomial_rng(row_vector, real, array[] real) => array[] int
beta_neg_binomial_rng(row_vector, vector, int) => array[] int
beta_neg_binomial_rng(row_vector, vector, real) => array[] int
beta_neg_binomial_rng(row_vector, vector, vector) => array[] int
beta_neg_binomial_rng(row_vector, vector, row_vector) => array[] int
beta_neg_binomial_rng(row_vector, vector, array[] int) => array[] int
beta_neg_binomial_rng(row_vector, vector, array[] real) => array[] int
beta_neg_binomial_rng(row_vector, row_vector, int) => array[] int
beta_neg_binomial_rng(row_vector, row_vector, real) => array[] int
beta_neg_binomial_rng(row_vector, row_vector, vector) => array[] int
beta_neg_binomial_rng(row_vector, row_vector, row_vector) => array[] int
beta_neg_binomial_rng(row_vector, row_vector, array[] int) => array[] int
beta_neg_binomial_rng(row_vector, row_vector, array[] real) => array[] int
beta_neg_binomial_rng(row_vector, array[] int, int) => array[] int
beta_neg_binomial_rng(row_vector, array[] int, real) => array[] int
beta_neg_binomial_rng(row_vector, array[] int, vector) => array[] int
beta_neg_binomial_rng(row_vector, array[] int, row_vector) => array[] int
beta_neg_binomial_rng(row_vector, array[] int, array[] int) => array[] int
beta_neg_binomial_rng(row_vector, array[] int, array[] real) => array[] int
beta_neg_binomial_rng(row_vector, array[] real, int) => array[] int
beta_neg_binomial_rng(row_vector, array[] real, real) => array[] int
beta_neg_binomial_rng(row_vector, array[] real, vector) => array[] int
beta_neg_binomial_rng(row_vector, array[] real, row_vector) => array[] int
beta_neg_binomial_rng(row_vector, array[] real, array[] int) => array[] int
beta_neg_binomial_rng(row_vector, array[] real, array[] real) => array[] int
beta_neg_binomial_rng(array[] int, int, int) => array[] int
beta_neg_binomial_rng(array[] int, int, real) => array[] int
beta_neg_binomial_rng(array[] int, int, vector) => array[] int
beta_neg_binomial_rng(array[] int, int, row_vector) => array[] int
beta_neg_binomial_rng(array[] int, int, array[] int) => array[] int
beta_neg_binomial_rng(array[] int, int, array[] real) => array[] int
beta_neg_binomial_rng(array[] int, real, int) => array[] int
beta_neg_binomial_rng(array[] int, real, real) => array[] int
beta_neg_binomial_rng(array[] int, real, vector) => array[] int
beta_neg_binomial_rng(array[] int, real, row_vector) => array[] int
beta_neg_binomial_rng(array[] int, real, array[] int) => array[] int
beta_neg_binomial_rng(array[] int, real, array[] real) => array[] int
beta_neg_binomial_rng(array[] int, vector, int) => array[] int
beta_neg_binomial_rng(array[] int, vector, real) => array[] int
beta_neg_binomial_rng(array[] int, vector, vector) => array[] int
beta_neg_binomial_rng(array[] int, vector, row_vector) => array[] int
beta_neg_binomial_rng(array[] int, vector, array[] int) => array[] int
beta_neg_binomial_rng(array[] int, vector, array[] real) => array[] int
beta_neg_binomial_rng(array[] int, row_vector, int) => array[] int
beta_neg_binomial_rng(array[] int, row_vector, real) => array[] int
beta_neg_binomial_rng(array[] int, row_vector, vector) => array[] int
beta_neg_binomial_rng(array[] int, row_vector, row_vector) => array[] int
beta_neg_binomial_rng(array[] int, row_vector, array[] int) => array[] int
beta_neg_binomial_rng(array[] int, row_vector, array[] real) => array[] int
beta_neg_binomial_rng(array[] int, array[] int, int) => array[] int
beta_neg_binomial_rng(array[] int, array[] int, real) => array[] int
beta_neg_binomial_rng(array[] int, array[] int, vector) => array[] int
beta_neg_binomial_rng(array[] int, array[] int, row_vector) => array[] int
beta_neg_binomial_rng(array[] int, array[] int, array[] int) => array[] int
beta_neg_binomial_rng(array[] int, array[] int, array[] real) => array[] int
beta_neg_binomial_rng(array[] int, array[] real, int) => array[] int
beta_neg_binomial_rng(array[] int, array[] real, real) => array[] int
beta_neg_binomial_rng(array[] int, array[] real, vector) => array[] int
beta_neg_binomial_rng(array[] int, array[] real, row_vector) => array[] int
beta_neg_binomial_rng(array[] int, array[] real, array[] int) => array[] int
beta_neg_binomial_rng(array[] int, array[] real, array[] real) => array[] int
beta_neg_binomial_rng(array[] real, int, int) => array[] int
beta_neg_binomial_rng(array[] real, int, real) => array[] int
beta_neg_binomial_rng(array[] real, int, vector) => array[] int
beta_neg_binomial_rng(array[] real, int, row_vector) => array[] int
beta_neg_binomial_rng(array[] real, int, array[] int) => array[] int
beta_neg_binomial_rng(array[] real, int, array[] real) => array[] int
beta_neg_binomial_rng(array[] real, real, int) => array[] int
beta_neg_binomial_rng(array[] real, real, real) => array[] int
beta_neg_binomial_rng(array[] real, real, vector) => array[] int
beta_neg_binomial_rng(array[] real, real, row_vector) => array[] int
beta_neg_binomial_rng(array[] real, real, array[] int) => array[] int
beta_neg_binomial_rng(array[] real, real, array[] real) => array[] int
beta_neg_binomial_rng(array[] real, vector, int) => array[] int
beta_neg_binomial_rng(array[] real, vector, real) => array[] int
beta_neg_binomial_rng(array[] real, vector, vector) => array[] int
beta_neg_binomial_rng(array[] real, vector, row_vector) => array[] int
beta_neg_binomial_rng(array[] real, vector, array[] int) => array[] int
beta_neg_binomial_rng(array[] real, vector, array[] real) => array[] int
beta_neg_binomial_rng(array[] real, row_vector, int) => array[] int
beta_neg_binomial_rng(array[] real, row_vector, real) => array[] int
beta_neg_binomial_rng(array[] real, row_vector, vector) => array[] int
beta_neg_binomial_rng(array[] real, row_vector, row_vector) => array[] int
beta_neg_binomial_rng(array[] real, row_vector, array[] int) => array[] int
beta_neg_binomial_rng(array[] real, row_vector, array[] real) => array[] int
beta_neg_binomial_rng(array[] real, array[] int, int) => array[] int
beta_neg_binomial_rng(array[] real, array[] int, real) => array[] int
beta_neg_binomial_rng(array[] real, array[] int, vector) => array[] int
beta_neg_binomial_rng(array[] real, array[] int, row_vector) => array[] int
beta_neg_binomial_rng(array[] real, array[] int, array[] int) => array[] int
beta_neg_binomial_rng(array[] real, array[] int, array[] real) => array[] int
beta_neg_binomial_rng(array[] real, array[] real, int) => array[] int
beta_neg_binomial_rng(array[] real, array[] real, real) => array[] int
beta_neg_binomial_rng(array[] real, array[] real, vector) => array[] int
beta_neg_binomial_rng(array[] real, array[] real, row_vector) => array[] int
beta_neg_binomial_rng(array[] real, array[] real, array[] int) => array[] int
beta_neg_binomial_rng(array[] real, array[] real, array[] real) => array[] int
beta_proportion_lccdf(real, real, int) => real
beta_proportion_lccdf(real, real, real) => real
beta_proportion_lccdf(real, real, vector) => real
Expand Down

0 comments on commit 96e409a

Please sign in to comment.