31 #ifndef REMORA_KERNELS_DEFAULT_tpmv_HPP 32 #define REMORA_KERNELS_DEFAULT_tpmv_HPP 34 #include "../../expression_types.hpp" 35 #include "../../detail/traits.hpp" 36 #include <type_traits> 39 namespace remora{
namespace bindings{
46 template<
class MatA,
class V>
48 matrix_expression<MatA, cpu_tag>
const& A,
49 vector_expression<V, cpu_tag>& b,
53 typedef typename V::value_type value_type;
54 typedef typename V::size_type size_type;
55 typedef typename MatA::const_row_iterator row_iterator;
56 size_type size = A().size1();
58 for(size_type i = 0; i != size; ++i){
60 row_iterator end = A().row_end(i);
61 for(row_iterator pos = A().row_begin(i); pos != end; ++pos){
62 sum += *pos * b()(pos.index());
73 template<
class MatA,
class V>
75 matrix_expression<MatA, cpu_tag>
const& A,
76 vector_expression<V, cpu_tag>& b,
80 typedef typename V::value_type value_type;
81 typedef typename V::size_type size_type;
82 typedef typename MatA::const_row_iterator row_iterator;
83 size_type size = A().size1();
85 for(size_type irev = size; irev != 0; --irev){
88 row_iterator end = A().row_end(i);
89 for(row_iterator pos = A().row_begin(i); pos != end; ++pos){
90 sum += *pos * b()(pos.index());
99 template<
class MatA,
class V>
101 matrix_expression<MatA, cpu_tag>
const& A,
102 vector_expression<V, cpu_tag>& b,
106 typedef typename MatA::const_column_iterator column_iterator;
107 typedef typename V::size_type size_type;
108 typedef typename V::value_type value_type;
109 size_type size = A().size1();
110 for(size_type i = 0; i != size; ++i){
111 value_type bi = b()(i);
112 b()(i)= value_type();
113 column_iterator end = A().column_end(i);
114 for(column_iterator pos = A().column_begin(i); pos != end; ++pos){
115 b()(pos.index()) += *pos*bi;
124 template<
class MatA,
class V>
126 matrix_expression<MatA, cpu_tag>
const& A,
127 vector_expression<V, cpu_tag>& b,
131 typedef typename MatA::const_column_iterator column_iterator;
132 typedef typename V::size_type size_type;
133 typedef typename V::value_type value_type;
134 size_type size = A().size1();
136 for(size_type irev = size; irev != 0; --irev){
138 value_type bi = b()(i);
139 b()(i)= value_type();
140 column_iterator end = A().column_end(i);
141 for(column_iterator pos = A().column_begin(i); pos != end; ++pos){
142 b()(pos.index()) += *pos*bi;
148 template <
typename MatA,
typename V>
150 matrix_expression<MatA, cpu_tag>
const& A,
151 vector_expression<V, cpu_tag>& b,
154 REMORA_SIZE_CHECK(A().size1() == A().size2());
155 REMORA_SIZE_CHECK(A().size2() == b().size());
158 typename MatA::orientation::orientation(),
159 typename MatA::orientation::triangular_type()