Skip to content

Commit 533bcc2

Browse files
committed
fix issues
1 parent 604239b commit 533bcc2

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

stan/math/prim/prob.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,5 +316,5 @@
316316
#include <stan/math/prim/prob/wishart_cholesky_rng.hpp>
317317
#include <stan/math/prim/prob/wishart_lpdf.hpp>
318318
#include <stan/math/prim/prob/wishart_rng.hpp>
319-
319+
#include <stan/math/prim/prob/yule_simon_lpmf.hpp>
320320
#endif

stan/math/prim/prob/yule_simon_lpmf.hpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,20 @@ inline return_type_t<T_alpha> yule_simon_lpmf(const T_n &n,
5757

5858
auto ops_partials = make_partials_propagator(alpha_ref);
5959

60-
scalar_seq_view<T_n> n_vec(n);
60+
scalar_seq_view<T_n_ref> n_vec(n_ref);
6161
scalar_seq_view<T_alpha_ref> alpha_vec(alpha_ref);
62-
const size_t max_size_seq_view = max_size(n, alpha);
62+
const size_t max_size_seq_view = max_size(n_ref, alpha_ref);
6363
T_partials_return logp(0.0);
64+
if constexpr (include_summand<propto>::value) {
65+
if constexpr (is_stan_scalar_v<T_n>) {
66+
logp += lgamma(n_ref) * max_size_seq_view;
67+
}
68+
}
6469
for (size_t i = 0; i < max_size_seq_view; i++) {
6570
if constexpr (include_summand<propto>::value) {
66-
logp += lgamma(n_vec.val(i));
71+
if constexpr (!is_stan_scalar_v<T_n>) {
72+
logp += lgamma(n_vec.val(i));
73+
}
6774
}
6875
T_partials_return alpha_plus_one = alpha_vec.val(i) + 1.0;
6976
logp += log(alpha_vec.val(i)) + lgamma(alpha_plus_one)

0 commit comments

Comments
 (0)