# Batch of Conditions

template<class T, class A = default_arch>
class batch_bool : public types::get_bool_simd_register_t<T, default_arch>

  batch of predicate over scalar or complex values.

  Abstract representation of a predicate over SIMD register for scalar or complex values.

  Template Parameters:

    - T – the type of the predicated values.

    - A – the architecture this batch is tied too.

  Public Types

  using value_type = bool

    Type of the scalar elements within this batch.

  using arch_type = A

    SIMD Architecture abstracted by this batch.

  using register_type = typename base_type::register_type

    SIMD register type abstracted by this batch.

  using batch_type = batch<T, A>

    Associated batch type this batch represents logical operations for.

  Public Functions

  inline batch_bool() = default

    Create a batch initialized with undefined values.

  inline uint64_t mask() const noexcept

    Extract a scalar mask representation from this `batch_bool`.

    Returns:

      bit mask

  Public Static Functions

  static inline batch_bool from_mask(uint64_t mask) noexcept

    Extract a scalar mask representation from this `batch_bool`.

    Returns:

      bit mask

  Public Static Attributes

  static std::size_t size = sizeof(types::simd_register<T, A>) / sizeof(T)

    Number of scalar elements in this batch.

## Logical Operators

template<class T, class A>
inline batch_bool<T, A> bitwise_andnot(batch_bool<T, A> const &x, batch_bool<T, A> const &y) noexcept

  Computes the bitwise and not of batches `x` and `y`.

  Parameters:

    - x – batch involved in the operation.

    - y – batch involved in the operation.

  Returns:

    the result of the bitwise and not.

template<class T, class A>
inline batch_bool<T, A> select(batch_bool<T, A> const &cond, batch_bool<T, A> const &true_br, batch_bool<T, A> const &false_br) noexcept

  Ternary operator for conditions: selects values from the batches `true_br` or `false_br` depending on the boolean values in the constant batch `cond`.

  Equivalent to

      for(std::size_t i = 0; i < N; ++i)
          res[i] = cond[i] ? true_br[i] : false_br[i];

  Parameters:

    - cond – batch condition.

    - true_br – batch values for truthy condition.

    - false_br – batch value for falsy condition.

  Returns:

    the result of the selection.

## Reducers

template<class T, class A>
inline size_t count(batch_bool<T, A> const &x) noexcept

  Count the number of values set to true in the batch `x`.

  Parameters:

    x – boolean or batch of boolean

  Returns:

    the result of the counting.

template<class T, class A>
inline bool all(batch_bool<T, A> const &x) noexcept

  Returns true if all the boolean values in the batch are true, false otherwise.

  Parameters:

    x – the batch to reduce.

  Returns:

    a boolean scalar.

template<class T, class A>
inline bool any(batch_bool<T, A> const &x) noexcept

  Return true if any of the boolean values in the batch is true, false otherwise.

  Parameters:

    x – the batch to reduce.

  Returns:

    a boolean scalar.

template<class T, class A>
inline bool none(batch_bool<T, A> const &x) noexcept

  Return true if none of the boolean values in the batch is true, false otherwise.

  Parameters:

    x – the batch to reduce.

  Returns:

    a boolean scalar.