31#ifndef REMORA_KERNELS_DEFAULT_tpmv_HPP
32#define REMORA_KERNELS_DEFAULT_tpmv_HPP
34#include "../../expression_types.hpp"
35#include "../../detail/traits.hpp"
39namespace remora{
namespace bindings{
46template<
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 size_type size = A().size1();
57 for(size_type i = 0; i != size; ++i){
59 auto end = A().major_end(i);
60 for(
auto pos = A().major_begin(i); pos != end; ++pos){
61 sum += *pos * b()(pos.index());
72template<
class MatA,
class V>
74 matrix_expression<MatA, cpu_tag>
const& A,
75 vector_expression<V, cpu_tag>& b,
79 typedef typename V::value_type value_type;
80 typedef typename V::size_type size_type;
81 size_type size = A().size1();
83 for(size_type irev = size; irev != 0; --irev){
86 auto end = A().major_end(i);
87 for(
auto pos = A().major_begin(i); pos != end; ++pos){
88 sum += *pos * b()(pos.index());
97template<
class MatA,
class V>
99 matrix_expression<MatA, cpu_tag>
const& A,
100 vector_expression<V, cpu_tag>& b,
104 typedef typename V::size_type size_type;
105 typedef typename V::value_type value_type;
106 size_type size = A().size1();
107 for(size_type i = 0; i != size; ++i){
108 value_type bi = b()(i);
109 b()(i)= value_type();
110 auto end = A().major_end(i);
111 for(
auto pos = A().major_begin(i); pos != end; ++pos){
112 b()(pos.index()) += *pos*bi;
121template<
class MatA,
class V>
123 matrix_expression<MatA, cpu_tag>
const& A,
124 vector_expression<V, cpu_tag>& b,
128 typedef typename V::size_type size_type;
129 typedef typename V::value_type value_type;
130 size_type size = A().size1();
132 for(size_type irev = size; irev != 0; --irev){
134 value_type bi = b()(i);
135 b()(i)= value_type();
136 auto end = A().major_end(i);
137 for(
auto pos = A().major_begin(i); pos != end; ++pos){
138 b()(pos.index()) += *pos*bi;
144template <
typename MatA,
typename V>
146 matrix_expression<MatA, cpu_tag>
const& A,
147 vector_expression<V, cpu_tag>& b,
150 REMORA_SIZE_CHECK(A().size1() == A().size2());
151 REMORA_SIZE_CHECK(A().size2() == b().size());
154 typename MatA::orientation::orientation(),
155 typename MatA::orientation::triangular_type()