Skip to content

Commit 0b88d1c

Browse files
committed
[Jenkins] auto-formatting by clang-format version 10.0.0-4ubuntu1
1 parent d793de3 commit 0b88d1c

11 files changed

Lines changed: 45 additions & 50 deletions

File tree

stan/math/mix/functor/laplace_marginal_density.hpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -873,9 +873,10 @@ inline void copy_compute_s2(Output&& output, Input&& input) {
873873
template <typename T>
874874
inline constexpr decltype(auto) filter_var_scalar_types(T&& t) {
875875
return stan::math::filter_map<is_any_var_scalar>(
876-
[](auto&& arg) -> decltype(auto) {
877-
return std::forward<decltype(arg)>(arg);
878-
}, std::forward<T>(t));
876+
[](auto&& arg) -> decltype(auto) {
877+
return std::forward<decltype(arg)>(arg);
878+
},
879+
std::forward<T>(t));
879880
}
880881
/**
881882
* Creates an arena type from the input with initialized with zeros
@@ -1144,7 +1145,8 @@ inline auto laplace_marginal_density(const LLFun& ll_fun, LLTupleArgs&& ll_args,
11441145
K_var.adj().array() += vi.adj() * K_adj_arena.array();
11451146
});
11461147
grad(Z.vi_);
1147-
auto covar_args_filter = internal::filter_var_scalar_types(covar_args_copy);
1148+
auto covar_args_filter
1149+
= internal::filter_var_scalar_types(covar_args_copy);
11481150
internal::collect_adjoints(covar_args_adj, covar_args_filter);
11491151
}();
11501152
}

stan/math/prim/fun/promote_scalar.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ inline constexpr auto promote_scalar(UnPromotedTypes&& x) {
4545
} else if constexpr (is_stan_scalar_v<UnPromotedTypes>) {
4646
return PromotionScalars(std::forward<UnPromotedTypes>(x));
4747
} else {
48-
static_assert(sizeof(UnPromotedTypes*) == 0, "Missed type in promote_scalar!");
48+
static_assert(sizeof(UnPromotedTypes*) == 0,
49+
"Missed type in promote_scalar!");
4950
}
5051
}
5152

stan/math/prim/fun/scalar_seq_view.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,8 @@ class scalar_seq_view<C, require_t<std::is_pointer<C>>> {
126126
*/
127127
inline auto operator[](size_t i) const { return c_[i]; }
128128
inline auto size() const noexcept {
129-
static_assert(sizeof(C*) == 0, "Cannot Return Size of scalar_seq_view with pointer type");
129+
static_assert(sizeof(C*) == 0,
130+
"Cannot Return Size of scalar_seq_view with pointer type");
130131
}
131132
inline const auto* data() const noexcept { return &c_[0]; }
132133

stan/math/prim/fun/to_ref.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ template <typename T, require_tuple_t<T>* = nullptr>
2929
inline auto to_ref(T&& a) {
3030
return apply(
3131
[](auto&&... args) {
32-
return make_holder_tuple(
33-
to_ref(std::forward<decltype(args)>(args))...);
32+
return make_holder_tuple(to_ref(std::forward<decltype(args)>(args))...);
3433
},
3534
std::forward<T>(a));
3635
}

stan/math/prim/functor/filter_map.hpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace stan {
1313
namespace math {
1414

15-
1615
namespace internal {
1716

1817
template <template <typename...> class Filter, typename T>
@@ -28,8 +27,9 @@ struct inspect_tuple<Filter, std::tuple<Types...>> {
2827

2928
template <template <typename...> class Filter, typename T, typename... VecArgs>
3029
struct inspect_tuple<Filter, std::vector<T, VecArgs...>> {
31-
static constexpr bool value = Filter<std::vector<T, VecArgs...>>::value
32-
|| inspect_tuple<Filter, std::decay_t<T>>::value;
30+
static constexpr bool value
31+
= Filter<std::vector<T, VecArgs...>>::value
32+
|| inspect_tuple<Filter, std::decay_t<T>>::value;
3333
};
3434

3535
/**
@@ -40,7 +40,8 @@ struct inspect_tuple<Filter, std::vector<T, VecArgs...>> {
4040
* @tparam T type to check
4141
*/
4242
template <template <typename...> class Filter, typename T>
43-
inline constexpr bool inspect_tuple_v = internal::inspect_tuple<Filter, std::decay_t<T>>::value;
43+
inline constexpr bool inspect_tuple_v
44+
= internal::inspect_tuple<Filter, std::decay_t<T>>::value;
4445

4546
/**
4647
* Filter a tuple and apply a functor to each element that passes the filter.
@@ -49,8 +50,9 @@ inline constexpr bool inspect_tuple_v = internal::inspect_tuple<Filter, std::dec
4950
* Note that this function automatically inspects into tuples and
5051
* `std::vector<T>::value_type`'s. The `filter_map` will recursively apply
5152
* itself to inner containers as long as it sees a tuple in type type.
52-
* So for instance if your type is a `tuple<vector<tuple<vector<vector<double>>>>`
53-
* your functor `f` must support operationg on `vector<vector<double>>` types.
53+
* So for instance if your type is a
54+
* `tuple<vector<tuple<vector<vector<double>>>>` your functor `f` must support
55+
* operationg on `vector<vector<double>>` types.
5456
* @tparam Filter a struct that accepts one template parameter and has a static
5557
* constexpr bool member named value that is true if the type should be
5658
* included in the output tuple.
@@ -93,11 +95,11 @@ inline constexpr decltype(auto) filter_map(F&& f, T&& x) {
9395
return ret;
9496
}
9597
} else if constexpr (is_std_vector_v<T>) {
96-
/* 3 cases for vectors
97-
* 1. value_type is a tuple
98-
* 2. value_type is a scalar or Eigen matrix
99-
* 3. value_type is a std::vector which can hold either (1) or (2)
100-
*/
98+
/* 3 cases for vectors
99+
* 1. value_type is a tuple
100+
* 2. value_type is a scalar or Eigen matrix
101+
* 3. value_type is a std::vector which can hold either (1) or (2)
102+
*/
101103
if constexpr (contains_tuple<T>::value) {
102104
std::vector<decltype(filter_map<Filter, true>(f, x[0]))> ret;
103105
for (size_t i = 0; i < x.size(); ++i) {
@@ -116,16 +118,14 @@ inline constexpr decltype(auto) filter_map(F&& f, T&& x) {
116118
if constexpr (InVector) {
117119
return std::forward<F>(f)(std::forward<T>(x));
118120
} else {
119-
return make_holder_tuple(
120-
std::forward<F>(f)(std::forward<T>(x)));
121+
return make_holder_tuple(std::forward<F>(f)(std::forward<T>(x)));
121122
}
122123
}
123124
} else {
124125
if constexpr (InVector) {
125126
return std::forward<F>(f)(std::forward<T>(x));
126127
} else {
127-
return make_holder_tuple(
128-
std::forward<F>(f)(std::forward<T>(x)));
128+
return make_holder_tuple(std::forward<F>(f)(std::forward<T>(x)));
129129
}
130130
}
131131
} else {

stan/math/prim/functor/make_holder_tuple.hpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ struct deduce_cvr {
3333

3434
template <typename T>
3535
using deduce_cvr_t = typename deduce_cvr<T>::type;
36-
}
36+
} // namespace internal
3737
/**
3838
* Holds ownership of rvalues and forwards lvalues into a tuple.
3939
*
@@ -46,12 +46,12 @@ using deduce_cvr_t = typename deduce_cvr<T>::type;
4646
* This behavior ensures that temporaries are stored by value in the tuple while
4747
* lvalues are preserved as references. It is similar in intent to the `Holder`
4848
* class in behavior, but for tuples instead of Eigen types.
49-
* It is the opposite of `std::forward_as_tuple`, with the difference in handling rvalues.
50-
* `std::forward_as_tuple` does not extend object lifetimes, so when an rvalue
51-
* is passed to `std::forward_as_tuple`, the resulting tuple element will be a
52-
* reference to a temporary that is destroyed at the end of the statement. This
53-
* function ensures that rvalues are stored by value in the tuple, extending
54-
* their lifetimes.
49+
* It is the opposite of `std::forward_as_tuple`, with the difference in
50+
* handling rvalues. `std::forward_as_tuple` does not extend object lifetimes,
51+
* so when an rvalue is passed to `std::forward_as_tuple`, the resulting tuple
52+
* element will be a reference to a temporary that is destroyed at the end of
53+
* the statement. This function ensures that rvalues are stored by value in the
54+
* tuple, extending their lifetimes.
5555
*
5656
* @tparam Types Parameter pack representing the types of the arguments.
5757
* @param args The arguments to forward into the tuple.
@@ -67,7 +67,8 @@ inline constexpr auto make_holder_tuple(Types&&... args) {
6767
if constexpr (sizeof...(Types) == 0) {
6868
return std::tuple<>{};
6969
} else {
70-
return std::tuple<internal::deduce_cvr_t<Types&&>...>{std::forward<Types>(args)...};
70+
return std::tuple<internal::deduce_cvr_t<Types&&>...>{
71+
std::forward<Types>(args)...};
7172
}
7273
}
7374
} // namespace math

stan/math/prim/functor/tuple_concat.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ inline auto constexpr tuple_concat_impl(Tuple1&& x, Tuple2&& y,
2323
std::index_sequence<I1...> /* i */,
2424
std::index_sequence<I2...> /* j */) {
2525
return make_holder_tuple(std::get<I1>(std::forward<Tuple1>(x))...,
26-
std::get<I2>(std::forward<Tuple2>(y))...);
26+
std::get<I2>(std::forward<Tuple2>(y))...);
2727
}
2828

2929
template <typename Tuple1, typename Tuple2, typename Tuple3, std::size_t... I1,
@@ -33,8 +33,8 @@ inline auto constexpr tuple_concat_impl(Tuple1&& x, Tuple2&& y, Tuple3&& z,
3333
std::index_sequence<I2...> /* j */,
3434
std::index_sequence<I3...> /* k */) {
3535
return make_holder_tuple(std::get<I1>(std::forward<Tuple1>(x))...,
36-
std::get<I2>(std::forward<Tuple2>(y))...,
37-
std::get<I3>(std::forward<Tuple3>(z))...);
36+
std::get<I2>(std::forward<Tuple2>(y))...,
37+
std::get<I3>(std::forward<Tuple3>(z))...);
3838
}
3939
} // namespace internal
4040

stan/math/prim/meta/contains_tuple.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ template <typename T>
3535
inline constexpr bool is_std_vector_containing_tuple_v
3636
= is_std_vector_v<std::decay_t<T>>&& contains_tuple_v<std::decay_t<T>>;
3737

38-
3938
} // namespace stan
4039

4140
#endif

stan/math/rev/core/accumulate_adjoints.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@ inline double* accumulate_adjoints(double* dest, Arith&& x, Pargs&&... args) {
140140
return accumulate_adjoints(dest, std::forward<Pargs>(args)...);
141141
}
142142

143-
144143
} // namespace math
145144
} // namespace stan
146145

test/unit/math/mix/functor/hessian_block_diag_test.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ using Eigen::Matrix;
66
using Eigen::MatrixXd;
77
using Eigen::VectorXd;
88

9-
using stan::math::hessian_block_diag;
109
using stan::math::hessian;
10+
using stan::math::hessian_block_diag;
1111

1212
namespace hessian_block_diag_test {
1313

@@ -24,9 +24,7 @@ struct fun2 {
2424
template <typename T>
2525
inline T operator()(const Matrix<T, Dynamic, 1>& x) const {
2626
using std::sin;
27-
return x(0) * x(0) * x(1)
28-
+ 3.0 * x(1) * x(1)
29-
+ 5.0 * x(0) * x(1)
27+
return x(0) * x(0) * x(1) + 3.0 * x(1) * x(1) + 5.0 * x(0) * x(1)
3028
+ sin(x(0));
3129
}
3230
};

0 commit comments

Comments
 (0)