31 #ifndef REMORA_KERNELS_DEFAULT_SUM_ROWS_HPP 32 #define REMORA_KERNELS_DEFAULT_SUM_ROWS_HPP 34 #include "../../expression_types.hpp" 35 #include "../../detail/traits.hpp" 38 namespace remora{
namespace bindings{
40 template<
class M,
class V,
class Tag1,
class Tag2>
42 matrix_expression<M, cpu_tag>
const& A,
43 vector_expression<V, cpu_tag>& v,
44 typename V::value_type alpha,
45 column_major, Tag1, Tag2
47 for(std::size_t i = 0; i != A().size2(); ++i){
48 typename V::value_type s = 0;
49 auto end = A().column_end(i);
50 for(
auto pos = A().column_begin(i); pos != end; ++pos){
57 template<
class M,
class V,
class Tag1,
class Tag2>
59 matrix_expression<M, cpu_tag>
const& A,
60 vector_expression<V, cpu_tag>& v,
61 typename V::value_type alpha,
64 for(std::size_t i = 0; i != A().size1(); ++i){
65 auto end = A().row_end(i);
66 for(
auto pos = A().row_begin(i); pos != end; ++pos)
67 v()(pos.index()) += alpha * (*pos);
74 template<
class M,
class V,
class Orientation,
class Triangular,
class Tag1,
class Tag2>
76 matrix_expression<M, cpu_tag>
const& A,
77 vector_expression<V, cpu_tag>& v,
78 typename V::value_type alpha,
79 triangular<Orientation,Triangular>, Tag1, Tag2
81 sum_rows(A,v,alpha,Orientation(), Tag1(), Tag2());