Skip to content

Commit b0b0979

Browse files
committed
[Jenkins] auto-formatting by clang-format version 10.0.0-4ubuntu1
1 parent a9cc1bc commit b0b0979

2 files changed

Lines changed: 34 additions & 38 deletions

File tree

stan/math/opencl/prim/binomial_logit_glm_lpmf.hpp

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,8 @@
2424
namespace stan {
2525
namespace math {
2626

27-
template <bool propto, typename T_n_cl, typename T_N_cl,
28-
typename T_x_cl, typename T_alpha_cl,
29-
typename T_beta_cl,
27+
template <bool propto, typename T_n_cl, typename T_N_cl, typename T_x_cl,
28+
typename T_alpha_cl, typename T_beta_cl,
3029
require_all_prim_or_rev_kernel_expression_t<
3130
T_n_cl, T_N_cl, T_x_cl, T_alpha_cl, T_beta_cl>* = nullptr>
3231
return_type_t<T_x_cl, T_alpha_cl, T_beta_cl> binomial_logit_glm_lpmf(
@@ -37,8 +36,8 @@ return_type_t<T_x_cl, T_alpha_cl, T_beta_cl> binomial_logit_glm_lpmf(
3736
constexpr bool is_y_vector = !is_stan_scalar<T_n_cl>::value;
3837
constexpr bool is_alpha_vector = !is_stan_scalar<T_alpha_cl>::value;
3938

40-
const size_t N_instances = max(max_size(n, N, alpha),
41-
static_cast<size_t>(x.rows()));
39+
const size_t N_instances
40+
= max(max_size(n, N, alpha), static_cast<size_t>(x.rows()));
4241
const size_t N_attributes = x.cols();
4342

4443
check_consistent_sizes(function, "Successes variable", n,
@@ -76,26 +75,26 @@ return_type_t<T_x_cl, T_alpha_cl, T_beta_cl> binomial_logit_glm_lpmf(
7675
= static_select<include_summand<propto, T_n_cl, T_N_cl>::value>(
7776
logp_expr1 + binomial_coefficient_log(N, n), logp_expr1);
7877

79-
constexpr bool need_theta_deriv =
80-
!is_constant_all<T_beta_cl, T_x_cl, T_alpha_cl>::value;
78+
constexpr bool need_theta_deriv
79+
= !is_constant_all<T_beta_cl, T_x_cl, T_alpha_cl>::value;
8180
auto theta_deriv_expr = n - elt_multiply(N, exp(log_inv_logit_theta));
8281

8382
constexpr bool need_theta_deriv_sum = need_theta_deriv && !is_alpha_vector;
8483
matrix_cl<double> logp_cl;
8584
matrix_cl<double> theta_deriv_cl;
8685
matrix_cl<double> theta_deriv_sum_cl;
8786

88-
results(check_n_bounded, check_N_nonnegative, logp_cl,
89-
theta_deriv_cl, theta_deriv_sum_cl) = expressions(
90-
n_bounded, N_nonnegative, logp_expr,
91-
calc_if<need_theta_deriv>(theta_deriv_expr),
92-
calc_if<need_theta_deriv_sum>(colwise_sum(theta_deriv_expr)));
87+
results(check_n_bounded, check_N_nonnegative, logp_cl, theta_deriv_cl,
88+
theta_deriv_sum_cl)
89+
= expressions(
90+
n_bounded, N_nonnegative, logp_expr,
91+
calc_if<need_theta_deriv>(theta_deriv_expr),
92+
calc_if<need_theta_deriv_sum>(colwise_sum(theta_deriv_expr)));
9393

9494
T_partials_return logp = sum(from_matrix_cl(logp_cl));
9595
using std::isfinite;
9696
if (!isfinite(logp)) {
97-
check_cl(function, "Intercept", alpha_val, "finite")
98-
= isfinite(alpha_val);
97+
check_cl(function, "Intercept", alpha_val, "finite") = isfinite(alpha_val);
9998
check_cl(function, "Weight vector", beta_val, "finite")
10099
= isfinite(beta_val);
101100
check_cl(function, "Matrix of independent variables", x_val, "finite")
@@ -104,8 +103,7 @@ return_type_t<T_x_cl, T_alpha_cl, T_beta_cl> binomial_logit_glm_lpmf(
104103

105104
auto ops_partials = make_partials_propagator(x, alpha, beta);
106105
if (!is_constant_all<T_x_cl>::value) {
107-
partials<0>(ops_partials)
108-
= transpose(beta_val * transpose(theta_deriv_cl));
106+
partials<0>(ops_partials) = transpose(beta_val * transpose(theta_deriv_cl));
109107
}
110108
if (!is_constant_all<T_alpha_cl>::value) {
111109
if (is_alpha_vector) {

test/unit/math/opencl/rev/binomial_logit_glm_lpmf_test.cpp

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
#include <vector>
77

88
TEST(ProbDistributionsBinomialLogitGLM, error_checking) {
9-
using stan::math::matrix_cl;
109
using stan::math::binomial_logit_glm_lpmf;
10+
using stan::math::matrix_cl;
1111

1212
int N = 3;
1313
int M = 2;
@@ -80,10 +80,10 @@ TEST(ProbDistributionsBinomialLogitGLM, error_checking) {
8080
binomial_logit_glm_lpmf(n_cl, trials_cl, x_cl, alpha_cl, beta_size_cl),
8181
std::invalid_argument);
8282

83-
EXPECT_THROW(
83+
EXPECT_THROW(
8484
binomial_logit_glm_lpmf(n_value_cl, trials_cl, x_cl, alpha_cl, beta_cl),
8585
std::domain_error);
86-
EXPECT_THROW(
86+
EXPECT_THROW(
8787
binomial_logit_glm_lpmf(n_cl, trials_value_cl, x_cl, alpha_cl, beta_cl),
8888
std::domain_error);
8989
EXPECT_THROW(
@@ -98,15 +98,15 @@ TEST(ProbDistributionsBinomialLogitGLM, error_checking) {
9898
}
9999

100100
auto binomial_logit_glm_lpmf_functor
101-
= [](const auto& n, const auto& trials, const auto& x,
102-
const auto& alpha, const auto& beta) {
101+
= [](const auto& n, const auto& trials, const auto& x, const auto& alpha,
102+
const auto& beta) {
103103
return stan::math::binomial_logit_glm_lpmf(n, trials, x, alpha, beta);
104104
};
105105
auto binomial_logit_glm_lpmf_functor_propto
106-
= [](const auto& n, const auto& trials, const auto& x,
107-
const auto& alpha, const auto& beta) {
108-
return stan::math::binomial_logit_glm_lpmf<true>(n, trials, x,
109-
alpha, beta);
106+
= [](const auto& n, const auto& trials, const auto& x, const auto& alpha,
107+
const auto& beta) {
108+
return stan::math::binomial_logit_glm_lpmf<true>(n, trials, x, alpha,
109+
beta);
110110
};
111111

112112
TEST(ProbDistributionsBinomialLogitGLM, opencl_matches_cpu_small_simple) {
@@ -121,8 +121,8 @@ TEST(ProbDistributionsBinomialLogitGLM, opencl_matches_cpu_small_simple) {
121121
beta << 0.3, 2;
122122
double alpha = 0.3;
123123

124-
stan::math::test::compare_cpu_opencl_prim_rev(
125-
binomial_logit_glm_lpmf_functor, n, trials, x, alpha, beta);
124+
stan::math::test::compare_cpu_opencl_prim_rev(binomial_logit_glm_lpmf_functor,
125+
n, trials, x, alpha, beta);
126126
stan::math::test::compare_cpu_opencl_prim_rev(
127127
binomial_logit_glm_lpmf_functor_propto, n, trials, x, alpha, beta);
128128
}
@@ -156,8 +156,8 @@ TEST(ProbDistributionsBinomialLogitGLM, opencl_matches_cpu_zero_instances) {
156156
beta << 0.3, 2;
157157
double alpha = 0.3;
158158

159-
stan::math::test::compare_cpu_opencl_prim_rev(
160-
binomial_logit_glm_lpmf_functor, n, trials, x, alpha, beta);
159+
stan::math::test::compare_cpu_opencl_prim_rev(binomial_logit_glm_lpmf_functor,
160+
n, trials, x, alpha, beta);
161161
stan::math::test::compare_cpu_opencl_prim_rev(
162162
binomial_logit_glm_lpmf_functor_propto, n, trials, x, alpha, beta);
163163
}
@@ -172,15 +172,13 @@ TEST(ProbDistributionsBinomialLogitGLM, opencl_matches_cpu_zero_attributes) {
172172
Eigen::VectorXd beta(M);
173173
double alpha = 0.3;
174174

175-
stan::math::test::compare_cpu_opencl_prim_rev(
176-
binomial_logit_glm_lpmf_functor, n, trials, x, alpha, beta);
175+
stan::math::test::compare_cpu_opencl_prim_rev(binomial_logit_glm_lpmf_functor,
176+
n, trials, x, alpha, beta);
177177
stan::math::test::compare_cpu_opencl_prim_rev(
178178
binomial_logit_glm_lpmf_functor_propto, n, trials, x, alpha, beta);
179179
}
180180

181-
182-
TEST(ProbDistributionsBinomialLogitGLM,
183-
opencl_matches_cpu_small_vector_alpha) {
181+
TEST(ProbDistributionsBinomialLogitGLM, opencl_matches_cpu_small_vector_alpha) {
184182
int N = 3;
185183
int M = 2;
186184

@@ -193,8 +191,8 @@ TEST(ProbDistributionsBinomialLogitGLM,
193191
Eigen::VectorXd alpha(N);
194192
alpha << 0.3, -0.8, 1.8;
195193

196-
stan::math::test::compare_cpu_opencl_prim_rev(
197-
binomial_logit_glm_lpmf_functor, n, trials, x, alpha, beta);
194+
stan::math::test::compare_cpu_opencl_prim_rev(binomial_logit_glm_lpmf_functor,
195+
n, trials, x, alpha, beta);
198196
stan::math::test::compare_cpu_opencl_prim_rev(
199197
binomial_logit_glm_lpmf_functor_propto, n, trials, x, alpha, beta);
200198
}
@@ -213,8 +211,8 @@ TEST(ProbDistributionsBinomialLogitGLM, opencl_matches_cpu_big) {
213211
Eigen::VectorXd beta = Eigen::VectorXd::Random(M);
214212
Eigen::VectorXd alpha = Eigen::VectorXd::Random(N);
215213

216-
stan::math::test::compare_cpu_opencl_prim_rev(
217-
binomial_logit_glm_lpmf_functor, n, trials, x, alpha, beta);
214+
stan::math::test::compare_cpu_opencl_prim_rev(binomial_logit_glm_lpmf_functor,
215+
n, trials, x, alpha, beta);
218216
stan::math::test::compare_cpu_opencl_prim_rev(
219217
binomial_logit_glm_lpmf_functor_propto, n, trials, x, alpha, beta);
220218
}

0 commit comments

Comments
 (0)