Basic functions¶
-
template<class
X
>
real_batch_type_t<X>xsimd
::
abs
(const simd_base<X> &rhs)¶ Computes the absolute values of each scalar in the batch
rhs
.- Return
the asbolute values of
rhs
.- Parameters
rhs
: batch of integer or floating point values.
-
template<class
X
>
batch_type_t<X>xsimd
::
fabs
(const simd_base<X> &rhs)¶ Computes the absolute values of each scalar in the batch
rhs
.- Return
the asbolute values of
rhs
.- Parameters
rhs
: batch floating point values.
-
template<class
B
>
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.- Return
the floating-point remainder of the division.
- Parameters
x
: batch of floating point values.y
: batch of floating point values.
-
template<class
B
>
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
.- Return
the IEEE remainder remainder of the floating point division.
- Parameters
x
: batch of floating point values.y
: batch of floating point values.
-
template<class
X
>
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.- 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
X
>
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.- 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
X
>
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.- 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
X
>
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.- 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
X
>
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
.- Return
a batch of the smaller values.
- Parameters
lhs
: a batch of integer or floating point values.rhs
: a batch of integer or floating point values.
-
template<class
X
>
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
.- Return
a batch of the larger values.
- Parameters
lhs
: a batch of integer or floating point values.rhs
: a batch of integer or floating point values.
-
template<class
B
>
batch_type_t<B>xsimd
::
fdim
(const simd_base<B> &x, const simd_base<B> &y)¶ Computes the positive difference between
x
andy
, that is,max(0, x-y)
.- Return
the positive difference.
- Parameters
x
: batch of floating point values.y
: batch of floating point values.
Warning
doxygenfunction: Unable to resolve multiple matches for 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)
- 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)
Warning
doxygenfunction: Unable to resolve multiple matches for 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)
- 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<class
B
>
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
.- Return
the result of the clipping.
- Parameters
x
: batch of floating point values.lo
: batch of floating point values.hi
: batch of floating point values.