hpx/parallel/container_algorithms/exclusive_scan.hpp¶
See Public API for a list of names and headers that are part of the public HPX API.
-
namespace
hpx
-
namespace
ranges
Functions
-
template<typename
InIter
, typenameSent
, typenameOutIter
, typenameT
>
exclusive_scan_result<InIter, OutIter>exclusive_scan
(InIter first, Sent last, OutIter dest, T init)¶ Assigns through each iterator i in [result, result + (last - first)) the value of GENERALIZED_NONCOMMUTATIVE_SUM(+, init, *first, …, *(first + (i - result) - 1))
The reduce operations in the parallel
exclusive_scan algorithm invoked without an execution policy object will execute in sequential order in the calling thread.- Note
Complexity: O(last - first) applications of the predicate std::plus<T>.
- Template Parameters
InIter
: The type of the source iterators used (deduced). This iterator type must meet the requirements of an input iterator.Sent
: The type of the source sentinel (deduced). This sentinel type must be a sentinel for InIter.OutIter
: The type of the iterator representing the destination range (deduced). This iterator type must meet the requirements of an output iterator.T
: The type of the value to be used as initial (and intermediate) values (deduced).
- Parameters
first
: Refers to the beginning of the sequence of elements the algorithm will be applied to.last
: Refers to sentinel value denoting the end of the sequence of elements the algorithm will be applied.dest
: Refers to the beginning of the destination range.init
: The initial value for the generalized sum.
The difference between
exclusive_scan and inclusive_scan is that inclusive_scan includes the ith input element in the ith sum.- Return
The exclusive_scan algorithm returns util::in_out_result<InIter, OutIter>. The exclusive_scan algorithm returns an input iterator to the point denoted by the sentinel and an output iterator to the element in the destination range, one past the last element copied.
- Note
GENERALIZED_NONCOMMUTATIVE_SUM(+, a1, …, aN) is defined as:
a1 when N is 1
GENERALIZED_NONCOMMUTATIVE_SUM(+, a1, …, aK)
GENERALIZED_NONCOMMUTATIVE_SUM(+, aM, …, aN) where 1 < K+1 = M <= N.
-
template<typename
ExPolicy
, typenameFwdIter1
, typenameSent
, typenameFwdIter2
, typenameT
>
util::detail::algorithm_result<ExPolicy, exclusive_scan_result<FwdIter1, FwdIter2>>::typeexclusive_scan
(ExPolicy &&policy, FwdIter1 first, Sent last, FwdIter2 dest, T init)¶ Assigns through each iterator i in [result, result + (last - first)) the value of GENERALIZED_NONCOMMUTATIVE_SUM(+, init, *first, …, *(first + (i - result) - 1))
The reduce operations in the parallel
exclusive_scan algorithm invoked with an execution policy object of type sequenced_policy execute in sequential order in the calling thread.- Note
Complexity: O(last - first) applications of the predicate std::plus<T>.
- Template Parameters
ExPolicy
: The type of the execution policy to use (deduced). It describes the manner in which the execution of the algorithm may be parallelized and the manner in which it executes the assignments.FwdIter1
: The type of the source iterators used (deduced). This iterator type must meet the requirements of an forward iterator.Sent
: The type of the source sentinel (deduced). This sentinel type must be a sentinel for FwdIter.FwdIter2
: The type of the iterator representing the destination range (deduced). This iterator type must meet the requirements of an forward iterator.T
: The type of the value to be used as initial (and intermediate) values (deduced).
- Parameters
policy
: The execution policy to use for the scheduling of the iterations.first
: Refers to the beginning of the sequence of elements the algorithm will be applied to.last
: Refers to sentinel value denoting the end of the sequence of elements the algorithm will be applied.dest
: Refers to the beginning of the destination range.init
: The initial value for the generalized sum.
The reduce operations in the parallel exclusive_scan algorithm invoked with an execution policy object of type parallel_policy or parallel_task_policy are permitted to execute in an unordered fashion in unspecified threads, and indeterminately sequenced within each thread.
The difference between
exclusive_scan and inclusive_scan is that inclusive_scan includes the ith input element in the ith sum.- Return
The exclusive_scan algorithm returns a hpx::future<util::in_out_result<FwdIter1, FwdIter2>> if the execution policy is of type sequenced_task_policy or parallel_task_policy and returns util::in_out_result<FwdIter1, FwdIter2> otherwise. The exclusive_scan algorithm returns an input iterator to the point denoted by the sentinel and an output iterator to the element in the destination range, one past the last element copied.
- Note
GENERALIZED_NONCOMMUTATIVE_SUM(+, a1, …, aN) is defined as:
a1 when N is 1
GENERALIZED_NONCOMMUTATIVE_SUM(+, a1, …, aK)
GENERALIZED_NONCOMMUTATIVE_SUM(+, aM, …, aN) where 1 < K+1 = M <= N.
-
template<typename
InIter
, typenameSent
, typenameOutIter
, typenameT
, typenameOp
>
exclusive_scan_result<InIter, OutIter>exclusive_scan
(InIter first, Sent last, OutIter dest, T init, Op &&op)¶ Assigns through each iterator i in [result, result + (last - first)) the value of GENERALIZED_NONCOMMUTATIVE_SUM(binary_op, init, *first, …, *(first + (i - result) - 1)).
The reduce operations in the parallel
exclusive_scan algorithm invoked without an execution policy object will execute in sequential order in the calling thread.- Note
Complexity: O(last - first) applications of the predicate op.
- Template Parameters
InIter
: The type of the source iterators used (deduced). This iterator type must meet the requirements of an input iterator.Sent
: The type of the source sentinel (deduced). This sentinel type must be a sentinel for InIter.OutIter
: The type of the iterator representing the destination range (deduced). This iterator type must meet the requirements of an output iterator.T
: The type of the value to be used as initial (and intermediate) values (deduced).Op
: The type of the binary function object used for the reduction operation.
- Parameters
first
: Refers to the beginning of the sequence of elements the algorithm will be applied to.last
: Refers to sentinel value denoting the end of the sequence of elements the algorithm will be applied.dest
: Refers to the beginning of the destination range.init
: The initial value for the generalized sum.op
: Specifies the function (or function object) which will be invoked for each of the values of the input sequence. This is a binary predicate. The signature of this predicate should be equivalent to:Ret fun(const Type1 &a, const Type1 &b);
The signature does not need to have const&, but the function must not modify the objects passed to it. The types
Type1 and Ret must be such that an object of a type as given by the input sequence can be implicitly converted to any of those types.
The difference between
exclusive_scan and inclusive_scan is that inclusive_scan includes the ith input element in the ith sum. If op is not mathematically associative, the behavior of inclusive_scan may be non-deterministic.- Return
The exclusive_scan algorithm returns util::in_out_result<InIter, OutIter>. The exclusive_scan algorithm returns an input iterator to the point denoted by the sentinel and an output iterator to the element in the destination range, one past the last element copied.
- Note
GENERALIZED_NONCOMMUTATIVE_SUM(op, a1, …, aN) is defined as:
a1 when N is 1
op(GENERALIZED_NONCOMMUTATIVE_SUM(op, a1, …, aK), GENERALIZED_NONCOMMUTATIVE_SUM(op, aM, …, aN)) where 1 < K+1 = M <= N.
-
template<typename
ExPolicy
, typenameFwdIter1
, typenameSent
, typenameFwdIter2
, typenameT
, typenameOp
>
util::detail::algorithm_result<ExPolicy, exclusive_scan_result<FwdIter1, FwdIter2>>::typeexclusive_scan
(ExPolicy &&policy, FwdIter1 first, Sent last, FwdIter2 dest, T init, Op &&op)¶ Assigns through each iterator i in [result, result + (last - first)) the value of GENERALIZED_NONCOMMUTATIVE_SUM(binary_op, init, *first, …, *(first + (i - result) - 1)).
The reduce operations in the parallel
exclusive_scan algorithm invoked with an execution policy object of type sequenced_policy execute in sequential order in the calling thread.- Note
Complexity: O(last - first) applications of the predicate op.
- Template Parameters
ExPolicy
: The type of the execution policy to use (deduced). It describes the manner in which the execution of the algorithm may be parallelized and the manner in which it executes the assignments.FwdIter1
: The type of the source iterators used (deduced). This iterator type must meet the requirements of an forward iterator.Sent
: The type of the source sentinel (deduced). This sentinel type must be a sentinel for FwdIter1.FwdIter2
: The type of the iterator representing the destination range (deduced). This iterator type must meet the requirements of an forward iterator.T
: The type of the value to be used as initial (and intermediate) values (deduced).Op
: The type of the binary function object used for the reduction operation.
- Parameters
policy
: The execution policy to use for the scheduling of the iterations.first
: Refers to the beginning of the sequence of elements the algorithm will be applied to.last
: Refers to sentinel value denoting the end of the sequence of elements the algorithm will be applied.dest
: Refers to the beginning of the destination range.init
: The initial value for the generalized sum.op
: Specifies the function (or function object) which will be invoked for each of the values of the input sequence. This is a binary predicate. The signature of this predicate should be equivalent to:Ret fun(const Type1 &a, const Type1 &b);
The signature does not need to have const&, but the function must not modify the objects passed to it. The types
Type1 and Ret must be such that an object of a type as given by the input sequence can be implicitly converted to any of those types.
The reduce operations in the parallel exclusive_scan algorithm invoked with an execution policy object of type parallel_policy or parallel_task_policy are permitted to execute in an unordered fashion in unspecified threads, and indeterminately sequenced within each thread.
The difference between
exclusive_scan and inclusive_scan is that inclusive_scan includes the ith input element in the ith sum. If op is not mathematically associative, the behavior of inclusive_scan may be non-deterministic.- Return
The exclusive_scan algorithm returns a hpx::future<util::in_out_result<FwdIter1, FwdIter2>> if the execution policy is of type sequenced_task_policy or parallel_task_policy and returns util::in_out_result<FwdIter1, FwdIter2> otherwise. The exclusive_scan algorithm returns an input iterator to the point denoted by the sentinel and an output iterator to the element in the destination range, one past the last element copied.
- Note
GENERALIZED_NONCOMMUTATIVE_SUM(op, a1, …, aN) is defined as:
a1 when N is 1
op(GENERALIZED_NONCOMMUTATIVE_SUM(op, a1, …, aK), GENERALIZED_NONCOMMUTATIVE_SUM(op, aM, …, aN)) where 1 < K+1 = M <= N.
-
template<typename
Rng
, typenameO
, typenameT
>
exclusive_scan_result<traits::range_iterator_t<Rng>, O>exclusive_scan
(Rng &&rng, O dest, T init)¶ Assigns through each iterator i in [result, result + (last - first)) the value of GENERALIZED_NONCOMMUTATIVE_SUM(+, init, *first, …, *(first + (i - result) - 1))
The reduce operations in the parallel
exclusive_scan algorithm invoked without an execution policy object will execute in sequential order in the calling thread.- Note
Complexity: O(last - first) applications of the predicate std::plus<T>.
- Template Parameters
Rng
: The type of the source range used (deduced). The iterators extracted from this range type must meet the requirements of an input iterator.O
: The type of the iterator representing the destination range (deduced). This iterator type must meet the requirements of an output iterator.T
: The type of the value to be used as initial (and intermediate) values (deduced).
- Parameters
rng
: Refers to the sequence of elements the algorithm will be applied to.dest
: Refers to the beginning of the destination range.init
: The initial value for the generalized sum.
The difference between
exclusive_scan and inclusive_scan is that inclusive_scan includes the ith input element in the ith sum.- Return
The exclusive_scan algorithm returns util::in_out_result<traits::range_iterator_t<Rng>, O> The exclusive_scan algorithm returns an input iterator to the point denoted by the sentinel and an output iterator to the element in the destination range, one past the last element copied.
- Note
GENERALIZED_NONCOMMUTATIVE_SUM(+, a1, …, aN) is defined as:
a1 when N is 1
GENERALIZED_NONCOMMUTATIVE_SUM(+, a1, …, aK)
GENERALIZED_NONCOMMUTATIVE_SUM(+, aM, …, aN) where 1 < K+1 = M <= N.
-
template<typename
ExPolicy
, typenameRng
, typenameO
, typenameT
>
util::detail::algorithm_result<ExPolicy, exclusive_scan_result<traits::range_iterator_t<Rng>, O>>::typeexclusive_scan
(ExPolicy &&policy, Rng &&rng, O dest, T init)¶ Assigns through each iterator i in [result, result + (last - first)) the value of GENERALIZED_NONCOMMUTATIVE_SUM(+, init, *first, …, *(first + (i - result) - 1))
The reduce operations in the parallel
exclusive_scan algorithm invoked with an execution policy object of type sequenced_policy execute in sequential order in the calling thread.- Note
Complexity: O(last - first) applications of the predicate std::plus<T>.
- Template Parameters
ExPolicy
: The type of the execution policy to use (deduced). It describes the manner in which the execution of the algorithm may be parallelized and the manner in which it executes the assignments.Rng
: The type of the source range used (deduced). The iterators extracted from this range type must meet the requirements of an forward iterator.O
: The type of the iterator representing the destination range (deduced). This iterator type must meet the requirements of an forward iterator.T
: The type of the value to be used as initial (and intermediate) values (deduced).
- Parameters
policy
: The execution policy to use for the scheduling of the iterations.rng
: Refers to the sequence of elements the algorithm will be applied to.dest
: Refers to the beginning of the destination range.init
: The initial value for the generalized sum.
The reduce operations in the parallel exclusive_scan algorithm invoked with an execution policy object of type parallel_policy or parallel_task_policy are permitted to execute in an unordered fashion in unspecified threads, and indeterminately sequenced within each thread.
The difference between
exclusive_scan and inclusive_scan is that inclusive_scan includes the ith input element in the ith sum.- Return
The exclusive_scan algorithm returns a hpx::future<util::in_out_result <traits::range_iterator_t<Rng>, O>> if the execution policy is of type sequenced_task_policy or parallel_task_policy and returns util::in_out_result <traits::range_iterator_t<Rng>, O> otherwise. The exclusive_scan algorithm returns an input iterator to the point denoted by the sentinel and an output iterator to the element in the destination range, one past the last element copied.
- Note
GENERALIZED_NONCOMMUTATIVE_SUM(+, a1, …, aN) is defined as:
a1 when N is 1
GENERALIZED_NONCOMMUTATIVE_SUM(+, a1, …, aK)
GENERALIZED_NONCOMMUTATIVE_SUM(+, aM, …, aN) where 1 < K+1 = M <= N.
-
template<typename
Rng
, typenameO
, typenameT
, typenameOp
>
exclusive_scan_result<traits::range_iterator_t<Rng>, O>exclusive_scan
(Rng &&rng, O dest, T init, Op &&op)¶ Assigns through each iterator i in [result, result + (last - first)) the value of GENERALIZED_NONCOMMUTATIVE_SUM(+, init, *first, …, *(first + (i - result) - 1))
The reduce operations in the parallel
exclusive_scan algorithm invoked without an execution policy object will execute in sequential order in the calling thread.- Note
Complexity: O(last - first) applications of the predicate std::plus<T>.
- Template Parameters
Rng
: The type of the source range used (deduced). The iterators extracted from this range type must meet the requirements of an input iterator.O
: The type of the iterator representing the destination range (deduced). This iterator type must meet the requirements of an output iterator.T
: The type of the value to be used as initial (and intermediate) values (deduced).Op
: The type of the binary function object used for the reduction operation.
- Parameters
rng
: Refers to the sequence of elements the algorithm will be applied to.dest
: Refers to the beginning of the destination range.init
: The initial value for the generalized sum.op
: Specifies the function (or function object) which will be invoked for each of the values of the input sequence. This is a binary predicate. The signature of this predicate should be equivalent to:Ret fun(const Type1 &a, const Type1 &b);
The signature does not need to have const&, but the function must not modify the objects passed to it. The types
Type1 and Ret must be such that an object of a type as given by the input sequence can be implicitly converted to any of those types.
The difference between
exclusive_scan and inclusive_scan is that inclusive_scan includes the ith input element in the ith sum.- Return
The exclusive_scan algorithm returns util::in_out_result<traits::range_iterator_t<Rng>, O> The exclusive_scan algorithm returns an input iterator to the point denoted by the sentinel and an output iterator to the element in the destination range, one past the last element copied.
- Note
GENERALIZED_NONCOMMUTATIVE_SUM(+, a1, …, aN) is defined as:
a1 when N is 1
GENERALIZED_NONCOMMUTATIVE_SUM(+, a1, …, aK)
GENERALIZED_NONCOMMUTATIVE_SUM(+, aM, …, aN) where 1 < K+1 = M <= N.
-
template<typename
ExPolicy
, typenameRng
, typenameO
, typenameT
, typenameOp
>
util::detail::algorithm_result<ExPolicy, exclusive_scan_result<traits::range_iterator_t<Rng>, O>>::typeexclusive_scan
(ExPolicy &&policy, Rng &&rng, O dest, T init, Op &&op)¶ Assigns through each iterator i in [result, result + (last - first)) the value of GENERALIZED_NONCOMMUTATIVE_SUM(+, init, *first, …, *(first + (i - result) - 1))
The reduce operations in the parallel
exclusive_scan algorithm invoked with an execution policy object of type sequenced_policy execute in sequential order in the calling thread.- Note
Complexity: O(last - first) applications of the predicate std::plus<T>.
- Template Parameters
ExPolicy
: The type of the execution policy to use (deduced). It describes the manner in which the execution of the algorithm may be parallelized and the manner in which it executes the assignments.Rng
: The type of the source range used (deduced). The iterators extracted from this range type must meet the requirements of an forward iterator.O
: The type of the iterator representing the destination range (deduced). This iterator type must meet the requirements of an forward iterator.T
: The type of the value to be used as initial (and intermediate) values (deduced).Op
: The type of the binary function object used for the reduction operation.
- Parameters
policy
: The execution policy to use for the scheduling of the iterations.rng
: Refers to the sequence of elements the algorithm will be applied to.dest
: Refers to the beginning of the destination range.init
: The initial value for the generalized sum.op
: Specifies the function (or function object) which will be invoked for each of the values of the input sequence. This is a binary predicate. The signature of this predicate should be equivalent to:Ret fun(const Type1 &a, const Type1 &b);
The signature does not need to have const&, but the function must not modify the objects passed to it. The types
Type1 and Ret must be such that an object of a type as given by the input sequence can be implicitly converted to any of those types.
The reduce operations in the parallel exclusive_scan algorithm invoked with an execution policy object of type parallel_policy or parallel_task_policy are permitted to execute in an unordered fashion in unspecified threads, and indeterminately sequenced within each thread.
The difference between
exclusive_scan and inclusive_scan is that inclusive_scan includes the ith input element in the ith sum.- Return
The exclusive_scan algorithm returns a hpx::future<util::in_out_result <traits::range_iterator_t<Rng>, O>> if the execution policy is of type sequenced_task_policy or parallel_task_policy and returns util::in_out_result <traits::range_iterator_t<Rng>, O> otherwise. The exclusive_scan algorithm returns an input iterator to the point denoted by the sentinel and an output iterator to the element in the destination range, one past the last element copied.
- Note
GENERALIZED_NONCOMMUTATIVE_SUM(+, a1, …, aN) is defined as:
a1 when N is 1
GENERALIZED_NONCOMMUTATIVE_SUM(+, a1, …, aK)
GENERALIZED_NONCOMMUTATIVE_SUM(+, aM, …, aN) where 1 < K+1 = M <= N.
-
template<typename
-
namespace