28 #ifndef REMORA_KERNELS_DEFAULT_VECTOR_FOLD_HPP 29 #define REMORA_KERNELS_DEFAULT_VECTOR_FOLD_HPP 31 #include "../../expression_types.hpp" 33 namespace remora{
namespace bindings{
34 template<
class F,
class V>
35 void vector_fold(vector_expression<V, cpu_tag>
const& v,
typename F::result_type& value, dense_tag) {
37 std::size_t size = v().size();
38 for(std::size_t i = 0; i != size; ++i){
39 value = f(value,v()(i));
43 template<
class F,
class V>
44 void vector_fold(vector_expression<V, cpu_tag>
const& v,
typename F::result_type& value, sparse_tag) {
47 auto iter = v().begin();
49 for(;iter != end;++iter,++nnz){
50 value = f(value,*iter);