Skip to content

Commit 2a39e03

Browse files
committed
[Jenkins] auto-formatting by clang-format version 6.0.0-1ubuntu2~16.04.1 (tags/RELEASE_600/final)
1 parent f6bb498 commit 2a39e03

3 files changed

Lines changed: 15 additions & 9 deletions

File tree

stan/math/prim/fun/csr_matrix_times_vector.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ namespace math {
7070
* @throw std::out_of_range if any of the indexes are out of range.
7171
*/
7272
template <typename T1, typename T2,
73-
require_not_t<conjunction<std::is_arithmetic<scalar_type_t<T1>>, is_var<scalar_type_t<T2>>>>* = nullptr>
73+
require_not_t<conjunction<std::is_arithmetic<scalar_type_t<T1>>,
74+
is_var<scalar_type_t<T2>>>>* = nullptr>
7475
inline Eigen::Matrix<return_type_t<T1, T2>, Eigen::Dynamic, 1>
7576
csr_matrix_times_vector(int m, int n, const T1& w, const std::vector<int>& v,
7677
const std::vector<int>& u, const T2& b) {

stan/math/rev/fun/csr_matrix_times_vector.hpp

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,10 @@ namespace math {
4141
* @throw std::out_of_range if any of the indexes are out of range.
4242
*/
4343
template <typename T1, typename T2, require_st_arithmetic<T1>* = nullptr,
44-
require_st_var<T2>* = nullptr>
45-
inline auto csr_matrix_times_vector(int m, int n, const T1& w, const std::vector<int>& v,
46-
const std::vector<int>& u, const T2& b) {
44+
require_st_var<T2>* = nullptr>
45+
inline auto csr_matrix_times_vector(int m, int n, const T1& w,
46+
const std::vector<int>& v,
47+
const std::vector<int>& u, const T2& b) {
4748
check_positive("csr_matrix_times_vector", "m", m);
4849
check_positive("csr_matrix_times_vector", "n", n);
4950
check_size_match("csr_matrix_times_vector", "n", n, "b", b.size());
@@ -58,12 +59,16 @@ inline auto csr_matrix_times_vector(int m, int n, const T1& w, const std::vector
5859
std::vector<int, arena_allocator<int>> arena_u(u.begin(), u.end());
5960
auto arena_w = to_arena(w);
6061
auto arena_b = to_arena(b);
61-
Eigen::Map<Eigen::SparseMatrix<scalar_type_t<T1>>> arena_sp_map(m, n, arena_b.size(), arena_v.data(), arena_u.data(), arena_w.data());
62-
using sparse_dense_mul_type = decltype((arena_sp_map * value_of(arena_b)).eval());
62+
Eigen::Map<Eigen::SparseMatrix<scalar_type_t<T1>>> arena_sp_map(
63+
m, n, arena_b.size(), arena_v.data(), arena_u.data(), arena_w.data());
64+
using sparse_dense_mul_type
65+
= decltype((arena_sp_map * value_of(arena_b)).eval());
6366
using return_t = return_var_matrix_t<sparse_dense_mul_type, T1, T2>;
6467
arena_t<return_t> result = arena_sp_map * arena_b.val();
65-
reverse_pass_callback([arena_v, arena_u, arena_w, arena_b, result, m, n]() mutable {
66-
Eigen::Map<Eigen::SparseMatrix<scalar_type_t<T1>>> arena_sp_map(m, n, arena_b.size(), arena_v.data(), arena_u.data(), arena_w.data());
68+
reverse_pass_callback([arena_v, arena_u, arena_w, arena_b, result, m,
69+
n]() mutable {
70+
Eigen::Map<Eigen::SparseMatrix<scalar_type_t<T1>>> arena_sp_map(
71+
m, n, arena_b.size(), arena_v.data(), arena_u.data(), arena_w.data());
6772
arena_b.adj() += arena_sp_map.transpose() * result.adj();
6873
});
6974

test/unit/math/mix/fun/csr_matrix_times_vector_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ TEST(MathMixMatFun, csr_matrix_times_vector) {
66
using stan::math::csr_matrix_times_vector;
77
std::vector<int> v{1, 2, 0, 2, 4, 2, 1, 4};
88
std::vector<int> u{0, 2, 4, 5, 6, 8};
9-
return csr_matrix_times_vector(5, 5, w, v, u, b);
9+
return csr_matrix_times_vector(5, 5, w, v, u, b);
1010
};
1111

1212
Eigen::VectorXd w(8);

0 commit comments

Comments
 (0)