Skip to content

Commit

Permalink
Merge pull request #2958 from stan-dev/ref_type_t-nonconst
Browse files Browse the repository at this point in the history
Add `ref_type_if_not_constant_t<>` type trait
  • Loading branch information
andrjohns authored Oct 20, 2023
2 parents 7a039be + 0f39490 commit 5384ea7
Show file tree
Hide file tree
Showing 70 changed files with 215 additions and 223 deletions.
5 changes: 5 additions & 0 deletions stan/math/prim/meta/ref_type.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define STAN_MATH_PRIM_META_REF_TYPE_HPP

#include <stan/math/prim/fun/Eigen.hpp>
#include <stan/math/prim/meta/is_constant.hpp>
#include <stan/math/prim/meta/is_eigen.hpp>
#include <stan/math/prim/meta/is_arena_matrix.hpp>
#include <stan/math/prim/meta/is_vector.hpp>
Expand Down Expand Up @@ -56,6 +57,10 @@ using ref_type_t = typename ref_type_if<true, T>::type;
template <bool Condition, typename T>
using ref_type_if_t = typename ref_type_if<Condition, T>::type;

template <typename T>
using ref_type_if_not_constant_t =
typename ref_type_if<!is_constant<T>::value, T>::type;

} // namespace stan

#endif
6 changes: 3 additions & 3 deletions stan/math/prim/prob/bernoulli_logit_glm_lpmf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ return_type_t<T_x, T_alpha, T_beta> bernoulli_logit_glm_lpmf(
using T_xbeta_tmp =
typename std::conditional_t<T_x_rows == 1, T_xbeta_partials,
Array<T_xbeta_partials, Dynamic, 1>>;
using T_x_ref = ref_type_if_t<!is_constant<T_x>::value, T_x>;
using T_alpha_ref = ref_type_if_t<!is_constant<T_alpha>::value, T_alpha>;
using T_beta_ref = ref_type_if_t<!is_constant<T_beta>::value, T_beta>;
using T_x_ref = ref_type_if_not_constant_t<T_x>;
using T_alpha_ref = ref_type_if_not_constant_t<T_alpha>;
using T_beta_ref = ref_type_if_not_constant_t<T_beta>;

const size_t N_instances = T_x_rows == 1 ? stan::math::size(y) : x.rows();
const size_t N_attributes = x.cols();
Expand Down
4 changes: 2 additions & 2 deletions stan/math/prim/prob/bernoulli_logit_lpmf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ return_type_t<T_prob> bernoulli_logit_lpmf(const T_n& n, const T_prob& theta) {
using T_partials_return = partials_return_t<T_n, T_prob>;
using T_partials_array = Eigen::Array<T_partials_return, Eigen::Dynamic, 1>;
using std::exp;
using T_n_ref = ref_type_if_t<!is_constant<T_n>::value, T_n>;
using T_theta_ref = ref_type_if_t<!is_constant<T_prob>::value, T_prob>;
using T_n_ref = ref_type_if_not_constant_t<T_n>;
using T_theta_ref = ref_type_if_not_constant_t<T_prob>;
static const char* function = "bernoulli_logit_lpmf";
check_consistent_sizes(function, "Random variable", n,
"Probability parameter", theta);
Expand Down
8 changes: 3 additions & 5 deletions stan/math/prim/prob/beta_lpdf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,9 @@ template <bool propto, typename T_y, typename T_scale_succ,
return_type_t<T_y, T_scale_succ, T_scale_fail> beta_lpdf(
const T_y& y, const T_scale_succ& alpha, const T_scale_fail& beta) {
using T_partials_return = partials_return_t<T_y, T_scale_succ, T_scale_fail>;
using T_y_ref = ref_type_if_t<!is_constant<T_y>::value, T_y>;
using T_alpha_ref
= ref_type_if_t<!is_constant<T_scale_succ>::value, T_scale_succ>;
using T_beta_ref
= ref_type_if_t<!is_constant<T_scale_fail>::value, T_scale_fail>;
using T_y_ref = ref_type_if_not_constant_t<T_y>;
using T_alpha_ref = ref_type_if_not_constant_t<T_scale_succ>;
using T_beta_ref = ref_type_if_not_constant_t<T_scale_fail>;
static const char* function = "beta_lpdf";
check_consistent_sizes(function, "Random variable", y,
"First shape parameter", alpha,
Expand Down
6 changes: 3 additions & 3 deletions stan/math/prim/prob/beta_proportion_lpdf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ return_type_t<T_y, T_loc, T_prec> beta_proportion_lpdf(const T_y& y,
const T_prec& kappa) {
using T_partials_return = partials_return_t<T_y, T_loc, T_prec>;
using std::log;
using T_y_ref = ref_type_if_t<!is_constant<T_y>::value, T_y>;
using T_mu_ref = ref_type_if_t<!is_constant<T_loc>::value, T_loc>;
using T_kappa_ref = ref_type_if_t<!is_constant<T_prec>::value, T_prec>;
using T_y_ref = ref_type_if_not_constant_t<T_y>;
using T_mu_ref = ref_type_if_not_constant_t<T_loc>;
using T_kappa_ref = ref_type_if_not_constant_t<T_prec>;
static const char* function = "beta_proportion_lpdf";
check_consistent_sizes(function, "Random variable", y, "Location parameter",
mu, "Precision parameter", kappa);
Expand Down
6 changes: 3 additions & 3 deletions stan/math/prim/prob/binomial_logit_lpmf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ template <bool propto, typename T_n, typename T_N, typename T_prob,
return_type_t<T_prob> binomial_logit_lpmf(const T_n& n, const T_N& N,
const T_prob& alpha) {
using T_partials_return = partials_return_t<T_n, T_N, T_prob>;
using T_n_ref = ref_type_if_t<!is_constant<T_n>::value, T_n>;
using T_N_ref = ref_type_if_t<!is_constant<T_N>::value, T_N>;
using T_alpha_ref = ref_type_if_t<!is_constant<T_prob>::value, T_prob>;
using T_n_ref = ref_type_if_not_constant_t<T_n>;
using T_N_ref = ref_type_if_not_constant_t<T_N>;
using T_alpha_ref = ref_type_if_not_constant_t<T_prob>;
static const char* function = "binomial_logit_lpmf";
check_consistent_sizes(function, "Successes variable", n,
"Population size parameter", N,
Expand Down
6 changes: 3 additions & 3 deletions stan/math/prim/prob/categorical_logit_glm_lpmf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ return_type_t<T_x, T_alpha, T_beta> categorical_logit_glm_lpmf(
using std::isfinite;
using std::log;
using T_y_ref = ref_type_t<T_y>;
using T_x_ref = ref_type_if_t<!is_constant<T_x>::value, T_x>;
using T_alpha_ref = ref_type_if_t<!is_constant<T_alpha>::value, T_alpha>;
using T_beta_ref = ref_type_if_t<!is_constant<T_beta>::value, T_beta>;
using T_x_ref = ref_type_if_not_constant_t<T_x>;
using T_alpha_ref = ref_type_if_not_constant_t<T_alpha>;
using T_beta_ref = ref_type_if_not_constant_t<T_beta>;
using T_beta_partials = partials_type_t<scalar_type_t<T_beta>>;
constexpr int T_x_rows = T_x::RowsAtCompileTime;

Expand Down
6 changes: 3 additions & 3 deletions stan/math/prim/prob/cauchy_lpdf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ return_type_t<T_y, T_loc, T_scale> cauchy_lpdf(const T_y& y, const T_loc& mu,
const T_scale& sigma) {
using T_partials_return = partials_return_t<T_y, T_loc, T_scale>;
using std::log;
using T_y_ref = ref_type_if_t<!is_constant<T_y>::value, T_y>;
using T_mu_ref = ref_type_if_t<!is_constant<T_loc>::value, T_loc>;
using T_sigma_ref = ref_type_if_t<!is_constant<T_scale>::value, T_scale>;
using T_y_ref = ref_type_if_not_constant_t<T_y>;
using T_mu_ref = ref_type_if_not_constant_t<T_loc>;
using T_sigma_ref = ref_type_if_not_constant_t<T_scale>;
static const char* function = "cauchy_lpdf";
check_consistent_sizes(function, "Random variable", y, "Location parameter",
mu, "Scale parameter", sigma);
Expand Down
6 changes: 3 additions & 3 deletions stan/math/prim/prob/double_exponential_cdf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ return_type_t<T_y, T_loc, T_scale> double_exponential_cdf(
|| is_vector<T_scale>::value,
T_partials_array, T_partials_return>;
using std::exp;
using T_y_ref = ref_type_if_t<!is_constant<T_y>::value, T_y>;
using T_mu_ref = ref_type_if_t<!is_constant<T_loc>::value, T_loc>;
using T_sigma_ref = ref_type_if_t<!is_constant<T_scale>::value, T_scale>;
using T_y_ref = ref_type_if_not_constant_t<T_y>;
using T_mu_ref = ref_type_if_not_constant_t<T_loc>;
using T_sigma_ref = ref_type_if_not_constant_t<T_scale>;
static const char* function = "double_exponential_cdf";
T_y_ref y_ref = y;
T_mu_ref mu_ref = mu;
Expand Down
6 changes: 3 additions & 3 deletions stan/math/prim/prob/double_exponential_lpdf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ template <bool propto, typename T_y, typename T_loc, typename T_scale,
return_type_t<T_y, T_loc, T_scale> double_exponential_lpdf(
const T_y& y, const T_loc& mu, const T_scale& sigma) {
using T_partials_return = partials_return_t<T_y, T_loc, T_scale>;
using T_y_ref = ref_type_if_t<!is_constant<T_y>::value, T_y>;
using T_mu_ref = ref_type_if_t<!is_constant<T_loc>::value, T_loc>;
using T_sigma_ref = ref_type_if_t<!is_constant<T_scale>::value, T_scale>;
using T_y_ref = ref_type_if_not_constant_t<T_y>;
using T_mu_ref = ref_type_if_not_constant_t<T_loc>;
using T_sigma_ref = ref_type_if_not_constant_t<T_scale>;
static const char* function = "double_exponential_lpdf";
check_consistent_sizes(function, "Random variable", y, "Location parameter",
mu, "Shape parameter", sigma);
Expand Down
9 changes: 4 additions & 5 deletions stan/math/prim/prob/exp_mod_normal_cdf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,10 @@ return_type_t<T_y, T_loc, T_scale, T_inv_scale> exp_mod_normal_cdf(
const T_inv_scale& lambda) {
using T_partials_return = partials_return_t<T_y, T_loc, T_scale, T_inv_scale>;
using T_partials_array = Eigen::Array<T_partials_return, Eigen::Dynamic, 1>;
using T_y_ref = ref_type_if_t<!is_constant<T_y>::value, T_y>;
using T_mu_ref = ref_type_if_t<!is_constant<T_loc>::value, T_loc>;
using T_sigma_ref = ref_type_if_t<!is_constant<T_scale>::value, T_scale>;
using T_lambda_ref
= ref_type_if_t<!is_constant<T_inv_scale>::value, T_inv_scale>;
using T_y_ref = ref_type_if_not_constant_t<T_y>;
using T_mu_ref = ref_type_if_not_constant_t<T_loc>;
using T_sigma_ref = ref_type_if_not_constant_t<T_scale>;
using T_lambda_ref = ref_type_if_not_constant_t<T_inv_scale>;
static const char* function = "exp_mod_normal_cdf";
check_consistent_sizes(function, "Random variable", y, "Location parameter",
mu, "Scale parameter", sigma, "Inv_scale paramter",
Expand Down
9 changes: 4 additions & 5 deletions stan/math/prim/prob/exp_mod_normal_lccdf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,10 @@ return_type_t<T_y, T_loc, T_scale, T_inv_scale> exp_mod_normal_lccdf(
const T_y& y, const T_loc& mu, const T_scale& sigma,
const T_inv_scale& lambda) {
using T_partials_return = partials_return_t<T_y, T_loc, T_scale, T_inv_scale>;
using T_y_ref = ref_type_if_t<!is_constant<T_y>::value, T_y>;
using T_mu_ref = ref_type_if_t<!is_constant<T_loc>::value, T_loc>;
using T_sigma_ref = ref_type_if_t<!is_constant<T_scale>::value, T_scale>;
using T_lambda_ref
= ref_type_if_t<!is_constant<T_inv_scale>::value, T_inv_scale>;
using T_y_ref = ref_type_if_not_constant_t<T_y>;
using T_mu_ref = ref_type_if_not_constant_t<T_loc>;
using T_sigma_ref = ref_type_if_not_constant_t<T_scale>;
using T_lambda_ref = ref_type_if_not_constant_t<T_inv_scale>;
static const char* function = "exp_mod_normal_lccdf";
check_consistent_sizes(function, "Random variable", y, "Location parameter",
mu, "Scale parameter", sigma, "Inv_scale paramter",
Expand Down
9 changes: 4 additions & 5 deletions stan/math/prim/prob/exp_mod_normal_lcdf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,10 @@ return_type_t<T_y, T_loc, T_scale, T_inv_scale> exp_mod_normal_lcdf(
const T_y& y, const T_loc& mu, const T_scale& sigma,
const T_inv_scale& lambda) {
using T_partials_return = partials_return_t<T_y, T_loc, T_scale, T_inv_scale>;
using T_y_ref = ref_type_if_t<!is_constant<T_y>::value, T_y>;
using T_mu_ref = ref_type_if_t<!is_constant<T_loc>::value, T_loc>;
using T_sigma_ref = ref_type_if_t<!is_constant<T_scale>::value, T_scale>;
using T_lambda_ref
= ref_type_if_t<!is_constant<T_inv_scale>::value, T_inv_scale>;
using T_y_ref = ref_type_if_not_constant_t<T_y>;
using T_mu_ref = ref_type_if_not_constant_t<T_loc>;
using T_sigma_ref = ref_type_if_not_constant_t<T_scale>;
using T_lambda_ref = ref_type_if_not_constant_t<T_inv_scale>;
static const char* function = "exp_mod_normal_lcdf";
check_consistent_sizes(function, "Random variable", y, "Location parameter",
mu, "Scale parameter", sigma, "Inv_scale paramter",
Expand Down
9 changes: 4 additions & 5 deletions stan/math/prim/prob/exp_mod_normal_lpdf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,10 @@ return_type_t<T_y, T_loc, T_scale, T_inv_scale> exp_mod_normal_lpdf(
const T_y& y, const T_loc& mu, const T_scale& sigma,
const T_inv_scale& lambda) {
using T_partials_return = partials_return_t<T_y, T_loc, T_scale, T_inv_scale>;
using T_y_ref = ref_type_if_t<!is_constant<T_y>::value, T_y>;
using T_mu_ref = ref_type_if_t<!is_constant<T_loc>::value, T_loc>;
using T_sigma_ref = ref_type_if_t<!is_constant<T_scale>::value, T_scale>;
using T_lambda_ref
= ref_type_if_t<!is_constant<T_inv_scale>::value, T_inv_scale>;
using T_y_ref = ref_type_if_not_constant_t<T_y>;
using T_mu_ref = ref_type_if_not_constant_t<T_loc>;
using T_sigma_ref = ref_type_if_not_constant_t<T_scale>;
using T_lambda_ref = ref_type_if_not_constant_t<T_inv_scale>;
static const char* function = "exp_mod_normal_lpdf";
check_consistent_sizes(function, "Random variable", y, "Location parameter",
mu, "Scale parameter", sigma, "Inv_scale paramter",
Expand Down
5 changes: 2 additions & 3 deletions stan/math/prim/prob/exponential_cdf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,8 @@ return_type_t<T_y, T_inv_scale> exponential_cdf(const T_y& y,
const T_inv_scale& beta) {
using T_partials_return = partials_return_t<T_y, T_inv_scale>;
using T_partials_array = Eigen::Array<T_partials_return, Eigen::Dynamic, 1>;
using T_y_ref = ref_type_if_t<!is_constant<T_y>::value, T_y>;
using T_beta_ref
= ref_type_if_t<!is_constant<T_inv_scale>::value, T_inv_scale>;
using T_y_ref = ref_type_if_not_constant_t<T_y>;
using T_beta_ref = ref_type_if_not_constant_t<T_inv_scale>;
static const char* function = "exponential_cdf";
T_y_ref y_ref = y;
T_beta_ref beta_ref = beta;
Expand Down
5 changes: 2 additions & 3 deletions stan/math/prim/prob/exponential_lccdf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ return_type_t<T_y, T_inv_scale> exponential_lccdf(const T_y& y,
const T_inv_scale& beta) {
using T_partials_return = partials_return_t<T_y, T_inv_scale>;
using T_partials_array = Eigen::Array<T_partials_return, Eigen::Dynamic, 1>;
using T_y_ref = ref_type_if_t<!is_constant<T_y>::value, T_y>;
using T_beta_ref
= ref_type_if_t<!is_constant<T_inv_scale>::value, T_inv_scale>;
using T_y_ref = ref_type_if_not_constant_t<T_y>;
using T_beta_ref = ref_type_if_not_constant_t<T_inv_scale>;
static const char* function = "exponential_lccdf";
T_y_ref y_ref = y;
T_beta_ref beta_ref = beta;
Expand Down
5 changes: 2 additions & 3 deletions stan/math/prim/prob/exponential_lcdf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@ template <typename T_y, typename T_inv_scale,
return_type_t<T_y, T_inv_scale> exponential_lcdf(const T_y& y,
const T_inv_scale& beta) {
using T_partials_return = partials_return_t<T_y, T_inv_scale>;
using T_y_ref = ref_type_if_t<!is_constant<T_y>::value, T_y>;
using T_beta_ref
= ref_type_if_t<!is_constant<T_inv_scale>::value, T_inv_scale>;
using T_y_ref = ref_type_if_not_constant_t<T_y>;
using T_beta_ref = ref_type_if_not_constant_t<T_inv_scale>;
static const char* function = "exponential_lcdf";
T_y_ref y_ref = y;
T_beta_ref beta_ref = beta;
Expand Down
5 changes: 2 additions & 3 deletions stan/math/prim/prob/exponential_lpdf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,8 @@ return_type_t<T_y, T_inv_scale> exponential_lpdf(const T_y& y,
const T_inv_scale& beta) {
using T_partials_return = partials_return_t<T_y, T_inv_scale>;
using T_partials_array = Eigen::Array<T_partials_return, Eigen::Dynamic, 1>;
using T_y_ref = ref_type_if_t<!is_constant<T_y>::value, T_y>;
using T_beta_ref
= ref_type_if_t<!is_constant<T_inv_scale>::value, T_inv_scale>;
using T_y_ref = ref_type_if_not_constant_t<T_y>;
using T_beta_ref = ref_type_if_not_constant_t<T_inv_scale>;
static const char* function = "exponential_lpdf";
check_consistent_sizes(function, "Random variable", y,
"Inverse scale parameter", beta);
Expand Down
7 changes: 3 additions & 4 deletions stan/math/prim/prob/gamma_lpdf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,9 @@ return_type_t<T_y, T_shape, T_inv_scale> gamma_lpdf(const T_y& y,
const T_shape& alpha,
const T_inv_scale& beta) {
using T_partials_return = partials_return_t<T_y, T_shape, T_inv_scale>;
using T_y_ref = ref_type_if_t<!is_constant<T_y>::value, T_y>;
using T_alpha_ref = ref_type_if_t<!is_constant<T_shape>::value, T_shape>;
using T_beta_ref
= ref_type_if_t<!is_constant<T_inv_scale>::value, T_inv_scale>;
using T_y_ref = ref_type_if_not_constant_t<T_y>;
using T_alpha_ref = ref_type_if_not_constant_t<T_shape>;
using T_beta_ref = ref_type_if_not_constant_t<T_inv_scale>;
static const char* function = "gamma_lpdf";
check_consistent_sizes(function, "Random variable", y, "Shape parameter",
alpha, "Inverse scale parameter", beta);
Expand Down
6 changes: 3 additions & 3 deletions stan/math/prim/prob/gumbel_cdf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ return_type_t<T_y, T_loc, T_scale> gumbel_cdf(const T_y& y, const T_loc& mu,
const T_scale& beta) {
using T_partials_return = partials_return_t<T_y, T_loc, T_scale>;
using T_partials_array = Eigen::Array<T_partials_return, Eigen::Dynamic, 1>;
using T_y_ref = ref_type_if_t<!is_constant<T_y>::value, T_y>;
using T_mu_ref = ref_type_if_t<!is_constant<T_loc>::value, T_loc>;
using T_beta_ref = ref_type_if_t<!is_constant<T_scale>::value, T_scale>;
using T_y_ref = ref_type_if_not_constant_t<T_y>;
using T_mu_ref = ref_type_if_not_constant_t<T_loc>;
using T_beta_ref = ref_type_if_not_constant_t<T_scale>;
static const char* function = "gumbel_cdf";
check_consistent_sizes(function, "Random variable", y, "Location parameter",
mu, "Scale parameter", beta);
Expand Down
6 changes: 3 additions & 3 deletions stan/math/prim/prob/gumbel_lccdf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ template <typename T_y, typename T_loc, typename T_scale,
return_type_t<T_y, T_loc, T_scale> gumbel_lccdf(const T_y& y, const T_loc& mu,
const T_scale& beta) {
using T_partials_return = partials_return_t<T_y, T_loc, T_scale>;
using T_y_ref = ref_type_if_t<!is_constant<T_y>::value, T_y>;
using T_mu_ref = ref_type_if_t<!is_constant<T_loc>::value, T_loc>;
using T_beta_ref = ref_type_if_t<!is_constant<T_scale>::value, T_scale>;
using T_y_ref = ref_type_if_not_constant_t<T_y>;
using T_mu_ref = ref_type_if_not_constant_t<T_loc>;
using T_beta_ref = ref_type_if_not_constant_t<T_scale>;
static const char* function = "gumbel_lccdf";
T_y_ref y_ref = y;
T_mu_ref mu_ref = mu;
Expand Down
6 changes: 3 additions & 3 deletions stan/math/prim/prob/gumbel_lcdf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ template <typename T_y, typename T_loc, typename T_scale,
return_type_t<T_y, T_loc, T_scale> gumbel_lcdf(const T_y& y, const T_loc& mu,
const T_scale& beta) {
using T_partials_return = partials_return_t<T_y, T_loc, T_scale>;
using T_y_ref = ref_type_if_t<!is_constant<T_y>::value, T_y>;
using T_mu_ref = ref_type_if_t<!is_constant<T_loc>::value, T_loc>;
using T_beta_ref = ref_type_if_t<!is_constant<T_scale>::value, T_scale>;
using T_y_ref = ref_type_if_not_constant_t<T_y>;
using T_mu_ref = ref_type_if_not_constant_t<T_loc>;
using T_beta_ref = ref_type_if_not_constant_t<T_scale>;
static const char* function = "gumbel_lcdf";
check_consistent_sizes(function, "Random variable", y, "Location parameter",
mu, "Scale parameter", beta);
Expand Down
6 changes: 3 additions & 3 deletions stan/math/prim/prob/gumbel_lpdf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ template <bool propto, typename T_y, typename T_loc, typename T_scale,
return_type_t<T_y, T_loc, T_scale> gumbel_lpdf(const T_y& y, const T_loc& mu,
const T_scale& beta) {
using T_partials_return = partials_return_t<T_y, T_loc, T_scale>;
using T_y_ref = ref_type_if_t<!is_constant<T_y>::value, T_y>;
using T_mu_ref = ref_type_if_t<!is_constant<T_loc>::value, T_loc>;
using T_beta_ref = ref_type_if_t<!is_constant<T_scale>::value, T_scale>;
using T_y_ref = ref_type_if_not_constant_t<T_y>;
using T_mu_ref = ref_type_if_not_constant_t<T_loc>;
using T_beta_ref = ref_type_if_not_constant_t<T_scale>;
static const char* function = "gumbel_lpdf";
check_consistent_sizes(function, "Random variable", y, "Location parameter",
mu, "Scale parameter", beta);
Expand Down
6 changes: 3 additions & 3 deletions stan/math/prim/prob/hmm_marginal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ inline auto hmm_marginal(const T_omega& log_omegas, const T_Gamma& Gamma,
using eig_matrix_partial
= Eigen::Matrix<T_partial_type, Eigen::Dynamic, Eigen::Dynamic>;
using eig_vector_partial = Eigen::Matrix<T_partial_type, Eigen::Dynamic, 1>;
using T_omega_ref = ref_type_if_t<!is_constant<T_omega>::value, T_omega>;
using T_Gamma_ref = ref_type_if_t<!is_constant<T_Gamma>::value, T_Gamma>;
using T_rho_ref = ref_type_if_t<!is_constant<T_rho>::value, T_rho>;
using T_omega_ref = ref_type_if_not_constant_t<T_omega>;
using T_Gamma_ref = ref_type_if_not_constant_t<T_Gamma>;
using T_rho_ref = ref_type_if_not_constant_t<T_rho>;
int n_states = log_omegas.rows();
int n_transitions = log_omegas.cols() - 1;

Expand Down
4 changes: 2 additions & 2 deletions stan/math/prim/prob/inv_chi_square_lpdf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ template <bool propto, typename T_y, typename T_dof,
T_y, T_dof>* = nullptr>
return_type_t<T_y, T_dof> inv_chi_square_lpdf(const T_y& y, const T_dof& nu) {
using T_partials_return = partials_return_t<T_y, T_dof>;
using T_y_ref = ref_type_if_t<!is_constant<T_y>::value, T_y>;
using T_nu_ref = ref_type_if_t<!is_constant<T_dof>::value, T_dof>;
using T_y_ref = ref_type_if_not_constant_t<T_y>;
using T_nu_ref = ref_type_if_not_constant_t<T_dof>;
static const char* function = "inv_chi_square_lpdf";
check_consistent_sizes(function, "Random variable", y,
"Degrees of freedom parameter", nu);
Expand Down
Loading

0 comments on commit 5384ea7

Please sign in to comment.