Basic functions¶
-
template <class X>
Xxsimd
::
abs
(const simd_batch<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>
Xxsimd
::
fabs
(const simd_batch<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 T, std::size_t N>
batch<T, N>xsimd
::
fmod
(const batch<T, N> &x, const batch<T, N> &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 T, std::size_t N>
batch<T, N>xsimd
::
remainder
(const batch<T, N> &x, const batch<T, N> &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>
Xxsimd
::
fma
(const simd_batch<X> &x, const simd_batch<X> &y, const simd_batch<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>
Xxsimd
::
fms
(const simd_batch<X> &x, const simd_batch<X> &y, const simd_batch<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>
Xxsimd
::
fnma
(const simd_batch<X> &x, const simd_batch<X> &y, const simd_batch<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>
Xxsimd
::
fnms
(const simd_batch<X> &x, const simd_batch<X> &y, const simd_batch<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>
Xxsimd
::
min
(const simd_batch<X> &lhs, const simd_batch<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>
Xxsimd
::
max
(const simd_batch<X> &lhs, const simd_batch<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 X>
Xxsimd
::
fmin
(const simd_batch<X> &lhs, const simd_batch<X> &rhs) Returns the smaller values of the batches
lhs
andrhs
.- Return
- a batch of the smaller values.
- Parameters
lhs
: a batch of floating point values.rhs
: a batch of floating point values.
-
template <class X>
Xxsimd
::
fmax
(const simd_batch<X> &lhs, const simd_batch<X> &rhs) Returns the larger values of the batches
lhs
andrhs
.- Return
- a batch of the larger values.
- Parameters
lhs
: a batch of floating point values.rhs
: a batch of floating point values.
-
template <class T, std::size_t N>
batch<T, N>xsimd
::
fdim
(const batch<T, N> &x, const batch<T, N> &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.
-
template <class T, std::size_t N>
batch<T, N>xsimd
::
clip
(const batch<T, N> &x, const batch<T, N> &lo, const batch<T, N> &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.