Skip to content

Commit a66f235

Browse files
committed
remove unused typedefs and mark forward_as deprecated
1 parent 0200562 commit a66f235

32 files changed

Lines changed: 62 additions & 124 deletions

stan/math/prim/meta/compiler_attributes.hpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,17 @@
2020
#endif
2121
#endif
2222
#endif
23+
#ifndef STAN_DEPRECATED
24+
#if __has_attribute(deprecated)
25+
#define STAN_DEPRECATED __attribute__((deprecated))
26+
#else
27+
#define STAN_DEPRECATED
2328
#endif
29+
#endif
30+
31+
#endif
32+
33+
2434
#ifndef STAN_COLD_PATH
2535
#define STAN_COLD_PATH
2636
#endif

stan/math/prim/meta/forward_as.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ template <typename T_desired, typename T_actual,
3434
= std::enable_if_t<std::is_same<std::decay_t<T_actual>,
3535
std::decay_t<T_desired>>::value
3636
&& !is_eigen<T_desired>::value>>
37-
inline T_actual&& forward_as(T_actual&& a) { // NOLINT
37+
STAN_DEPRECATED inline T_actual&& forward_as(T_actual&& a) { // NOLINT
3838
return std::forward<T_actual>(a);
3939
}
4040

@@ -61,7 +61,7 @@ template <
6161
!std::is_same<std::decay<T_actual>, std::decay<T_desired>>::value
6262
&& !(std::is_floating_point_v<std::decay_t<
6363
T_desired>> && std::is_integral_v<std::decay_t<T_actual>>)>>
64-
inline T_desired forward_as(const T_actual& a) {
64+
STAN_DEPRECATED inline T_desired forward_as(const T_actual& a) {
6565
throw std::runtime_error(
6666
"Wrong type assumed! Please file a bug report. prim/meta/forward_as.hpp "
6767
"line "
@@ -87,7 +87,7 @@ template <typename T_desired, typename T_actual,
8787
typename = std::enable_if_t<
8888
std::is_floating_point_v<std::decay_t<
8989
T_desired>> && std::is_integral_v<std::decay_t<T_actual>>>>
90-
inline T_desired forward_as(const T_actual& a) {
90+
STAN_DEPRECATED inline T_desired forward_as(const T_actual& a) {
9191
return static_cast<T_desired>(a);
9292
}
9393

@@ -117,7 +117,7 @@ template <
117117
&& internal::eigen_static_size_match(
118118
T_desired::ColsAtCompileTime,
119119
std::decay_t<T_actual>::ColsAtCompileTime)>* = nullptr>
120-
inline T_actual&& forward_as(T_actual&& a) { // NOLINT
120+
STAN_DEPRECATED inline T_actual&& forward_as(T_actual&& a) { // NOLINT
121121
return std::forward<T_actual>(a);
122122
}
123123

@@ -148,7 +148,7 @@ template <
148148
|| !internal::eigen_static_size_match(
149149
T_desired::ColsAtCompileTime,
150150
std::decay_t<T_actual>::ColsAtCompileTime)>* = nullptr>
151-
inline T_desired forward_as(const T_actual& a) {
151+
STAN_DEPRECATED inline T_desired forward_as(const T_actual& a) {
152152
throw std::runtime_error(
153153
"Wrong type assumed! Please file a bug report. prim/meta/forward_as.hpp "
154154
"line "

stan/math/prim/prob/bernoulli_logit_glm_lpmf.hpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,10 @@ return_type_t<T_x, T_alpha, T_beta> bernoulli_logit_glm_lpmf(
5757
using std::exp;
5858
using std::isfinite;
5959
constexpr int T_x_rows = T_x::RowsAtCompileTime;
60-
using T_xbeta_partials = partials_return_t<T_x, T_beta>;
6160
using T_partials_return = partials_return_t<T_y, T_x, T_alpha, T_beta>;
6261
using T_ytheta_tmp =
6362
typename std::conditional_t<T_x_rows == 1, T_partials_return,
6463
Array<T_partials_return, Dynamic, 1>>;
65-
using T_xbeta_tmp =
66-
typename std::conditional_t<T_x_rows == 1, T_xbeta_partials,
67-
Array<T_xbeta_partials, Dynamic, 1>>;
6864
using T_x_ref = ref_type_if_not_constant_t<T_x>;
6965
using T_alpha_ref = ref_type_if_not_constant_t<T_alpha>;
7066
using T_beta_ref = ref_type_if_not_constant_t<T_beta>;

stan/math/prim/prob/binomial_logit_glm_lpmf.hpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,7 @@ return_type_t<T_x, T_alpha, T_beta> binomial_logit_glm_lpmf(
5757
const T_n& n, const T_N& N, const T_x& x, const T_alpha& alpha,
5858
const T_beta& beta) {
5959
constexpr int T_x_rows = T_x::RowsAtCompileTime;
60-
using T_xbeta_partials = partials_return_t<T_x, T_beta>;
6160
using T_partials_return = partials_return_t<T_x, T_alpha, T_beta>;
62-
using T_xbeta_tmp =
63-
typename std::conditional_t<T_x_rows == 1, T_xbeta_partials,
64-
Eigen::Array<T_xbeta_partials, -1, 1>>;
6561
using T_n_ref = ref_type_if_t<is_autodiff_v<T_n>, T_n>;
6662
using T_N_ref = ref_type_if_t<is_autodiff_v<T_N>, T_N>;
6763
using T_x_ref = ref_type_if_t<is_autodiff_v<T_x>, T_x>;

stan/math/prim/prob/chi_square_lpdf.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ template <bool propto, typename T_y, typename T_dof,
4545
T_y, T_dof>* = nullptr>
4646
return_type_t<T_y, T_dof> chi_square_lpdf(const T_y& y, const T_dof& nu) {
4747
using T_partials_return = partials_return_t<T_y, T_dof>;
48-
using T_partials_array = Eigen::Array<T_partials_return, Eigen::Dynamic, 1>;
4948
using std::log;
5049
static constexpr const char* function = "chi_square_lpdf";
5150
using T_y_ref = ref_type_t<T_y>;

stan/math/prim/prob/double_exponential_cdf.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ return_type_t<T_y, T_loc, T_scale> double_exponential_cdf(
7575

7676
T_rep_deriv rep_deriv;
7777
if constexpr (is_vector<T_y>::value || is_vector<T_loc>::value) {
78-
using array_bool = Eigen::Array<bool, Eigen::Dynamic, 1>;
7978
cdf = (y_val < mu_val)
8079
.select(exp_scaled_diff * 0.5, 1.0 - 0.5 / exp_scaled_diff)
8180
.prod();

stan/math/prim/prob/exp_mod_normal_cdf.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ return_type_t<T_y, T_loc, T_scale, T_inv_scale> exp_mod_normal_cdf(
3030
const T_y& y, const T_loc& mu, const T_scale& sigma,
3131
const T_inv_scale& lambda) {
3232
using T_partials_return = partials_return_t<T_y, T_loc, T_scale, T_inv_scale>;
33-
using T_partials_array = Eigen::Array<T_partials_return, Eigen::Dynamic, 1>;
3433
using T_y_ref = ref_type_if_not_constant_t<T_y>;
3534
using T_mu_ref = ref_type_if_not_constant_t<T_loc>;
3635
using T_sigma_ref = ref_type_if_not_constant_t<T_scale>;
@@ -62,7 +61,6 @@ return_type_t<T_y, T_loc, T_scale, T_inv_scale> exp_mod_normal_cdf(
6261
auto ops_partials
6362
= make_partials_propagator(y_ref, mu_ref, sigma_ref, lambda_ref);
6463

65-
using T_y_val_scalar = scalar_type_t<decltype(y_val)>;
6664
if constexpr (is_vector<T_y>::value) {
6765
if ((y_val == NEGATIVE_INFTY).any()) {
6866
return ops_partials.build(0.0);

stan/math/prim/prob/exponential_cdf.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ template <typename T_y, typename T_inv_scale,
3535
return_type_t<T_y, T_inv_scale> exponential_cdf(const T_y& y,
3636
const T_inv_scale& beta) {
3737
using T_partials_return = partials_return_t<T_y, T_inv_scale>;
38-
using T_partials_array = Eigen::Array<T_partials_return, Eigen::Dynamic, 1>;
3938
using T_y_ref = ref_type_if_not_constant_t<T_y>;
4039
using T_beta_ref = ref_type_if_not_constant_t<T_inv_scale>;
4140
static constexpr const char* function = "exponential_cdf";

stan/math/prim/prob/exponential_lccdf.hpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ return_type_t<T_y, T_inv_scale> exponential_lccdf(const T_y& y,
4242
T_partials_return ccdf_log = -sum(beta_val * y_val);
4343

4444
if constexpr (is_autodiff_v<T_y>) {
45-
using beta_val_scalar = scalar_type_t<decltype(beta_val)>;
46-
using beta_val_array = Eigen::Array<beta_val_scalar, Eigen::Dynamic, 1>;
4745
if constexpr (is_vector<T_y>::value && !is_vector<T_inv_scale>::value) {
4846
partials<0>(ops_partials)
4947
= T_partials_array::Constant(math::size(y), -beta_val);
@@ -54,8 +52,6 @@ return_type_t<T_y, T_inv_scale> exponential_lccdf(const T_y& y,
5452
}
5553
}
5654
if constexpr (is_autodiff_v<T_inv_scale>) {
57-
using y_val_scalar = scalar_type_t<decltype(y_val)>;
58-
using y_val_array = Eigen::Array<y_val_scalar, Eigen::Dynamic, 1>;
5955
if constexpr (is_vector<T_inv_scale>::value && !is_vector<T_y>::value) {
6056
partials<1>(ops_partials)
6157
= T_partials_array::Constant(math::size(beta), -y_val);

stan/math/prim/prob/exponential_lpdf.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,6 @@ return_type_t<T_y, T_inv_scale> exponential_lpdf(const T_y& y,
8282
}
8383

8484
if constexpr (is_autodiff_v<T_y>) {
85-
using beta_val_scalar = scalar_type_t<decltype(beta_val)>;
86-
using beta_val_array = Eigen::Array<beta_val_scalar, Eigen::Dynamic, 1>;
8785
if constexpr (is_vector<T_y>::value && !is_vector<T_inv_scale>::value) {
8886
partials<0>(ops_partials)
8987
= T_partials_array::Constant(math::size(y), -beta_val);

0 commit comments

Comments
 (0)