Thrill  0.1
ex_prefix_sum.hpp
Go to the documentation of this file.
1 /*******************************************************************************
2  * thrill/api/ex_prefix_sum.hpp
3  *
4  * Part of Project Thrill - http://project-thrill.org
5  *
6  * Copyright (C) 2015 Alexander Noe <[email protected]>
7  * Copyright (C) 2015 Timo Bingmann <[email protected]>
8  *
9  * All rights reserved. Published under the BSD-2 license in the LICENSE file.
10  ******************************************************************************/
11 
12 #pragma once
13 #ifndef THRILL_API_EX_PREFIX_SUM_HEADER
14 #define THRILL_API_EX_PREFIX_SUM_HEADER
15 
18 
19 namespace thrill {
20 namespace api {
21 
22 template <typename ValueType, typename Stack>
23 template <typename SumFunction>
25  const SumFunction& sum_function, const ValueType& initial_element) const {
26  assert(IsValid());
27 
29  ValueType, SumFunction, /* Inclusive */ false>;
30 
31  static_assert(
32  std::is_convertible<
33  ValueType,
35  >::value,
36  "SumFunction has the wrong input type");
37 
38  static_assert(
39  std::is_convertible<
40  ValueType,
42  "SumFunction has the wrong input type");
43 
44  static_assert(
45  std::is_convertible<
47  ValueType>::value,
48  "SumFunction has the wrong input type");
49 
50  auto node = tlx::make_counting<PrefixSumNode>(
51  *this, "ExPrefixSum", sum_function, initial_element);
52 
53  return DIA<ValueType>(node);
54 }
55 
56 } // namespace api
57 } // namespace thrill
58 
59 #endif // !THRILL_API_EX_PREFIX_SUM_HEADER
60 
61 /******************************************************************************/
DIA is the interface between the user and the Thrill framework.
Definition: dia.hpp:141
int value
Definition: gen_data.py:41
auto ExPrefixSum(const SumFunction &sum_function=SumFunction(), const ValueType &initial_element=ValueType()) const
ExPrefixSum is a DOp, which computes the exclusive prefix sum of all elements.
common::FunctionTraits< Function > FunctionTraits
alias for convenience.
Definition: dia.hpp:147