math
math copied to clipboard
Distributions - Replace separate `propto` template with default argument?
Description
We currently use a separate declaration to handle calls to the distribution functions without the propto parameter:
template <bool propto, typename T_y, typename T_loc, typename T_scale>
inline return_type_t<T_y, T_loc, T_scale> normal_lpdf(const T_y& y,
const T_loc& mu,
const T_scale& sigma) {
...
}
template <typename T_y, typename T_loc, typename T_scale>
inline return_type_t<T_y, T_loc, T_scale> normal_lpdf(const T_y& y,
const T_loc& mu,
const T_scale& sigma) {
return normal_lpdf<false>(y, mu, sigma);
}
We could remove this additional definition by instead having a default value for the propto parameter:
template <bool propto = false, typename T_y, typename T_loc, typename T_scale>
inline return_type_t<T_y, T_loc, T_scale> normal_lpdf(const T_y& y,
const T_loc& mu,
const T_scale& sigma) {
...
}
Current Version:
v4.6.1