Comparison operators

Ordering:

eq()

per slot equals to comparison

neq()

per slot different from comparison

gt()

per slot strictly greater than comparison

lt()

per slot strictly lower than comparison

ge()

per slot greater or equal to comparison

le()

per slot lower or equal to comparison

Parity check:

is_even()

per slot check for evenness

is_odd()

per slot check for oddness

Floating point number check:

isinf()

per slot check for infinity

isnan()

per slot check for NaN

isfinite()

per slot check for finite number

is_flint()

per slot check for float representing an integer


template<class T, class A>
XSIMD_INLINE auto eq(batch<T, A> const &x, batch<T, A> const &y) noexcept -> decltype(x == y)

Element-wise equality comparison of batches x and y.

Parameters:
  • x – batch of scalars

  • y – batch of scalars

Returns:

a boolean batch.

template<class T, class A>
XSIMD_INLINE auto eq(batch_bool<T, A> const &x, batch_bool<T, A> const &y) noexcept -> decltype(x == y)

Element-wise equality comparison of batches of boolean values x and y.

Parameters:
  • x – batch of booleans involved in the comparison.

  • y – batch of booleans involved in the comparison.

Returns:

a boolean batch.

template<class T, class A> XSIMD_INLINE batch_bool< T, A > ge (batch< T, A > const &x, batch< T, A > const &y) noexcept

Element-wise greater or equal comparison of batches x and y.

Template Parameters:

X – the actual type of batch.

Parameters:
  • x – batch involved in the comparison.

  • y – batch involved in the comparison.

Returns:

a boolean batch.

template<class T, class A> XSIMD_INLINE batch_bool< T, A > gt (batch< T, A > const &x, batch< T, A > const &y) noexcept

Element-wise greater than comparison of batches x and y.

Template Parameters:

X – the actual type of batch.

Parameters:
  • x – batch involved in the comparison.

  • y – batch involved in the comparison.

Returns:

a boolean batch.

template<class T, class A> XSIMD_INLINE batch_bool< T, A > is_even (batch< T, A > const &x) noexcept

Determines if the scalars in the given batch x represent an even integer value.

Parameters:

x – batch of floating point values.

Returns:

a batch of booleans.

template<class T, class A> XSIMD_INLINE batch_bool< T, A > is_flint (batch< T, A > const &x) noexcept

Determines if the floating-point scalars in the given batch x represent integer value.

Parameters:

x – batch of floating point values.

Returns:

a batch of booleans.

template<class T, class A> XSIMD_INLINE batch_bool< T, A > is_odd (batch< T, A > const &x) noexcept

Determines if the scalars in the given batch x represent an odd integer value.

Parameters:

x – batch of floating point values.

Returns:

a batch of booleans.

template<class T, class A> XSIMD_INLINE batch< T, A >::batch_bool_type isinf (batch< T, A > const &x) noexcept

Determines if the scalars in the given batch x are inf values.

Parameters:

x – batch of floating point values.

Returns:

a batch of booleans.

template<class T, class A> XSIMD_INLINE batch< T, A >::batch_bool_type isfinite (batch< T, A > const &x) noexcept

Determines if the scalars in the given batch x are finite values.

Parameters:

x – batch of floating point values.

Returns:

a batch of booleans.

template<class T, class A> XSIMD_INLINE batch< T, A >::batch_bool_type isnan (batch< T, A > const &x) noexcept

Determines if the scalars in the given batch x are NaN values.

Parameters:

x – batch of floating point values.

Returns:

a batch of booleans.

template<class T, class A> XSIMD_INLINE batch_bool< T, A > le (batch< T, A > const &x, batch< T, A > const &y) noexcept

Element-wise lesser or equal to comparison of batches x and y.

Parameters:
  • x – batch involved in the comparison.

  • y – batch involved in the comparison.

Returns:

a boolean batch.

template<class T, class A> XSIMD_INLINE batch_bool< T, A > lt (batch< T, A > const &x, batch< T, A > const &y) noexcept

Element-wise lesser than comparison of batches x and y.

Parameters:
  • x – batch involved in the comparison.

  • y – batch involved in the comparison.

Returns:

a boolean batch.

template<class T, class A>
XSIMD_INLINE auto neq(batch<T, A> const &x, batch<T, A> const &y) noexcept -> decltype(x != y)

Element-wise inequality comparison of batches x and y.

Parameters:
  • x – batch involved in the comparison.

  • y – batch involved in the comparison.

Returns:

a boolean batch.

template<class T, class A>
XSIMD_INLINE auto neq(batch_bool<T, A> const &x, batch_bool<T, A> const &y) noexcept -> decltype(x != y)

Element-wise inequality comparison of batches of boolean values x and y.

Parameters:
  • x – batch of booleans involved in the comparison.

  • y – batch of booleans involved in the comparison.

Returns:

a boolean batch.