30#ifndef REMORA_KERNELS_DEFAULT_GEMatAV_HPP
31#define REMORA_KERNELS_DEFAULT_GEMatAV_HPP
33#include "../../expression_types.hpp"
34#include "../../proxy_expressions.hpp"
35#include "../../detail/traits.hpp"
37#include "../vector_assign.hpp"
40namespace remora{
namespace bindings {
43template<
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 kernels::dot(row(A,i),x,value);
55 if(value != value_type())
56 result()(i) += alpha * value;
61template<
class ResultV,
class MatA,
class V>
63 matrix_expression<MatA, cpu_tag>
const& A,
64 vector_expression<V, cpu_tag>
const& x,
65 vector_expression<ResultV, cpu_tag>& result,
66 typename ResultV::value_type alpha,
69 typedef typename V::const_iterator iterator;
70 typedef typename ResultV::value_type value_type;
71 typedef device_traits<cpu_tag>::multiply_and_add<value_type> MultAdd;
72 iterator end = x().end();
73 for(iterator it = x().begin(); it != end; ++it) {
75 kernels::assign(result, column(A,it.index()), MultAdd(alpha * (*it)));
80template<
class ResultV,
class MatA,
class V>
82 matrix_expression<MatA, cpu_tag>
const& A,
83 vector_expression<V, cpu_tag>
const& x,
84 vector_expression<ResultV, cpu_tag>& result,
85 typename ResultV::value_type alpha,
88 gemv_impl(A,x,result,alpha,row_major());
92template<
class ResultV,
class MatA,
class V>
94 matrix_expression<MatA, cpu_tag>
const& A,
95 vector_expression<V, cpu_tag>
const& x,
96 vector_expression<ResultV, cpu_tag>& result,
97 typename ResultV::value_type alpha,
100 typedef typename MatA::orientation orientation;
102 gemv_impl(A, x, result, alpha, orientation());