Conditional expressionΒΆ

select conditonal selection
template <class T, class A>
batch<T, A> xsimd::select(batch_bool<T, A> const &cond, batch<T, A> const &true_br, batch<T, A> const &false_br)

Ternary operator for batches: 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];
Return
the result of the selection.
Parameters
  • cond: constant batch condition.
  • true_br: batch values for truthy condition.
  • false_br: batch value for falsy condition.