BAnd¶
Specific implementation of ReducerConcept performing bitwise AND operation
Header File: <Kokkos_Core.hpp>
Usage¶
T result;
parallel_reduce(N, Functor, BAnd<T, S>(result));
Synopsis¶
template<class Scalar, class Space>
class BAnd {
public:
using reducer = BAnd<Scalar, Space>;
using value_type = typename std::remove_cv<Scalar>::type;
KOKKOS_INLINE_FUNCTION
void join(value_type& dest, const value_type& src) const {
dest = dest & src;
}
KOKKOS_INLINE_FUNCTION
void init(value_type& val) const {
val = Kokkos::reduction_identity<value_type>::band();
}
// other members to fulfill the ReducerConcept
};
Interface¶
All the public types, constructors and methods from ReducerConcept are available. The following types and methods are overridden by this reducer:
-
template<class Scalar, class Space>
class BAnd¶ Public Types
-
type reducer¶
The self type.
-
type value_type¶
The
Scalartemplate parameter stripped of its potentialconstand/orvolatilequalifier.
Public Member Functions
-
KOKKOS_INLINE_FUNCTION void join(value_type &dest, const value_type &src) const;¶
Store bitwise
andofsrcanddestintodest:dest = src & dest.
-
KOKKOS_INLINE_FUNCTION void init(value_type &val) const;¶
Initialize
valusing theKokkos::reduction_identity<value_type>::band()method. The default implementation setsval=~(0x0).
-
type reducer¶
Additional Information¶
Requires:
value_typehasoperator =andoperator &defined.Kokkos::reduction_identity<value_type>::band()is a valid expression.In order to use
BAndwith a custom type, a template specialization ofKokkos::reduction_identity<CustomType>must be defined. See Built-In Reducers with Custom Scalar Types for details