Skip to content

Commit 84c06bc

Browse files
author
Andrew Johnson
committed
Update glm invsigmas
1 parent b6717d5 commit 84c06bc

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

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 / as_array_or_scalar(sigma_val_vec);
102+
T_scale_val inv_sigma = 1.0 / 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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ return_type_t<T_y, T_loc, T_scale> lognormal_lpdf(const T_y& y, const T_loc& mu,
6464
inv_sigma_sq(size(sigma));
6565
if (include_summand<propto, T_y, T_loc, T_scale>::value) {
6666
for (size_t n = 0; n < stan::math::size(sigma); n++) {
67-
inv_sigma[n] = inv(value_of(sigma_vec[n]));
67+
inv_sigma[n] = 1.0 / value_of(sigma_vec[n]);
6868
}
6969
}
7070
if (include_summand<propto, T_y, T_loc, T_scale>::value) {
@@ -86,7 +86,7 @@ return_type_t<T_y, T_loc, T_scale> lognormal_lpdf(const T_y& y, const T_loc& mu,
8686
stan::math::size(y));
8787
if (!is_constant_all<T_y>::value) {
8888
for (size_t n = 0; n < stan::math::size(y); n++) {
89-
inv_y[n] = inv(value_of(y_vec[n]));
89+
inv_y[n] = 1.0 / value_of(y_vec[n]);
9090
}
9191
}
9292

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 / as_array_or_scalar(sigma_val_vec);
103+
T_scale_val inv_sigma = 1.0 / 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)