Basic functions¶
-
template<class T, class A>
inline batch<T, A> xsimd::abs(batch<T, A> const &x) noexcept¶ Computes the absolute values of each scalar in the batch
x
.- Parameters
x – batch of integer or floating point values.
- Returns
the absolute values of
x
.
-
template<class T, class A>
inline batch<T, A> xsimd::fabs(batch<T, A> const &x) noexcept¶ Computes the absolute values of each scalar in the batch
x
.- Parameters
x – batch floating point values.
- Returns
the absolute values of
x
.
-
template<class T, class A>
inline batch<T, A> xsimd::fmod(batch<T, A> const &x, batch<T, A> const &y) noexcept¶ Computes the modulo of the batch
x
by the batchy
.- Parameters
x – batch involved in the modulo.
y – batch involved in the modulo.
- Returns
the result of the modulo.
-
template<class T, class A>
inline batch<T, A> xsimd::remainder(batch<T, A> const &x, batch<T, A> const &y) noexcept¶ Computes the remainder of dividing
x
byy
.- Parameters
x – batch of scalar values
y – batch of scalar values
- Returns
the result of the addition.
-
template<class T, class A>
inline batch<T, A> xsimd::fma(batch<T, A> const &x, batch<T, A> const &y, batch<T, A> const &z) noexcept¶ Computes
(x*y) + z
in a single instruction when possible.- 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.
- Returns
the result of the fused multiply-add operation.
-
template<class T, class A>
inline batch<T, A> xsimd::fms(batch<T, A> const &x, batch<T, A> const &y, batch<T, A> const &z) noexcept¶ Computes
(x*y) - z
in a single instruction when possible.- 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.
- Returns
the result of the fused multiply-sub operation.
-
template<class T, class A>
inline batch<T, A> xsimd::fnma(batch<T, A> const &x, batch<T, A> const &y, batch<T, A> const &z) noexcept¶ Computes
-(x*y) + z
in a single instruction when possible.- 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.
- Returns
the result of the fused negated multiply-add operation.
-
template<class T, class A>
inline batch<T, A> xsimd::fnms(batch<T, A> const &x, batch<T, A> const &y, batch<T, A> const &z) noexcept¶ Computes
-(x*y) - z
in a single instruction when possible.- 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.
- Returns
the result of the fused negated multiply-sub operation.
-
template<class T, class A>
inline batch<T, A> xsimd::min(batch<T, A> const &x, batch<T, A> const &y) noexcept¶ Computes the smaller values of the batches
x
andy
.- Parameters
x – a batch of integer or floating point values.
y – a batch of integer or floating point values.
- Returns
a batch of the smaller values.
-
template<class T, class A>
inline batch<T, A> xsimd::max(batch<T, A> const &x, batch<T, A> const &y) noexcept¶ Computes the larger values of the batches
x
andy
.- Parameters
x – a batch of integer or floating point values.
y – a batch of integer or floating point values.
- Returns
a batch of the larger values.
-
template<class T, class A>
inline batch<T, A> xsimd::fmin(batch<T, A> const &x, batch<T, A> const &y) noexcept¶ Computes the smaller values of the batches
x
andy
.- Parameters
x – a batch of integer or floating point values.
y – a batch of integer or floating point values.
- Returns
a batch of the smaller values.
-
template<class T, class A>
inline batch<T, A> xsimd::fmax(batch<T, A> const &x, batch<T, A> const &y) noexcept¶ Computes the larger values of the batches
x
andy
.- Parameters
x – a batch of integer or floating point values.
y – a batch of integer or floating point values.
- Returns
a batch of the larger values.
-
template<class T, class A>
inline batch<T, A> xsimd::fdim(batch<T, A> const &x, batch<T, A> const &y) noexcept¶ Computes the positive difference between
x
andy
, that is,max(0, x-y)
.- Parameters
x – batch of floating point values.
y – batch of floating point values.
- Returns
the positive difference.
-
template<class T, class A>
inline batch<T, A> xsimd::sadd(batch<T, A> const &x, batch<T, A> const &y) noexcept¶ Computes the saturate sum of the batch
x
and the batchy
.- Template Parameters
X – the actual type of batch.
- Parameters
x – batch involved in the saturated addition.
y – batch involved in the saturated addition.
- Returns
the result of the saturated addition.
-
template<class T, class A>
inline batch<T, A> xsimd::ssub(batch<T, A> const &x, batch<T, A> const &y) noexcept¶ Computes the saturate difference of the batch
x
and the batchy
.- Template Parameters
X – the actual type of batch.
- Parameters
x – batch involved in the saturated difference.
y – batch involved in the saturated difference.
- Returns
the result of the saturated difference.
-
template<class T, class A>
inline batch<T, A> xsimd::clip(batch<T, A> const &x, batch<T, A> const &lo, batch<T, A> const &hi) noexcept¶ Clips the values of the batch
x
between those of the batcheslo
andhi
.- Parameters
x – batch of scalar values.
lo – batch of scalar values.
hi – batch of scalar values.
- Returns
the result of the clipping.