Skip to content

Commit

Permalink
Add 5 and 8 argument overloads to wiener_lpdf
Browse files Browse the repository at this point in the history
Scalar only for now, see #1373 for partial reason
  • Loading branch information
WardBrian committed Mar 18, 2024
1 parent 8bc6ba0 commit bdb907f
Show file tree
Hide file tree
Showing 8 changed files with 7,192 additions and 11 deletions.
16 changes: 14 additions & 2 deletions src/middle/Stan_math_signatures.ml
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,14 @@ let distributions =
; (full_lpdf, "von_mises", [DVReal; DVReal; DVReal], SoA)
; (full_lpdf, "weibull", [DVReal; DVReal; DVReal], SoA)
; ([Lpdf], "wiener", [DVReal; DVReal; DVReal; DVReal; DVReal], SoA)
; ([Lpdf], "wishart_cholesky", [DMatrix; DReal; DMatrix], SoA)
; ( [Lpdf]
, "wiener"
, [DReal; DReal; DReal; DReal; DReal; DReal; DReal; DReal]
, AoS )
; ( [Lpdf]
, "wiener"
, [DReal; DReal; DReal; DReal; DReal; DReal; DReal; DReal; DReal]
, AoS ); ([Lpdf], "wishart_cholesky", [DMatrix; DReal; DMatrix], SoA)
; ([Lpdf], "wishart", [DMatrix; DReal; DMatrix], SoA) ]

let basic_vectorized = UnaryVectorized IntsToReals
Expand Down Expand Up @@ -483,7 +490,12 @@ let pretty_print_all_math_sigs ppf () =

let pretty_print_all_math_distributions ppf () =
let open Fmt in
let pp_dist ppf (kinds, name, _, _) =
let distributions =
String.Map.of_alist_reduce
(List.map ~f:(fun (kinds, name, _, _) -> (name, kinds)) distributions)
~f:(fun v1 v2 -> v1 @ v2 |> Set.Poly.of_list |> Set.to_list)
|> Map.to_alist in
let pp_dist ppf (name, kinds) =
pf ppf "@[%s: %a@]" name
(list ~sep:comma Fmt.string)
(List.map ~f:(Fn.compose String.lowercase show_fkind) kinds) in
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions test/integration/signatures/stan_math_distributions.t
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Display all Stan math distributions exposed in the language
$ stanc --dump-stan-math-distributions
beta_binomial: lpmf, rng, ccdf, cdf
beta: lpdf, rng, ccdf, cdf
beta_proportion: lpdf, ccdf, cdf
bernoulli: lpmf, rng, ccdf, cdf
bernoulli_logit: lpmf, rng
bernoulli_logit_glm: lpmf
beta: lpdf, rng, ccdf, cdf
beta_binomial: lpmf, rng, ccdf, cdf
beta_proportion: lpdf, ccdf, cdf
binomial: lpmf, rng, ccdf, cdf
binomial_logit: lpmf
binomial_logit_glm: lpmf
Expand All @@ -28,8 +28,8 @@ Display all Stan math distributions exposed in the language
hypergeometric: lpmf, rng
inv_chi_square: lpdf, rng, ccdf, cdf
inv_gamma: lpdf, rng, ccdf, cdf
inv_wishart_cholesky: lpdf
inv_wishart: lpdf
inv_wishart_cholesky: lpdf
lkj_corr: lpdf
lkj_corr_cholesky: lpdf
lkj_cov: lpdf
Expand All @@ -38,13 +38,13 @@ Display all Stan math distributions exposed in the language
lognormal: lpdf, rng, ccdf, cdf
multi_gp: lpdf
multi_gp_cholesky: lpdf
multinomial: lpmf
multinomial_logit: lpmf
multi_normal: lpdf
multi_normal_cholesky: lpdf
multi_normal_prec: lpdf
multi_student_t: lpdf
multi_student_t_cholesky: lpdf
multinomial: lpmf
multinomial_logit: lpmf
neg_binomial: lpmf, rng, ccdf, cdf
neg_binomial_2: lpmf, rng, ccdf, cdf
neg_binomial_2_log: lpmf, rng
Expand All @@ -61,13 +61,13 @@ Display all Stan math distributions exposed in the language
poisson_log_glm: lpmf
rayleigh: lpdf, rng, ccdf, cdf
scaled_inv_chi_square: lpdf, rng, ccdf, cdf
skew_normal: lpdf, rng, ccdf, cdf
skew_double_exponential: lpdf, rng, ccdf, cdf
student_t: lpdf, rng, ccdf, cdf
skew_normal: lpdf, rng, ccdf, cdf
std_normal: lpdf, rng, ccdf, cdf
student_t: lpdf, rng, ccdf, cdf
uniform: lpdf, rng, ccdf, cdf
von_mises: lpdf, rng, ccdf, cdf
weibull: lpdf, rng, ccdf, cdf
wiener: lpdf
wishart_cholesky: lpdf
wishart: lpdf
wishart_cholesky: lpdf
2 changes: 2 additions & 0 deletions test/integration/signatures/stan_math_signatures.t
Original file line number Diff line number Diff line change
Expand Up @@ -20695,6 +20695,8 @@ Display all Stan math signatures exposed in the language
weibull_rng(array[] real, array[] int) => array[] real
weibull_rng(array[] real, array[] real) => array[] real
wiener_lpdf(real, real, real, real, real) => real
wiener_lpdf(real, real, real, real, real, real, real, real) => real
wiener_lpdf(real, real, real, real, real, real, real, real, real) => real
wiener_lpdf(real, real, real, real, vector) => real
wiener_lpdf(real, real, real, real, row_vector) => real
wiener_lpdf(real, real, real, real, array[] real) => real
Expand Down

0 comments on commit bdb907f

Please sign in to comment.