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 Scalar template parameter stripped of its potential const and/or volatile qualifier.

Public Member Functions

KOKKOS_INLINE_FUNCTION void join(value_type &dest, const value_type &src) const;

Store bitwise and of src and dest into dest: dest = src & dest.

KOKKOS_INLINE_FUNCTION void init(value_type &val) const;

Initialize val using the Kokkos::reduction_identity<value_type>::band() method. The default implementation sets val=~(0x0).

Additional Information

  • Requires: value_type has operator = and operator & defined. Kokkos::reduction_identity<value_type>::band() is a valid expression.

  • In order to use BAnd with a custom type, a template specialization of Kokkos::reduction_identity<CustomType> must be defined. See Built-In Reducers with Custom Scalar Types for details