Thrill  0.1
min.hpp
Go to the documentation of this file.
1 /*******************************************************************************
2  * thrill/api/min.hpp
3  *
4  * Part of Project Thrill - http://project-thrill.org
5  *
6  * Copyright (C) 2016 Timo Bingmann <[email protected]>
7  *
8  * All rights reserved. Published under the BSD-2 license in the LICENSE file.
9  ******************************************************************************/
10 
11 #pragma once
12 #ifndef THRILL_API_MIN_HEADER
13 #define THRILL_API_MIN_HEADER
14 
17 
18 namespace thrill {
19 namespace api {
20 
21 template <typename ValueType, typename Stack>
23  assert(IsValid());
24 
26  auto node = tlx::make_counting<MinNode>(*this, "Min");
27  node->RunScope();
28  return node->result();
29 }
30 
31 template <typename ValueType, typename Stack>
32 ValueType DIA<ValueType, Stack>::Min(const ValueType& initial_value) const {
33  assert(IsValid());
34 
36  auto node = tlx::make_counting<MinNode>(
37  *this, "Min", initial_value, /* with_initial_value */ true);
38  node->RunScope();
39  return node->result();
40 }
41 
42 template <typename ValueType, typename Stack>
44  assert(IsValid());
45 
47  auto node = tlx::make_counting<MinNode>(*this, "Min");
48  return Future<ValueType>(node);
49 }
50 
51 template <typename ValueType, typename Stack>
53  const ValueType& initial_value) const {
54  assert(IsValid());
55 
57  auto node = tlx::make_counting<MinNode>(
58  *this, "Min", initial_value, /* with_initial_value */ true);
59  return Future<ValueType>(node);
60 }
61 
62 } // namespace api
63 } // namespace thrill
64 
65 #endif // !THRILL_API_MIN_HEADER
66 
67 /******************************************************************************/
The return type class for all ActionFutures.
Definition: action_node.hpp:83
Future< ValueType > MinFuture() const
Min is an ActionFuture, which computes the minimum of all elements globally.
Definition: min.hpp:43
ValueType Min() const
Min is an Action, which computes the minimum of all elements globally.
Definition: min.hpp:22