40#include "../util_macro.cuh"
41#include "../util_type.cuh"
42#include "../util_namespace.cuh"
63 __host__ __device__ __forceinline__
bool operator()(
const T &a,
const T &b)
const
77 __host__ __device__ __forceinline__
bool operator()(
const T &a,
const T &b)
const
87template <
typename EqualityOp>
94 __host__ __device__ __forceinline__
99 __host__ __device__ __forceinline__
bool operator()(
const T &a,
const T &b)
112 template <
typename T>
113 __host__ __device__ __forceinline__ T
operator()(
const T &a,
const T &b)
const
126 template <
typename T>
127 __host__ __device__ __forceinline__ T
operator()(
const T &a,
const T &b)
const
140 template <
typename T,
typename OffsetT>
148 if ((b.value > a.value) || ((a.value == b.value) && (b.key < a.key)))
161 template <
typename T>
162 __host__ __device__ __forceinline__ T
operator()(
const T &a,
const T &b)
const
175 template <
typename T,
typename OffsetT>
183 if ((b.value < a.value) || ((a.value == b.value) && (b.key < a.key)))
197 template <
typename A>
198 __host__ __device__ __forceinline__ B
operator()(
const A &a)
const
208template <
typename ScanOp>
219 __host__ __device__ __forceinline__
223 template <
typename T>
224 __host__ __device__ __forceinline__
251template <
typename ReductionOpT>
264 template <
typename KeyValuePairT>
265 __host__ __device__ __forceinline__ KeyValuePairT
operator()(
266 const KeyValuePairT &first,
267 const KeyValuePairT &second)
269 KeyValuePairT retval;
270 retval.key = first.key + second.key;
271 retval.value = (second.key) ?
273 op(first.value, second.value);
280template <
typename ReductionOpT>
293 template <
typename KeyValuePairT>
294 __host__ __device__ __forceinline__ KeyValuePairT
operator()(
295 const KeyValuePairT &first,
296 const KeyValuePairT &second)
298 KeyValuePairT retval = second;
300 if (first.key == second.key)
301 retval.value =
op(first.value, retval.value);
Binary operator wrapper for switching non-commutative scan arguments.
ScanOp scan_op
Wrapped scan operator.
__host__ __device__ __forceinline__ T operator()(const T &a, const T &b)
Switch the scan arguments.
__host__ __device__ __forceinline__ SwizzleScanOp(ScanOp scan_op)
Constructor.
#define CUB_MAX(a, b)
Select maximum(a, b)
#define CUB_MIN(a, b)
Select minimum(a, b)
Optional outer namespace(s)
Arg max functor (keeps the value and offset of the first occurrence of the larger item)
__host__ __device__ __forceinline__ KeyValuePair< OffsetT, T > operator()(const KeyValuePair< OffsetT, T > &a, const KeyValuePair< OffsetT, T > &b) const
Boolean max operator, preferring the item having the smaller offset in case of ties.
Arg min functor (keeps the value and offset of the first occurrence of the smallest item)
__host__ __device__ __forceinline__ KeyValuePair< OffsetT, T > operator()(const KeyValuePair< OffsetT, T > &a, const KeyValuePair< OffsetT, T > &b) const
Boolean min operator, preferring the item having the smaller offset in case of ties.
__host__ __device__ __forceinline__ B operator()(const A &a) const
Cast operator, returns (B) a
Default equality functor.
__host__ __device__ __forceinline__ bool operator()(const T &a, const T &b) const
Boolean equality operator, returns (a == b)
Inequality functor (wraps equality functor)
EqualityOp op
Wrapped equality operator.
__host__ __device__ __forceinline__ InequalityWrapper(EqualityOp op)
Constructor.
__host__ __device__ __forceinline__ bool operator()(const T &a, const T &b)
Boolean inequality operator, returns (a != b)
Default inequality functor.
__host__ __device__ __forceinline__ bool operator()(const T &a, const T &b) const
Boolean inequality operator, returns (a != b)
A key identifier paired with a corresponding value.
__host__ __device__ __forceinline__ T operator()(const T &a, const T &b) const
Boolean max operator, returns (a > b) ? a : b
__host__ __device__ __forceinline__ T operator()(const T &a, const T &b) const
Boolean min operator, returns (a < b) ? a : b
< Binary reduction operator to apply to values
ReductionOpT op
Wrapped reduction operator.
__host__ __device__ __forceinline__ ReduceByKeyOp()
Constructor.
__host__ __device__ __forceinline__ ReduceByKeyOp(ReductionOpT op)
Constructor.
__host__ __device__ __forceinline__ KeyValuePairT operator()(const KeyValuePairT &first, const KeyValuePairT &second)
Scan operator.
Reduce-by-segment functor.
ReductionOpT op
Wrapped reduction operator.
__host__ __device__ __forceinline__ ReduceBySegmentOp()
Constructor.
__host__ __device__ __forceinline__ ReduceBySegmentOp(ReductionOpT op)
Constructor.
__host__ __device__ __forceinline__ KeyValuePairT operator()(const KeyValuePairT &first, const KeyValuePairT &second)
Scan operator.
__host__ __device__ __forceinline__ T operator()(const T &a, const T &b) const
Boolean sum operator, returns a + b