Basic functions

template<class T, class A>
batch<T, A> xsimd::abs(batch<T, A> const &x)

Computes the absolute values of each scalar in the batch x.

Return
the absolute values of x.
Parameters
  • x: batch of integer or floating point values.

template<class T, class A>
batch<T, A> xsimd::fabs(batch<T, A> const &x)

Computes the absolute values of each scalar in the batch x.

Return
the absolute values of x.
Parameters
  • x: batch floating point values.

template<class T, class A>
batch<T, A> xsimd::fmod(batch<T, A> const &x, batch<T, A> const &y)

Computes the modulo of the batch x by the batch y.

Return
the result of the modulo.
Parameters
  • x: batch involved in the modulo.
  • y: batch involved in the modulo.

template<class T, class A>
batch<T, A> xsimd::remainder(batch<T, A> const &x, batch<T, A> const &y)

Computes the remainder of dividing x by y.

Return
the result of the addition.
Parameters
  • x: batch of scalar values
  • y: batch of scalar values

template<class T, class A>
batch<T, A> xsimd::fma(batch<T, A> const &x, batch<T, A> const &y, batch<T, A> const &z)

Computes (x*y) + z in a single instruction when possible.

Return
the result of the fused multiply-add operation.
Parameters
  • x: a batch of integer or floating point values.
  • y: a batch of integer or floating point values.
  • z: a batch of integer or floating point values.

template<class T, class A>
batch<T, A> xsimd::fms(batch<T, A> const &x, batch<T, A> const &y, batch<T, A> const &z)

Computes (x*y) - z in a single instruction when possible.

Return
the result of the fused multiply-sub operation.
Parameters
  • x: a batch of integer or floating point values.
  • y: a batch of integer or floating point values.
  • z: a batch of integer or floating point values.

template<class T, class A>
batch<T, A> xsimd::fnma(batch<T, A> const &x, batch<T, A> const &y, batch<T, A> const &z)

Computes -(x*y) + z in a single instruction when possible.

Return
the result of the fused negated multiply-add operation.
Parameters
  • x: a batch of integer or floating point values.
  • y: a batch of integer or floating point values.
  • z: a batch of integer or floating point values.

template<class T, class A>
batch<T, A> xsimd::fnms(batch<T, A> const &x, batch<T, A> const &y, batch<T, A> const &z)

Computes -(x*y) - z in a single instruction when possible.

Return
the result of the fused negated multiply-sub operation.
Parameters
  • x: a batch of integer or floating point values.
  • y: a batch of integer or floating point values.
  • z: a batch of integer or floating point values.

template<class T, class A>
batch<T, A> xsimd::min(batch<T, A> const &x, batch<T, A> const &y)

Computes the smaller values of the batches x and y.

Return
a batch of the smaller values.
Parameters
  • x: a batch of integer or floating point values.
  • y: a batch of integer or floating point values.

template<class T, class A>
batch<T, A> xsimd::max(batch<T, A> const &x, batch<T, A> const &y)

Computes the larger values of the batches x and y.

Return
a batch of the larger values.
Parameters
  • x: a batch of integer or floating point values.
  • y: a batch of integer or floating point values.

template<class T, class A>
batch<T, A> xsimd::fmin(batch<T, A> const &x, batch<T, A> const &y)

Computes the smaller values of the batches x and y.

Return
a batch of the smaller values.
Parameters
  • x: a batch of integer or floating point values.
  • y: a batch of integer or floating point values.

template<class T, class A>
batch<T, A> xsimd::fmax(batch<T, A> const &x, batch<T, A> const &y)

Computes the larger values of the batches x and y.

Return
a batch of the larger values.
Parameters
  • x: a batch of integer or floating point values.
  • y: a batch of integer or floating point values.

template<class T, class A>
batch<T, A> xsimd::fdim(batch<T, A> const &x, batch<T, A> const &y)

Computes the positive difference between x and y, that is, max(0, x-y).

Return
the positive difference.
Parameters
  • x: batch of floating point values.
  • y: batch of floating point values.

template<class T, class A>
batch<T, A> xsimd::sadd(batch<T, A> const &x, batch<T, A> const &y)

Computes the saturate sum of the batch x and the batch y.

Return
the result of the saturated addition.
Template Parameters
  • X: the actual type of batch.
Parameters
  • x: batch involved in the saturated addition.
  • y: batch involved in the saturated addition.

template<class T, class A>
batch<T, A> xsimd::ssub(batch<T, A> const &x, batch<T, A> const &y)

Computes the saturate difference of the batch x and the batch y.

Return
the result of the saturated difference.
Template Parameters
  • X: the actual type of batch.
Parameters
  • x: batch involved in the saturated difference.
  • y: batch involved in the saturated difference.

template<class T, class A>
batch<T, A> xsimd::clip(batch<T, A> const &x, batch<T, A> const &lo, batch<T, A> const &hi)

Clips the values of the batch x between those of the batches lo and hi.

Return
the result of the clipping.
Parameters
  • x: batch of scalar values.
  • lo: batch of scalar values.
  • hi: batch of scalar values.