cub::ReduceBySegmentOp
Defined in cub/thread/thread_operators.cuh
-
template<typename ReductionOpT>
struct ReduceBySegmentOp Reduce-by-segment functor.
Given two cub::KeyValuePair inputs
a
andb
and a binary associative combining operatorf(const T &x, const T &y)
, an instance of this functor returns a cub::KeyValuePair whosekey
field isa.key + b.key
, and whosevalue
field is eitherb.value
ifb.key
is non-zero, orf(a.value, b.value)
otherwise.ReduceBySegmentOp is an associative, non-commutative binary combining operator for input sequences of cub::KeyValuePair pairings. Such sequences are typically used to represent a segmented set of values to be reduced and a corresponding set of {0,1}-valued integer “head flags” demarcating the first value of each segment.
- Template Parameters
ReductionOpT – Binary reduction operator to apply to values
Public Functions
-
inline ReduceBySegmentOp()
Constructor.
-
inline ReduceBySegmentOp(ReductionOpT op)
Constructor.
-
template<typename KeyValuePairT>
inline KeyValuePairT operator()(const KeyValuePairT &first, const KeyValuePairT &second) Scan operator.
- Template Parameters
KeyValuePairT – KeyValuePair pairing of T (value) and OffsetT (head flag)
- Parameters
first – [in] First partial reduction
second – [in] Second partial reduction
Public Members
-
ReductionOpT op
Wrapped reduction operator.