Skip to content

Commit 6545ad6

Browse files
committed
Merge branch 'develop' into hyper-1f0
2 parents dcac15f + 5384ea7 commit 6545ad6

File tree

71 files changed

+215
-225
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+215
-225
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ Replace this text with a short note on what will change if this pull request is
2626

2727
## Checklist
2828

29-
- [ ] Math issue #(issue number)
30-
3129
- [ ] Copyright holder: (fill in copyright holder information)
3230

3331
The copyright holder is typically you or your assignee, such as a university or company. By submitting this pull request, the copyright holder is agreeing to the license the submitted work under the following licenses:

stan/math/prim/meta/ref_type.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#define STAN_MATH_PRIM_META_REF_TYPE_HPP
33

44
#include <stan/math/prim/fun/Eigen.hpp>
5+
#include <stan/math/prim/meta/is_constant.hpp>
56
#include <stan/math/prim/meta/is_eigen.hpp>
67
#include <stan/math/prim/meta/is_arena_matrix.hpp>
78
#include <stan/math/prim/meta/is_vector.hpp>
@@ -56,6 +57,10 @@ using ref_type_t = typename ref_type_if<true, T>::type;
5657
template <bool Condition, typename T>
5758
using ref_type_if_t = typename ref_type_if<Condition, T>::type;
5859

60+
template <typename T>
61+
using ref_type_if_not_constant_t =
62+
typename ref_type_if<!is_constant<T>::value, T>::type;
63+
5964
} // namespace stan
6065

6166
#endif

stan/math/prim/prob/bernoulli_logit_glm_lpmf.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ return_type_t<T_x, T_alpha, T_beta> bernoulli_logit_glm_lpmf(
6565
using T_xbeta_tmp =
6666
typename std::conditional_t<T_x_rows == 1, T_xbeta_partials,
6767
Array<T_xbeta_partials, Dynamic, 1>>;
68-
using T_x_ref = ref_type_if_t<!is_constant<T_x>::value, T_x>;
69-
using T_alpha_ref = ref_type_if_t<!is_constant<T_alpha>::value, T_alpha>;
70-
using T_beta_ref = ref_type_if_t<!is_constant<T_beta>::value, T_beta>;
68+
using T_x_ref = ref_type_if_not_constant_t<T_x>;
69+
using T_alpha_ref = ref_type_if_not_constant_t<T_alpha>;
70+
using T_beta_ref = ref_type_if_not_constant_t<T_beta>;
7171

7272
const size_t N_instances = T_x_rows == 1 ? stan::math::size(y) : x.rows();
7373
const size_t N_attributes = x.cols();

stan/math/prim/prob/bernoulli_logit_lpmf.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ return_type_t<T_prob> bernoulli_logit_lpmf(const T_n& n, const T_prob& theta) {
3737
using T_partials_return = partials_return_t<T_n, T_prob>;
3838
using T_partials_array = Eigen::Array<T_partials_return, Eigen::Dynamic, 1>;
3939
using std::exp;
40-
using T_n_ref = ref_type_if_t<!is_constant<T_n>::value, T_n>;
41-
using T_theta_ref = ref_type_if_t<!is_constant<T_prob>::value, T_prob>;
40+
using T_n_ref = ref_type_if_not_constant_t<T_n>;
41+
using T_theta_ref = ref_type_if_not_constant_t<T_prob>;
4242
static const char* function = "bernoulli_logit_lpmf";
4343
check_consistent_sizes(function, "Random variable", n,
4444
"Probability parameter", theta);

stan/math/prim/prob/beta_lpdf.hpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,9 @@ template <bool propto, typename T_y, typename T_scale_succ,
4747
return_type_t<T_y, T_scale_succ, T_scale_fail> beta_lpdf(
4848
const T_y& y, const T_scale_succ& alpha, const T_scale_fail& beta) {
4949
using T_partials_return = partials_return_t<T_y, T_scale_succ, T_scale_fail>;
50-
using T_y_ref = ref_type_if_t<!is_constant<T_y>::value, T_y>;
51-
using T_alpha_ref
52-
= ref_type_if_t<!is_constant<T_scale_succ>::value, T_scale_succ>;
53-
using T_beta_ref
54-
= ref_type_if_t<!is_constant<T_scale_fail>::value, T_scale_fail>;
50+
using T_y_ref = ref_type_if_not_constant_t<T_y>;
51+
using T_alpha_ref = ref_type_if_not_constant_t<T_scale_succ>;
52+
using T_beta_ref = ref_type_if_not_constant_t<T_scale_fail>;
5553
static const char* function = "beta_lpdf";
5654
check_consistent_sizes(function, "Random variable", y,
5755
"First shape parameter", alpha,

stan/math/prim/prob/beta_proportion_lpdf.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ return_type_t<T_y, T_loc, T_prec> beta_proportion_lpdf(const T_y& y,
5353
const T_prec& kappa) {
5454
using T_partials_return = partials_return_t<T_y, T_loc, T_prec>;
5555
using std::log;
56-
using T_y_ref = ref_type_if_t<!is_constant<T_y>::value, T_y>;
57-
using T_mu_ref = ref_type_if_t<!is_constant<T_loc>::value, T_loc>;
58-
using T_kappa_ref = ref_type_if_t<!is_constant<T_prec>::value, T_prec>;
56+
using T_y_ref = ref_type_if_not_constant_t<T_y>;
57+
using T_mu_ref = ref_type_if_not_constant_t<T_loc>;
58+
using T_kappa_ref = ref_type_if_not_constant_t<T_prec>;
5959
static const char* function = "beta_proportion_lpdf";
6060
check_consistent_sizes(function, "Random variable", y, "Location parameter",
6161
mu, "Precision parameter", kappa);

stan/math/prim/prob/binomial_logit_lpmf.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ template <bool propto, typename T_n, typename T_N, typename T_prob,
3737
return_type_t<T_prob> binomial_logit_lpmf(const T_n& n, const T_N& N,
3838
const T_prob& alpha) {
3939
using T_partials_return = partials_return_t<T_n, T_N, T_prob>;
40-
using T_n_ref = ref_type_if_t<!is_constant<T_n>::value, T_n>;
41-
using T_N_ref = ref_type_if_t<!is_constant<T_N>::value, T_N>;
42-
using T_alpha_ref = ref_type_if_t<!is_constant<T_prob>::value, T_prob>;
40+
using T_n_ref = ref_type_if_not_constant_t<T_n>;
41+
using T_N_ref = ref_type_if_not_constant_t<T_N>;
42+
using T_alpha_ref = ref_type_if_not_constant_t<T_prob>;
4343
static const char* function = "binomial_logit_lpmf";
4444
check_consistent_sizes(function, "Successes variable", n,
4545
"Population size parameter", N,

stan/math/prim/prob/categorical_logit_glm_lpmf.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ return_type_t<T_x, T_alpha, T_beta> categorical_logit_glm_lpmf(
5454
using std::isfinite;
5555
using std::log;
5656
using T_y_ref = ref_type_t<T_y>;
57-
using T_x_ref = ref_type_if_t<!is_constant<T_x>::value, T_x>;
58-
using T_alpha_ref = ref_type_if_t<!is_constant<T_alpha>::value, T_alpha>;
59-
using T_beta_ref = ref_type_if_t<!is_constant<T_beta>::value, T_beta>;
57+
using T_x_ref = ref_type_if_not_constant_t<T_x>;
58+
using T_alpha_ref = ref_type_if_not_constant_t<T_alpha>;
59+
using T_beta_ref = ref_type_if_not_constant_t<T_beta>;
6060
using T_beta_partials = partials_type_t<scalar_type_t<T_beta>>;
6161
constexpr int T_x_rows = T_x::RowsAtCompileTime;
6262

stan/math/prim/prob/cauchy_lpdf.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ return_type_t<T_y, T_loc, T_scale> cauchy_lpdf(const T_y& y, const T_loc& mu,
4444
const T_scale& sigma) {
4545
using T_partials_return = partials_return_t<T_y, T_loc, T_scale>;
4646
using std::log;
47-
using T_y_ref = ref_type_if_t<!is_constant<T_y>::value, T_y>;
48-
using T_mu_ref = ref_type_if_t<!is_constant<T_loc>::value, T_loc>;
49-
using T_sigma_ref = ref_type_if_t<!is_constant<T_scale>::value, T_scale>;
47+
using T_y_ref = ref_type_if_not_constant_t<T_y>;
48+
using T_mu_ref = ref_type_if_not_constant_t<T_loc>;
49+
using T_sigma_ref = ref_type_if_not_constant_t<T_scale>;
5050
static const char* function = "cauchy_lpdf";
5151
check_consistent_sizes(function, "Random variable", y, "Location parameter",
5252
mu, "Scale parameter", sigma);

stan/math/prim/prob/double_exponential_cdf.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ return_type_t<T_y, T_loc, T_scale> double_exponential_cdf(
4545
|| is_vector<T_scale>::value,
4646
T_partials_array, T_partials_return>;
4747
using std::exp;
48-
using T_y_ref = ref_type_if_t<!is_constant<T_y>::value, T_y>;
49-
using T_mu_ref = ref_type_if_t<!is_constant<T_loc>::value, T_loc>;
50-
using T_sigma_ref = ref_type_if_t<!is_constant<T_scale>::value, T_scale>;
48+
using T_y_ref = ref_type_if_not_constant_t<T_y>;
49+
using T_mu_ref = ref_type_if_not_constant_t<T_loc>;
50+
using T_sigma_ref = ref_type_if_not_constant_t<T_scale>;
5151
static const char* function = "double_exponential_cdf";
5252
T_y_ref y_ref = y;
5353
T_mu_ref mu_ref = mu;

0 commit comments

Comments
 (0)