30 #ifndef REMORA_KERNELS_DEFAULT_GEMatAV_HPP 31 #define REMORA_KERNELS_DEFAULT_GEMatAV_HPP 33 #include "../../expression_types.hpp" 34 #include "../../detail/matrix_proxy_classes.hpp" 35 #include "../../detail/traits.hpp" 37 #include "../../assignment.hpp" 38 #include <type_traits> 40 namespace remora{
namespace bindings {
43 template<
class ResultV,
class MatA,
class V>
45 matrix_expression<MatA, cpu_tag>
const& A,
46 vector_expression<V, cpu_tag>
const& x,
47 vector_expression<ResultV, cpu_tag>& result,
48 typename ResultV::value_type alpha,
51 typedef typename ResultV::value_type value_type;
53 for(std::size_t i = 0; i != A().size1();++i){
54 matrix_row<typename const_expression<MatA>::type > rowA(A(),i);
55 kernels::dot(rowA,x,value);
56 if(value != value_type())
57 result()(i) += alpha * value;
62 template<
class ResultV,
class MatA,
class V>
64 matrix_expression<MatA, cpu_tag>
const& A,
65 vector_expression<V, cpu_tag>
const& x,
66 vector_expression<ResultV, cpu_tag>& result,
67 typename ResultV::value_type alpha,
71 typedef matrix_transpose<typename const_expression<MatA>::type > TransA;
73 typedef typename V::const_iterator iterator;
74 typedef typename ResultV::value_type value_type;
75 iterator end = x().end();
76 for(iterator it = x().begin(); it != end; ++it) {
77 value_type multiplier = alpha * (*it);
78 matrix_row<TransA> colA(transA,it.index());
80 plus_assign(result,colA,multiplier);
85 template<
class ResultV,
class MatA,
class V>
87 matrix_expression<MatA, cpu_tag>
const& A,
88 vector_expression<V, cpu_tag>
const& x,
89 vector_expression<ResultV, cpu_tag>& result,
90 typename ResultV::value_type alpha,
93 gemv_impl(A,x,result,alpha,row_major());
97 template<
class ResultV,
class MatA,
class V>
99 matrix_expression<MatA, cpu_tag>
const& A,
100 vector_expression<V, cpu_tag>
const& x,
101 vector_expression<ResultV, cpu_tag>& result,
102 typename ResultV::value_type alpha,
105 typedef typename MatA::orientation orientation;
107 gemv_impl(A, x, result, alpha, orientation());