Basic functions¶
-
template<class X>
inline real_batch_type_t<X> xsimd::abs(const simd_base<X> &rhs)¶ Computes the absolute values of each scalar in the batch
rhs
.- Parameters
rhs – batch of integer or floating point values.
- Returns
the asbolute values of
rhs
.
-
template<class X>
inline batch_type_t<X> xsimd::fabs(const simd_base<X> &rhs)¶ Computes the absolute values of each scalar in the batch
rhs
.- Parameters
rhs – batch floating point values.
- Returns
the asbolute values of
rhs
.
-
template<class B>
inline batch_type_t<B> xsimd::fmod(const simd_base<B> &x, const simd_base<B> &y)¶ Computes the floating-point remainder of the division operation
x/y
.The floating-point remainder of the division operation
x/y
calculated by this function is exactly the valuex - n*y
, wheren
isx/y
with its fractional part truncated. The returned value has the same sign asx
and is less thany
in magnitude.- Parameters
x – batch of floating point values.
y – batch of floating point values.
- Returns
the floating-point remainder of the division.
-
template<class B>
inline batch_type_t<B> xsimd::remainder(const simd_base<B> &x, const simd_base<B> &y)¶ Computes the IEEE remainder of the floating point division operation
x/y
.The IEEE floating-point remainder of the division operation
x/y
calculated by this function is exactly the valuex - n*y
, where the value n is the integral value nearest the exact valuex/y
. When|n-x/y| = 0.5
, the value n is chosen to be even. In contrast to fmod, the returned value is not guaranteed to have the same sign asx
. If the returned value is 0, it will have the same sign asx
.- Parameters
x – batch of floating point values.
y – batch of floating point values.
- Returns
the IEEE remainder remainder of the floating point division.
-
template<class X>
inline batch_type_t<X> xsimd::fma(const simd_base<X> &x, const simd_base<X> &y, const simd_base<X> &z)¶ 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 X>
inline batch_type_t<X> xsimd::fms(const simd_base<X> &x, const simd_base<X> &y, const simd_base<X> &z)¶ 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 X>
inline batch_type_t<X> xsimd::fnma(const simd_base<X> &x, const simd_base<X> &y, const simd_base<X> &z)¶ 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 X>
inline batch_type_t<X> xsimd::fnms(const simd_base<X> &x, const simd_base<X> &y, const simd_base<X> &z)¶ 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 X>
inline batch_type_t<X> xsimd::min(const simd_base<X> &lhs, const simd_base<X> &rhs)¶ Returns the smaller values of the batches
lhs
andrhs
.- Parameters
lhs – a batch of integer or floating point values.
rhs – a batch of integer or floating point values.
- Returns
a batch of the smaller values.
-
template<class X>
inline batch_type_t<X> xsimd::max(const simd_base<X> &lhs, const simd_base<X> &rhs)¶ Returns the larger values of the batches
lhs
andrhs
.- Parameters
lhs – a batch of integer or floating point values.
rhs – a batch of integer or floating point values.
- Returns
a batch of the larger values.
Warning
doxygenfunction: Unable to resolve function “fdim” with arguments (const batch<T, N>&, const batch<T, N>&) in doxygen xml output for project “xsimd” from directory: ../xml. Potential matches:
- template<class B> batch_type_t<B> fdim(const simd_base<B> &x, const simd_base<B> &y)
Warning
doxygenfunction: Unable to resolve function “sadd” with arguments (const simd_base<B>&, const simd_base<B>&) in doxygen xml output for project “xsimd” from directory: ../xml. Potential matches:
- batch_type sadd(const batch_type &lhs, const batch_type &rhs)
- batch_type sadd(const batch_type &lhs, const batch_type &rhs)
- batch_type sadd(const batch_type &lhs, const batch_type &rhs)
- batch_type sadd(const batch_type &lhs, const batch_type &rhs)
- batch_type sadd(const batch_type &lhs, const batch_type &rhs)
- batch_type sadd(const batch_type &lhs, const batch_type &rhs)
- batch_type sadd(const batch_type &lhs, const batch_type &rhs)
- batch_type sadd(const batch_type &lhs, const batch_type &rhs)
- batch_type sadd(const batch_type &lhs, const batch_type &rhs)
- batch_type sadd(const batch_type &lhs, const batch_type &rhs)
- batch_type sadd(const batch_type &lhs, const batch_type &rhs)
- batch_type sadd(const batch_type &lhs, const batch_type &rhs)
- batch_type sadd(const batch_type &lhs, const batch_type &rhs)
- batch_type sadd(const batch_type &lhs, const batch_type &rhs)
- batch_type sadd(const batch_type &lhs, const batch_type &rhs)
- batch_type sadd(const batch_type &lhs, const batch_type &rhs)
- batch_type sadd(const batch_type &lhs, const batch_type &rhs)
- batch_type sadd(const batch_type &lhs, const batch_type &rhs)
- batch_type sadd(const batch_type &lhs, const batch_type &rhs)
- batch_type sadd(const batch_type &lhs, const batch_type &rhs)
- batch_type sadd(const batch_type &lhs, const batch_type &rhs)
- batch_type sadd(const batch_type &lhs, const batch_type &rhs)
- batch_type sadd(const batch_type &lhs, const batch_type &rhs)
- batch_type sadd(const batch_type &lhs, const batch_type &rhs)
- batch_type sadd(const batch_type &lhs, const batch_type &rhs)
- batch_type sadd(const batch_type &lhs, const batch_type &rhs)
- batch_type sadd(const batch_type &lhs, const batch_type &rhs)
- batch_type sadd(const batch_type &lhs, const batch_type &rhs)
- batch_type sadd(const batch_type &lhs, const batch_type &rhs)
- batch_type sadd(const batch_type &lhs, const batch_type &rhs)
- batch_type sadd(const batch_type &lhs, const batch_type &rhs)
- batch_type sadd(const batch_type &lhs, const batch_type &rhs)
- batch_type sadd(const batch_type &lhs, const batch_type &rhs)
- batch_type sadd(const batch_type &lhs, const batch_type &rhs)
- batch_type sadd(const batch_type &lhs, const batch_type &rhs)
- batch_type sadd(const batch_type &lhs, const batch_type &rhs)
- batch_type sadd(const batch_type &lhs, const batch_type &rhs)
- batch_type sadd(const batch_type &lhs, const batch_type &rhs)
- batch_type sadd(const batch_type &lhs, const batch_type &rhs)
- batch_type sadd(const batch_type &lhs, const batch_type &rhs)
- batch_type sadd(const batch_type &lhs, const batch_type &rhs)
- batch_type sadd(const batch_type &lhs, const batch_type &rhs)
- batch_type sadd(const batch_type &lhs, const batch_type &rhs)
- batch_type sadd(const batch_type &lhs, const batch_type &rhs)
- batch_type sadd(const batch_type &lhs, const batch_type &rhs)
- batch_type sadd(const batch_type &lhs, const batch_type &rhs)
- batch_type sadd(const batch_type &lhs, const batch_type &rhs)
- batch_type sadd(const batch_type &lhs, const batch_type &rhs)
- batch_type sadd(const batch_type &lhs, const batch_type &rhs)
- batch_type sadd(const batch_type &lhs, const batch_type &rhs)
- batch_type sadd(const batch_type &lhs, const batch_type &rhs)
- batch_type sadd(const batch_type &lhs, const batch_type &rhs)
- batch_type sadd(const batch_type &lhs, const batch_type &rhs)
- template<class X> batch_type_t<X> sadd(const simd_base<X> &lhs, const simd_base<X> &rhs)
- template<class X> batch_type_t<X> sadd(const simd_base<X> &lhs, const typename simd_batch_traits<X>::value_type &rhs)
- template<class X> batch_type_t<X> sadd(const typename simd_batch_traits<X>::value_type &lhs, const simd_base<X> &rhs)
- template<typename T, class = typename std::enable_if<std::is_scalar<T>::value>::type> T sadd(const T &lhs, const T &rhs)
- template<typename T, class = typename std::enable_if<std::is_scalar<T>::value>::type> T sadd(const T &lhs, const T &rhs)
Warning
doxygenfunction: Unable to resolve function “ssub” with arguments (const simd_base<B>&, const simd_base<B>&) in doxygen xml output for project “xsimd” from directory: ../xml. Potential matches:
- batch_type ssub(const batch_type &lhs, const batch_type &rhs)
- batch_type ssub(const batch_type &lhs, const batch_type &rhs)
- batch_type ssub(const batch_type &lhs, const batch_type &rhs)
- batch_type ssub(const batch_type &lhs, const batch_type &rhs)
- batch_type ssub(const batch_type &lhs, const batch_type &rhs)
- batch_type ssub(const batch_type &lhs, const batch_type &rhs)
- batch_type ssub(const batch_type &lhs, const batch_type &rhs)
- batch_type ssub(const batch_type &lhs, const batch_type &rhs)
- batch_type ssub(const batch_type &lhs, const batch_type &rhs)
- batch_type ssub(const batch_type &lhs, const batch_type &rhs)
- batch_type ssub(const batch_type &lhs, const batch_type &rhs)
- batch_type ssub(const batch_type &lhs, const batch_type &rhs)
- batch_type ssub(const batch_type &lhs, const batch_type &rhs)
- batch_type ssub(const batch_type &lhs, const batch_type &rhs)
- batch_type ssub(const batch_type &lhs, const batch_type &rhs)
- batch_type ssub(const batch_type &lhs, const batch_type &rhs)
- batch_type ssub(const batch_type &lhs, const batch_type &rhs)
- batch_type ssub(const batch_type &lhs, const batch_type &rhs)
- batch_type ssub(const batch_type &lhs, const batch_type &rhs)
- batch_type ssub(const batch_type &lhs, const batch_type &rhs)
- batch_type ssub(const batch_type &lhs, const batch_type &rhs)
- batch_type ssub(const batch_type &lhs, const batch_type &rhs)
- batch_type ssub(const batch_type &lhs, const batch_type &rhs)
- batch_type ssub(const batch_type &lhs, const batch_type &rhs)
- batch_type ssub(const batch_type &lhs, const batch_type &rhs)
- batch_type ssub(const batch_type &lhs, const batch_type &rhs)
- batch_type ssub(const batch_type &lhs, const batch_type &rhs)
- batch_type ssub(const batch_type &lhs, const batch_type &rhs)
- batch_type ssub(const batch_type &lhs, const batch_type &rhs)
- batch_type ssub(const batch_type &lhs, const batch_type &rhs)
- batch_type ssub(const batch_type &lhs, const batch_type &rhs)
- batch_type ssub(const batch_type &lhs, const batch_type &rhs)
- batch_type ssub(const batch_type &lhs, const batch_type &rhs)
- batch_type ssub(const batch_type &lhs, const batch_type &rhs)
- batch_type ssub(const batch_type &lhs, const batch_type &rhs)
- batch_type ssub(const batch_type &lhs, const batch_type &rhs)
- batch_type ssub(const batch_type &lhs, const batch_type &rhs)
- batch_type ssub(const batch_type &lhs, const batch_type &rhs)
- batch_type ssub(const batch_type &lhs, const batch_type &rhs)
- batch_type ssub(const batch_type &lhs, const batch_type &rhs)
- batch_type ssub(const batch_type &lhs, const batch_type &rhs)
- batch_type ssub(const batch_type &lhs, const batch_type &rhs)
- batch_type ssub(const batch_type &lhs, const batch_type &rhs)
- batch_type ssub(const batch_type &lhs, const batch_type &rhs)
- batch_type ssub(const batch_type &lhs, const batch_type &rhs)
- batch_type ssub(const batch_type &lhs, const batch_type &rhs)
- batch_type ssub(const batch_type &lhs, const batch_type &rhs)
- batch_type ssub(const batch_type &lhs, const batch_type &rhs)
- batch_type ssub(const batch_type &lhs, const batch_type &rhs)
- batch_type ssub(const batch_type &lhs, const batch_type &rhs)
- batch_type ssub(const batch_type &lhs, const batch_type &rhs)
- batch_type ssub(const batch_type &lhs, const batch_type &rhs)
- batch_type ssub(const batch_type &lhs, const batch_type &rhs)
- template<class X> batch_type_t<X> ssub(const simd_base<X> &lhs, const simd_base<X> &rhs)
- template<class X> batch_type_t<X> ssub(const simd_base<X> &lhs, const typename simd_batch_traits<X>::value_type &rhs)
- template<class X> batch_type_t<X> ssub(const typename simd_batch_traits<X>::value_type &lhs, const simd_base<X> &rhs)
- template<typename T, class = typename std::enable_if<std::is_scalar<T>::value>::type> T ssub(const T &lhs, const T &rhs)
- template<typename T, class = typename std::enable_if<std::is_scalar<T>::value>::type> T ssub(const T &lhs, const T &rhs)
-
template<class B>
inline batch_type_t<B> xsimd::clip(const simd_base<B> &x, const simd_base<B> &lo, const simd_base<B> &hi)¶ Clips the values of the batch
x
between those of the batcheslo
andhi
.- Parameters
x – batch of floating point values.
lo – batch of floating point values.
hi – batch of floating point values.
- Returns
the result of the clipping.