Batch of Constants

template<typename T, class A, T... Values>
struct batch_constant

batch of integral constants

Abstract representation of a batch of integral constants.

Template Parameters:
  • batch_type – the type of the associated batch values.

  • Values – constants represented by this batch

Public Functions

inline batch_type as_batch() const noexcept

Generate a batch of batch_type from this batch_constant.

inline operator batch_type() const noexcept

Generate a batch of batch_type from this batch_constant.

inline T get(std::size_t i) const noexcept

Get the i th element of this batch_constant.

template<typename T, class A, bool... Values>
struct batch_bool_constant

batch of boolean constant

Abstract representation of a batch of boolean constants.

Template Parameters:
  • batch_type – the type of the associated batch values.

  • Values – boolean constant represented by this batch

Public Functions

inline batch_type as_batch_bool() const noexcept

Generate a batch of batch_type from this batch_bool_constant.

inline batch<as_integer_t<T>, A> as_batch() const noexcept

Generate a batch of integers from this batch_bool_constant.

inline constexpr operator batch_type() const noexcept

Generate a batch of batch_type from this batch_bool_constant.

template<typename T, class G, class A = default_arch>
inline decltype(detail::make_batch_constant<T, G, A>(std::make_index_sequence<batch<T, A>::size>())) xsimd::make_batch_constant() noexcept

Build a batch_constant out of a generator function.

The following generator produces a batch of (n - 1, 0, 1, ... n-2)

struct Rot
{
    static constexpr unsigned get(unsigned i, unsigned n)
    {
        return (i + n - 1) % n;
    }
};
Template Parameters:
  • batch_type – type of the (non-constant) batch to build

  • G – type used to generate that batch. That type must have a static member get that’s used to generate the batch constant. Conversely, the generated batch_constant has value {G::get(0, batch_size), ... , G::get(batch_size - 1, batch_size)}

template<typename T, class G, class A = default_arch>
inline decltype(detail::make_batch_bool_constant<T, G, A>(std::make_index_sequence<batch<T, A>::size>())) xsimd::make_batch_bool_constant() noexcept

Build a batch_bool_constant out of a generator function.

Similar to make_batch_constant for batch_bool_constant

Note

make_batch_constant() and make_batch_bool_constant() also accept a scalar value instead of a generator. In that case, that value is broadcast to each slot of the constant batch.