Arithmetic operators¶
-
template<class
T, classTp>
autoadd(T const &x, Tp const &y) noexcept -> decltype(x + y)¶ Computes the sum of the batches
xandy.- Return
the sum of
xandy- Parameters
x: batch or scalar involved in the addition.y: batch or scalar involved in the addition.
-
template<class
T, classTp>
autodiv(T const &x, Tp const &y) noexcept -> decltype(x / y)¶ Computes the division of the batch
xby the batchy.- Return
the result of the division.
- Parameters
x: scalar or batch of scalarsy: scalar or batch of scalars
-
template<class
T, classA>
batch<T, A>fma(batch<T, A> const &x, batch<T, A> const &y, batch<T, A> const &z) noexcept¶ Computes
(x*y) + zin 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, classA>
batch<T, A>fms(batch<T, A> const &x, batch<T, A> const &y, batch<T, A> const &z) noexcept¶ Computes
(x*y) - zin 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, classA>
batch<T, A>fnma(batch<T, A> const &x, batch<T, A> const &y, batch<T, A> const &z) noexcept¶ Computes
-(x*y) + zin 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, classA>
batch<T, A>fnms(batch<T, A> const &x, batch<T, A> const &y, batch<T, A> const &z) noexcept¶ Computes
-(x*y) - zin 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, classTp>
automod(T const &x, Tp const &y) noexcept -> decltype(x % y)¶ Computes the integer modulo of the batch
xby the batchy.- Return
the result of the modulo.
- Parameters
x: batch involved in the modulo.y: batch involved in the modulo.
-
template<class
T, classTp>
automul(T const &x, Tp const &y) noexcept -> decltype(x * y)¶ Computes the product of the batches
xandy.- Return
the result of the product.
- Template Parameters
X: the actual type of batch.
- Parameters
x: batch involved in the product.y: batch involved in the product.
-
template<class
T, classA>
batch<T, A>neg(batch<T, A> const &x) noexcept¶ Computes the opposite of the batch
x.- Return
the opposite of
x.- Parameters
x: batch involved in the operation.
-
template<class
T, classA>
batch<T, A>pos(batch<T, A> const &x) noexcept¶ No-op on
x.- Return
x.- Parameters
x: batch involved in the operation.
-
template<class
T, classA, class = typename std::enable_if<std::is_floating_point<T>::value, void>::type>
batch<T, A>reciprocal(batch<T, A> const &x) noexcept¶ Computes the approximate reciprocal of the batch
x.The maximum relative error for this approximation is less than 1.5*2^-12.
- Return
the reciprocal.
- Parameters
x: batch of floating point numbers.
-
template<class
T, classTp>
autosadd(T const &x, Tp const &y) noexcept -> decltype(x + y)¶ Computes the saturate sum of the batch
xand the batchy.x.- 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, classTp>
autossub(T const &x, Tp const &y) noexcept -> decltype(x - y)¶ Computes the saturate difference of the batch
xand the batchy.x.- 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.
Comparison operators¶
-
template<class
T, classA>
batch_bool<T, A>eq(batch<T, A> const &x, batch<T, A> const &y) noexcept¶ Element-wise equality comparison of batches
xandy.- Return
a boolean batch.
- Parameters
x: batch of scalarsy: batch of scalars
-
template<class
T, classA>
batch_bool<T, A>ge(batch<T, A> const &x, batch<T, A> const &y) noexcept¶ Element-wise greater or equal comparison of batches
xandy.- Return
a boolean batch.
- Template Parameters
X: the actual type of batch.
- Parameters
x: batch involved in the comparison.y: batch involved in the comparison.
-
template<class
T, classA>
batch_bool<T, A>gt(batch<T, A> const &x, batch<T, A> const &y) noexcept¶ Element-wise greater than comparison of batches
xandy.- Return
a boolean batch.
- Template Parameters
X: the actual type of batch.
- Parameters
x: batch involved in the comparison.y: batch involved in the comparison.
-
template<class
T, classA>
batch_bool<T, A>is_even(batch<T, A> const &x) noexcept¶ Determines if the scalars in the given batch
xrepresent an even integer value.- Return
a batch of booleans.
- Parameters
x: batch of floating point values.
-
template<class
T, classA>
batch_bool<T, A>is_flint(batch<T, A> const &x) noexcept¶ Determines if the floating-point scalars in the given batch
xrepresent integer value.- Return
a batch of booleans.
- Parameters
x: batch of floating point values.
-
template<class
T, classA>
batch_bool<T, A>is_odd(batch<T, A> const &x) noexcept¶ Determines if the scalars in the given batch
xrepresent an odd integer value.- Return
a batch of booleans.
- Parameters
x: batch of floating point values.
-
template<class
T, classA>
batch_bool<T, A>isinf(batch<T, A> const &x) noexcept¶ Determines if the scalars in the given batch
xare inf values.- Return
a batch of booleans.
- Parameters
x: batch of floating point values.
-
template<class
T, classA>
batch_bool<T, A>isfinite(batch<T, A> const &x) noexcept¶ Determines if the scalars in the given batch
xare finite values.- Return
a batch of booleans.
- Parameters
x: batch of floating point values.
-
template<class
T, classA>
batch<T, A>::batch_bool_typeisnan(batch<T, A> const &x) noexcept¶ Determines if the scalars in the given batch
xare NaN values.- Return
a batch of booleans.
- Parameters
x: batch of floating point values.
-
template<class
T, classA>
batch_bool<T, A>le(batch<T, A> const &x, batch<T, A> const &y) noexcept¶ Element-wise lesser or equal to comparison of batches
xandy.- Return
a boolean batch.
- Parameters
x: batch involved in the comparison.y: batch involved in the comparison.
Bitwise operators¶
-
template<class
T, classTp>
autobitwise_and(T const &x, Tp const &y) noexcept -> decltype(x & y)¶ Computes the bitwise and of the batches
xandy.- Return
the result of the bitwise and.
- Parameters
x: batch involved in the operation.y: batch involved in the operation.
-
template<class
T, classA>
batch<T, A>bitwise_andnot(batch<T, A> const &x, batch<T, A> const &y) noexcept¶ Computes the bitwise and not of batches
xandy.- Return
the result of the bitwise and not.
- Parameters
x: batch involved in the operation.y: batch involved in the operation.
-
template<class
T, classA>
batch<T, A>bitwise_not(batch<T, A> const &x) noexcept¶ Computes the bitwise not of batch
x.- Return
the result of the bitwise not.
- Parameters
x: batch involved in the operation.
Mathematical functions¶
absolute value |
|
absolute value |
|
remainder of the floating point division operation |
|
signed remainder of the division operation |
|
fused multiply-add operation |
|
fused multiply-sub operation |
|
fused negated multiply-add operation |
|
fused negated multiply-sub operation |
|
smaller of two batches |
|
larger of two batches |
|
smaller of two batches of floating point values |
|
larger of two batches of floating point values |
|
positive difference |
|
saturated addition |
|
saturated subtraction |
|
clipping operation |
natural exponential function |
|
base 2 exponential function |
|
base 10 exponential function |
|
natural exponential function, minus one |
|
natural logarithm function |
|
base 2 logarithm function |
|
base 10 logarithm function |
|
natural logarithm of one plus function |
power function |
|
reciprocal square root function |
|
square root function |
|
cubic root function |
|
hypotenuse function |
sine function |
|
cosine function |
|
sine and cosine function |
|
tangent function |
|
arc sine function |
|
arc cosine function |
|
arc tangent function |
|
arc tangent function, determining quadrants |
hyperbolic sine function |
|
hyperbolic cosine function |
|
hyperbolic tangent function |
|
inverse hyperbolic sine function |
|
inverse hyperbolic cosine function |
|
inverse hyperbolic tangent function |
error function |
|
complementary error function |
|
gamma function |
|
natural logarithm of the gamma function |
nearest integers not less |
|
nearest integers not greater |
|
nearest integers not greater in magnitude |
|
nearest integers, rounding away from zero |
|
nearest integers using current rounding mode |
|
nearest integers using current rounding mode |
Checks for finite values |
|
Checks for infinite values |
|
Checks for NaN values |
Reducers¶
Miscellaneous¶
-
template<class
T, classA>
batch<T, A>bitofsign(batch<T, A> const &x) noexcept¶ Computes the bit of sign of
x.- Return
bit of sign of
x- Parameters
x: batch of scalar
-
template<class
A, classT>
batch<T, A>copysign(batch<T, A> const &x, batch<T, A> const &y) noexcept¶ Computes a value whose absolute value matches that of
x, but whose sign bit matches that ofy.- Return
batch whose absolute value matches that of
x, but whose sign bit matches that ofy.- Parameters
x: batch of scalarsy: batch of scalars
-
template<class
T, classA>
batch<T, A>select(batch_bool<T, A> const &cond, batch<T, A> const &true_br, batch<T, A> const &false_br) noexcept¶ Ternary operator for batches: selects values from the batches
true_brorfalse_brdepending on the boolean values in the constant batchcond.Equivalent to
for(std::size_t i = 0; i < N; ++i) res[i] = cond[i] ? true_br[i] : false_br[i];
- Return
the result of the selection.
- Parameters
cond: constant batch condition.true_br: batch values for truthy condition.false_br: batch value for falsy condition.
-
template<class
T, classA>
batch<std::complex<T>, A>select(batch_bool<T, A> const &cond, batch<std::complex<T>, A> const &true_br, batch<std::complex<T>, A> const &false_br) noexcept¶ Ternary operator for batches: selects values from the batches
true_brorfalse_brdepending on the boolean values in the constant batchcond.Equivalent to
for(std::size_t i = 0; i < N; ++i) res[i] = cond[i] ? true_br[i] : false_br[i];
- Return
the result of the selection.
- Parameters
cond: constant batch condition.true_br: batch values for truthy condition.false_br: batch value for falsy condition.
-
template<class
T, classA, bool...Values>
batch<T, A>select(batch_bool_constant<batch<T, A>, Values...> const &cond, batch<T, A> const &true_br, batch<T, A> const &false_br) noexcept¶ Ternary operator for batches: selects values from the batches
true_brorfalse_brdepending on the boolean values in the constant batchcond.Equivalent to
for(std::size_t i = 0; i < N; ++i) res[i] = cond[i] ? true_br[i] : false_br[i];
- Return
the result of the selection.
- Parameters
cond: constant batch condition.true_br: batch values for truthy condition.false_br: batch value for falsy condition.
-
template<class
T, classA>
batch<T, A>sign(batch<T, A> const &x) noexcept¶ Computes the sign of
x.- Return
-1 for each negative element, -1 or +1 for each null element and +1 for each element
- Parameters
x: batch