Skip to content

Commit 5b8cddc

Browse files
committed
[Jenkins] auto-formatting by clang-format version 10.0.0-4ubuntu1
1 parent f09e934 commit 5b8cddc

5 files changed

Lines changed: 44 additions & 48 deletions

File tree

stan/math/mix/functor/laplace_marginal_density.hpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ struct laplace_options {
4848

4949
namespace internal {
5050

51-
5251
template <typename Covar, typename ThetaVec, typename WR, typename L_t,
5352
typename A_vec, typename ThetaGrad, typename LU_t, typename KRoot>
5453
struct laplace_density_estimates {
@@ -341,7 +340,7 @@ inline void collect_adjoints(Output& output, Input&& input) {
341340
Eigen::Map<Eigen::Matrix<double, -1, 1>> output_map(output_i.data(),
342341
output_i.size());
343342
Eigen::Map<Eigen::Matrix<var, -1, 1>> input_map(input_i.data(),
344-
input_i.size());
343+
input_i.size());
345344
output_map.array() += input_map.adj().array();
346345
if constexpr (ZeroInput) {
347346
input_map.adj().setZero();
@@ -737,7 +736,7 @@ inline auto laplace_marginal_density_est(LLFun&& ll_fun, LLTupleArgs&& ll_args,
737736
std::string("You chose a solver (") + std::to_string(options.solver)
738737
+ ") that is not valid. Please choose either 1, 2, or 3.");
739738
}
740-
}
739+
} // namespace internal
741740
/**
742741
* For a latent Gaussian model with global parameters phi, latent
743742
* variables theta, and observations y, this function computes
@@ -803,8 +802,8 @@ inline void collect_adjoints(Output&& output, Input&& input) {
803802
if constexpr (is_std_vector_v<output_i_t>) {
804803
Eigen::Map<Eigen::Matrix<double, -1, 1>> output_map(output_i.data(),
805804
output_i.size());
806-
Eigen::Map<Eigen::Matrix<double, -1, 1>> input_map(
807-
input_i.data(), input_i.size());
805+
Eigen::Map<Eigen::Matrix<double, -1, 1>> input_map(input_i.data(),
806+
input_i.size());
808807
output_map.array() += input_map.array();
809808
} else if constexpr (is_eigen_v<output_i_t>) {
810809
output_i.array() += input_i.array();
@@ -835,7 +834,7 @@ inline void constexpr copy_compute_s2(const std::tuple<>& output,
835834
* @param input The input from which the adjoints will be collected
836835
*/
837836
template <bool ZeroInput = false, typename Output, typename Input,
838-
require_t<is_all_arithmetic_scalar<Output>> * = nullptr,
837+
require_t<is_all_arithmetic_scalar<Output>>* = nullptr,
839838
require_t<is_any_var_scalar<Input>>* = nullptr>
840839
inline void copy_compute_s2(Output&& output, Input&& input) {
841840
return iter_tuple_n(
@@ -845,7 +844,7 @@ inline void copy_compute_s2(Output&& output, Input&& input) {
845844
Eigen::Map<Eigen::Matrix<double, -1, 1>> output_map(output_i.data(),
846845
output_i.size());
847846
Eigen::Map<Eigen::Matrix<var, -1, 1>> input_map(input_i.data(),
848-
input_i.size());
847+
input_i.size());
849848
output_map.array() += 0.5 * input_map.adj().array();
850849
if constexpr (ZeroInput) {
851850
input_map.adj().setZero();
@@ -895,7 +894,7 @@ inline constexpr auto make_zeroed_arena(Input&& input) {
895894
} else if constexpr (is_eigen_v<Input>) {
896895
return arena_t<promote_scalar_t<double, Input>>(
897896
plain_type_t<promote_scalar_t<double, Input>>::Zero(input.rows(),
898-
input.cols()));
897+
input.cols()));
899898
} else if constexpr (is_var<Input>::value) {
900899
return static_cast<double>(0.0);
901900
}
@@ -941,8 +940,7 @@ inline void print_adjoint(Output&& output) {
941940
* @param input The input from which the adjoints will be collected
942941
*/
943942
template <typename Output, typename Input>
944-
inline void collect_adjoints(Output&& output, const vari* ret,
945-
Input&& input) {
943+
inline void collect_adjoints(Output&& output, const vari* ret, Input&& input) {
946944
if constexpr (is_tuple_v<Output>) {
947945
static_assert(1,
948946
"INTERNAL ERROR:(laplace_marginal_lpdf)"
@@ -959,8 +957,8 @@ inline void collect_adjoints(Output&& output, const vari* ret,
959957
} else {
960958
Eigen::Map<Eigen::Matrix<var, -1, 1>> output_map(output.data(),
961959
output.size());
962-
Eigen::Map<const Eigen::Matrix<double, -1, 1>> input_map(
963-
input.data(), input.size());
960+
Eigen::Map<const Eigen::Matrix<double, -1, 1>> input_map(input.data(),
961+
input.size());
964962
output_map.array().adj() += ret->adj_ * input_map.array();
965963
}
966964
} else if constexpr (is_eigen_v<Output>) {
@@ -982,7 +980,7 @@ inline void collect_adjoints(Output&& output, const vari* ret,
982980
*/
983981
template <typename Output, typename Input>
984982
inline void reverse_pass_collect_adjoints(var ret, Output&& output,
985-
Input&& input) {
983+
Input&& input) {
986984
if constexpr (is_tuple_v<Output>) {
987985
stan::math::for_each(
988986
[ret](auto&& inner_arg, auto&& inner_input) mutable {
@@ -1003,7 +1001,7 @@ inline void reverse_pass_collect_adjoints(var ret, Output&& output,
10031001
});
10041002
}
10051003
}
1006-
}
1004+
} // namespace internal
10071005
/**
10081006
* For a latent Gaussian model with global parameters phi, latent
10091007
* variables theta, and observations y, this function computes
@@ -1023,7 +1021,7 @@ inline void reverse_pass_collect_adjoints(var ret, Output&& output,
10231021
* where `InnerLLTupleArgs` are the elements of `LLTupleArgs`
10241022
* @tparam LLTupleArgs A tuple whose elements follow the types required for
10251023
* `LLFun`
1026-
* \laplace_common_template_args
1024+
* \laplace_common_template_args
10271025
* @param[in] ll_fun A log likelihood functor
10281026
* @param[in] ll_args Tuple containing parameters for `LLFun`
10291027
* \laplace_common_args
@@ -1056,7 +1054,8 @@ inline auto laplace_marginal_density(const LLFun& ll_fun, LLTupleArgs&& ll_args,
10561054
// Solver 3
10571055
arena_t<Eigen::MatrixXd> LU_solve_covariance;
10581056
// Solver 1, 2, 3
1059-
arena_t<promote_scalar_t<double, std::decay_t<ThetaVec>>> s2(theta_0.size());
1057+
arena_t<promote_scalar_t<double, std::decay_t<ThetaVec>>> s2(
1058+
theta_0.size());
10601059
// Make one hard copy here
10611060
using laplace_likelihood::internal::conditional_copy_and_promote;
10621061
using laplace_likelihood::internal::COPY_TYPE;
@@ -1197,7 +1196,8 @@ inline auto laplace_marginal_density(const LLFun& ll_fun, LLTupleArgs&& ll_args,
11971196
if constexpr (is_any_var_scalar_v<CovarArgs>) {
11981197
auto covar_args_filter = stan::math::filter_map<is_any_var_scalar>(
11991198
[](auto&& arg) -> decltype(auto) { return arg; }, covar_args_refs);
1200-
internal::reverse_pass_collect_adjoints(ret, covar_args_filter, covar_args_adj);
1199+
internal::reverse_pass_collect_adjoints(ret, covar_args_filter,
1200+
covar_args_adj);
12011201
}
12021202
if constexpr (ll_args_contain_var) {
12031203
auto ll_args_filter = stan::math::filter_map<is_any_var_scalar>(

stan/math/mix/prob/laplace_latent_bernoulli_logit_rng.hpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,11 @@ inline Eigen::VectorXd laplace_latent_tol_bernoulli_logit_rng(
6161
* \msg_arg
6262
*/
6363
template <typename CovarFun, typename ThetaVec, typename CovarArgs,
64-
typename RNG,
65-
require_eigen_t<ThetaVec>* = nullptr>
66-
inline Eigen::VectorXd laplace_latent_bernoulli_logit_rng(const std::vector<int>& y,
67-
const std::vector<int>& n_samples,
68-
ThetaVec&& theta_0,
69-
CovarFun&& covariance_function,
70-
CovarArgs&& covar_args, RNG& rng,
71-
std::ostream* msgs) {
64+
typename RNG, require_eigen_t<ThetaVec>* = nullptr>
65+
inline Eigen::VectorXd laplace_latent_bernoulli_logit_rng(
66+
const std::vector<int>& y, const std::vector<int>& n_samples,
67+
ThetaVec&& theta_0, CovarFun&& covariance_function, CovarArgs&& covar_args,
68+
RNG& rng, std::ostream* msgs) {
7269
constexpr laplace_options ops{1, 1, 0, 1e-6, 100};
7370
return laplace_base_rng(bernoulli_logit_likelihood{},
7471
std::forward_as_tuple(to_vector(y), n_samples),

stan/math/mix/prob/laplace_marginal.hpp

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,18 @@ namespace math {
2828
template <bool propto = false, typename LFun, typename LArgs, typename CovarFun,
2929
typename ThetaVec, typename CovarArgs,
3030
require_all_eigen_vector_t<ThetaVec>* = nullptr>
31-
inline auto laplace_marginal_tol(LFun&& L_f, LArgs&& l_args,
32-
const ThetaVec& theta_0, CovarFun&& covariance_function,
33-
CovarArgs&& covar_args, double tolerance,
34-
int64_t max_num_steps,
35-
const int hessian_block_size, const int solver,
36-
const int max_steps_line_search,
37-
std::ostream* msgs) {
31+
inline auto laplace_marginal_tol(
32+
LFun&& L_f, LArgs&& l_args, const ThetaVec& theta_0,
33+
CovarFun&& covariance_function, CovarArgs&& covar_args, double tolerance,
34+
int64_t max_num_steps, const int hessian_block_size, const int solver,
35+
const int max_steps_line_search, std::ostream* msgs) {
3836
// TEST: provisional signature to agree with parser.
3937
laplace_options ops{hessian_block_size, solver, max_steps_line_search,
4038
tolerance, max_num_steps};
4139
return laplace_marginal_density(
4240
std::forward<LFun>(L_f), std::forward<LArgs>(l_args), theta_0,
43-
std::forward<CovarFun>(covariance_function), std::forward<CovarArgs>(covar_args), ops,
44-
msgs);
41+
std::forward<CovarFun>(covariance_function),
42+
std::forward<CovarArgs>(covar_args), ops, msgs);
4543
}
4644

4745
/**
@@ -65,13 +63,14 @@ template <bool propto = false, typename LFun, typename LArgs, typename CovarFun,
6563
typename ThetaVec, typename CovarArgs,
6664
require_all_eigen_vector_t<ThetaVec>* = nullptr>
6765
inline auto laplace_marginal(LFun&& L_f, LArgs&& l_args,
68-
const ThetaVec& theta_0, CovarFun&& covariance_function,
66+
const ThetaVec& theta_0,
67+
CovarFun&& covariance_function,
6968
CovarArgs&& covar_args, std::ostream* msgs) {
7069
constexpr laplace_options ops{1, 1, 0, 1e-6, 100};
7170
return laplace_marginal_density(
7271
std::forward<LFun>(L_f), std::forward<LArgs>(l_args), theta_0,
73-
std::forward<CovarFun>(covariance_function), std::forward<CovarArgs>(covar_args), ops,
74-
msgs);
72+
std::forward<CovarFun>(covariance_function),
73+
std::forward<CovarArgs>(covar_args), ops, msgs);
7574
}
7675

7776
} // namespace math

stan/math/prim/meta/is_all_arithmetic.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ struct is_all_arithmetic_scalar_impl
1717

1818
template <typename... Types>
1919
struct is_all_arithmetic_scalar_impl<std::tuple<Types...>>
20-
: std::conjunction<is_all_arithmetic_scalar_impl<std::decay_t<Types>>...> {};
20+
: std::conjunction<is_all_arithmetic_scalar_impl<std::decay_t<Types>>...> {
21+
};
2122
template <typename T, typename... VecArgs>
2223
struct is_all_arithmetic_scalar_impl<std::vector<T, VecArgs...>>
2324
: std::conjunction<is_all_arithmetic_scalar_impl<std::decay_t<T>>> {};

stan/math/prim/meta/is_var.hpp

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ struct is_any_var_scalar_impl {
2929

3030
template <typename... Types>
3131
struct is_any_var_scalar_impl<std::tuple<Types...>> {
32-
static constexpr bool value = (is_any_var_scalar_impl<std::decay_t<Types>>::value || ...);
32+
static constexpr bool value
33+
= (is_any_var_scalar_impl<std::decay_t<Types>>::value || ...);
3334
};
3435

3536
template <typename T, typename... VecArgs>
@@ -41,13 +42,13 @@ struct is_any_var_scalar_impl<std::vector<T, VecArgs...>> {
4142

4243
template <typename... Types>
4344
struct is_any_var_scalar
44-
: std::disjunction<internal::is_any_var_scalar_impl<std::decay_t<Types>>...> {};
45+
: std::disjunction<
46+
internal::is_any_var_scalar_impl<std::decay_t<Types>>...> {};
4547

4648
template <typename... Types>
4749
constexpr bool is_any_var_scalar_v
4850
= is_any_var_scalar<std::decay_t<Types>...>::value;
4951

50-
5152
namespace internal {
5253
template <typename... Types>
5354
struct is_all_var_scalar_impl {
@@ -57,28 +58,26 @@ struct is_all_var_scalar_impl {
5758
template <typename... Types>
5859
struct is_all_var_scalar_impl<std::tuple<Types...>> {
5960
static constexpr bool value
60-
= (is_all_var_scalar_impl<std::decay_t<Types>>::value
61-
&& ...);
61+
= (is_all_var_scalar_impl<std::decay_t<Types>>::value && ...);
6262
};
6363

6464
template <typename... Types, typename... VecArgs>
6565
struct is_all_var_scalar_impl<std::vector<std::tuple<Types...>, VecArgs...>> {
6666
static constexpr bool value
67-
= (is_all_var_scalar_impl<std::decay_t<Types>>::value
68-
&& ...);
67+
= (is_all_var_scalar_impl<std::decay_t<Types>>::value && ...);
6968
};
7069

71-
}
70+
} // namespace internal
7271

7372
template <typename... Types>
7473
struct is_all_var_scalar
75-
: std::disjunction<internal::is_all_var_scalar_impl<std::decay_t<Types>>...> {};
74+
: std::disjunction<
75+
internal::is_all_var_scalar_impl<std::decay_t<Types>>...> {};
7676

7777
template <typename... Types>
7878
constexpr bool is_all_var_scalar_v
7979
= is_all_var_scalar<std::decay_t<Types>...>::value;
8080

81-
8281
/*! \ingroup require_stan_scalar_real */
8382
/*! \defgroup var_types var */
8483
/*! \addtogroup var_types */

0 commit comments

Comments
 (0)