Skip to content

Commit 79a96b9

Browse files
author
Andrew Johnson
committed
Revert glmsigmas, use value_of_rev
1 parent e0f8424 commit 79a96b9

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

stan/math/opencl/prim/normal_id_glm_lpdf.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ return_type_t<T_alpha, T_beta, T_scale> normal_id_glm_lpdf(
9999
const auto &alpha_val_vec = as_column_vector_or_scalar(alpha_val);
100100
const auto &sigma_val_vec = to_ref(as_column_vector_or_scalar(sigma_val));
101101

102-
T_scale_val inv_sigma = 1.0 / as_array_or_scalar(sigma_val_vec);
102+
T_scale_val inv_sigma = 1 / as_array_or_scalar(sigma_val_vec);
103103
Matrix<T_partials_return, Dynamic, 1> y_minus_mu_over_sigma_mat(N);
104104
auto y_scaled = y_minus_mu_over_sigma_mat.array();
105105

stan/math/prim/prob/lognormal_lpdf.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <stan/math/prim/fun/size.hpp>
1111
#include <stan/math/prim/fun/size_zero.hpp>
1212
#include <stan/math/prim/fun/value_of.hpp>
13+
#include <stan/math/prim/fun/value_of_rec.hpp>
1314
#include <cmath>
1415

1516
namespace stan {
@@ -64,7 +65,7 @@ return_type_t<T_y, T_loc, T_scale> lognormal_lpdf(const T_y& y, const T_loc& mu,
6465
inv_sigma_sq(size(sigma));
6566
if (include_summand<propto, T_y, T_loc, T_scale>::value) {
6667
for (size_t n = 0; n < stan::math::size(sigma); n++) {
67-
inv_sigma[n] = 1.0 / value_of(sigma_vec[n]);
68+
inv_sigma[n] = 1 / value_of_rec(sigma_vec[n]);
6869
}
6970
}
7071
if (include_summand<propto, T_y, T_loc, T_scale>::value) {
@@ -86,7 +87,7 @@ return_type_t<T_y, T_loc, T_scale> lognormal_lpdf(const T_y& y, const T_loc& mu,
8687
stan::math::size(y));
8788
if (!is_constant_all<T_y>::value) {
8889
for (size_t n = 0; n < stan::math::size(y); n++) {
89-
inv_y[n] = 1.0 / value_of(y_vec[n]);
90+
inv_y[n] = 1 / value_of_rec(y_vec[n]);
9091
}
9192
}
9293

stan/math/prim/prob/normal_id_glm_lpdf.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ return_type_t<T_y, T_x_scalar, T_alpha, T_beta, T_scale> normal_id_glm_lpdf(
100100
const auto &sigma_val_vec = to_ref(as_column_vector_or_scalar(sigma_val));
101101
const auto &y_val_vec = as_column_vector_or_scalar(y_val);
102102

103-
T_scale_val inv_sigma = 1.0 / as_array_or_scalar(sigma_val_vec);
103+
T_scale_val inv_sigma = 1 / as_array_or_scalar(sigma_val_vec);
104104

105105
// the most efficient way to calculate this depends on template parameters
106106
double y_scaled_sq_sum;

0 commit comments

Comments
 (0)