1// -*- C++ -*-
2//===-- numeric_fwd.h --------------------------------------------------===//
3//
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef _PSTL_NUMERIC_FWD_H
11#define _PSTL_NUMERIC_FWD_H
12
13#include <type_traits>
14#include <utility>
15
16namespace __pstl
17{
18namespace __internal
19{
20
21//------------------------------------------------------------------------
22// transform_reduce (version with two binary functions, according to draft N4659)
23//------------------------------------------------------------------------
24
25template <class _ForwardIterator1, class _ForwardIterator2, class _Tp, class _BinaryOperation1, class _BinaryOperation2>
26_Tp __brick_transform_reduce(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _Tp, _BinaryOperation1,
27 _BinaryOperation2,
28 /*__is_vector=*/std::true_type) noexcept;
29
30template <class _ForwardIterator1, class _ForwardIterator2, class _Tp, class _BinaryOperation1, class _BinaryOperation2>
31_Tp __brick_transform_reduce(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _Tp, _BinaryOperation1,
32 _BinaryOperation2,
33 /*__is_vector=*/std::false_type) noexcept;
34
35template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _Tp, class _BinaryOperation1,
36 class _BinaryOperation2, class _IsVector>
37_Tp
38__pattern_transform_reduce(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _Tp,
39 _BinaryOperation1, _BinaryOperation2, _IsVector,
40 /*is_parallel=*/std::false_type) noexcept;
41
42template <class _ExecutionPolicy, class _RandomAccessIterator1, class _RandomAccessIterator2, class _Tp,
43 class _BinaryOperation1, class _BinaryOperation2, class _IsVector>
44_Tp
45__pattern_transform_reduce(_ExecutionPolicy&&, _RandomAccessIterator1, _RandomAccessIterator1, _RandomAccessIterator2,
46 _Tp, _BinaryOperation1, _BinaryOperation2, _IsVector __is_vector,
47 /*is_parallel=*/std::true_type);
48
49//------------------------------------------------------------------------
50// transform_reduce (version with unary and binary functions)
51//------------------------------------------------------------------------
52
53template <class _ForwardIterator, class _Tp, class _UnaryOperation, class _BinaryOperation>
54_Tp __brick_transform_reduce(_ForwardIterator, _ForwardIterator, _Tp, _BinaryOperation, _UnaryOperation,
55 /*is_vector=*/std::true_type) noexcept;
56
57template <class _ForwardIterator, class _Tp, class _BinaryOperation, class _UnaryOperation>
58_Tp __brick_transform_reduce(_ForwardIterator, _ForwardIterator, _Tp, _BinaryOperation, _UnaryOperation,
59 /*is_vector=*/std::false_type) noexcept;
60
61template <class _ExecutionPolicy, class _ForwardIterator, class _Tp, class _BinaryOperation, class _UnaryOperation,
62 class _IsVector>
63_Tp
64__pattern_transform_reduce(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Tp, _BinaryOperation,
65 _UnaryOperation, _IsVector,
66 /*is_parallel=*/std::false_type) noexcept;
67
68template <class _ExecutionPolicy, class _ForwardIterator, class _Tp, class _BinaryOperation, class _UnaryOperation,
69 class _IsVector>
70_Tp
71__pattern_transform_reduce(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Tp, _BinaryOperation,
72 _UnaryOperation, _IsVector,
73 /*is_parallel=*/std::true_type);
74
75//------------------------------------------------------------------------
76// transform_exclusive_scan
77//
78// walk3 evaluates f(x,y,z) for (x,y,z) drawn from [first1,last1), [first2,...), [first3,...)
79//------------------------------------------------------------------------
80
81template <class _ForwardIterator, class _OutputIterator, class _UnaryOperation, class _Tp, class _BinaryOperation>
82std::pair<_OutputIterator, _Tp> __brick_transform_scan(_ForwardIterator, _ForwardIterator, _OutputIterator,
83 _UnaryOperation, _Tp, _BinaryOperation,
84 /*Inclusive*/ std::false_type) noexcept;
85
86template <class _ForwardIterator, class _OutputIterator, class _UnaryOperation, class _Tp, class _BinaryOperation>
87std::pair<_OutputIterator, _Tp> __brick_transform_scan(_ForwardIterator, _ForwardIterator, _OutputIterator,
88 _UnaryOperation, _Tp, _BinaryOperation,
89 /*Inclusive*/ std::true_type) noexcept;
90
91template <class _ExecutionPolicy, class _ForwardIterator, class _OutputIterator, class _UnaryOperation, class _Tp,
92 class _BinaryOperation, class _Inclusive, class _IsVector>
93_OutputIterator
94__pattern_transform_scan(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _OutputIterator, _UnaryOperation, _Tp,
95 _BinaryOperation, _Inclusive, _IsVector,
96 /*is_parallel=*/std::false_type) noexcept;
97
98template <class _ExecutionPolicy, class _RandomAccessIterator, class _OutputIterator, class _UnaryOperation, class _Tp,
99 class _BinaryOperation, class _Inclusive, class _IsVector>
100typename std::enable_if<!std::is_floating_point<_Tp>::value, _OutputIterator>::type
101__pattern_transform_scan(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _OutputIterator,
102 _UnaryOperation, _Tp, _BinaryOperation, _Inclusive, _IsVector, /*is_parallel=*/std::true_type);
103
104template <class _ExecutionPolicy, class _RandomAccessIterator, class _OutputIterator, class _UnaryOperation, class _Tp,
105 class _BinaryOperation, class _Inclusive, class _IsVector>
106typename std::enable_if<std::is_floating_point<_Tp>::value, _OutputIterator>::type
107__pattern_transform_scan(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _OutputIterator,
108 _UnaryOperation, _Tp, _BinaryOperation, _Inclusive, _IsVector, /*is_parallel=*/std::true_type);
109
110//------------------------------------------------------------------------
111// adjacent_difference
112//------------------------------------------------------------------------
113
114template <class _ForwardIterator, class _OutputIterator, class _BinaryOperation>
115_OutputIterator __brick_adjacent_difference(_ForwardIterator, _ForwardIterator, _OutputIterator, _BinaryOperation,
116 /*is_vector*/ std::false_type) noexcept;
117
118template <class _ForwardIterator, class _OutputIterator, class _BinaryOperation>
119_OutputIterator __brick_adjacent_difference(_ForwardIterator, _ForwardIterator, _OutputIterator, _BinaryOperation,
120 /*is_vector*/ std::true_type) noexcept;
121
122template <class _ExecutionPolicy, class _ForwardIterator, class _OutputIterator, class _BinaryOperation,
123 class _IsVector>
124_OutputIterator
125__pattern_adjacent_difference(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _OutputIterator, _BinaryOperation,
126 _IsVector, /*is_parallel*/ std::false_type) noexcept;
127
128template <class _ExecutionPolicy, class _ForwardIterator, class _OutputIterator, class _BinaryOperation,
129 class _IsVector>
130_OutputIterator
131__pattern_adjacent_difference(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _OutputIterator, _BinaryOperation,
132 _IsVector, /*is_parallel*/ std::true_type);
133
134} // namespace __internal
135} // namespace __pstl
136#endif /* _PSTL_NUMERIC_FWD_H */
137

source code of include/c++/11/pstl/numeric_fwd.h