Intel xvec
Experimental C++ simd class library
Loading...
Searching...
No Matches
C++26: Mathematical functions

Element-wise mathematical functions for SIMD vectors. More...

Functions

template<detail::math_floating_point _Vp>
constexpr detail::deduced_vec_t< _Vp > xvec::simd::abs (const _Vp &v)
 Compute the absolute value of each floating-point element.
template<detail::math_floating_point _Vp>
constexpr detail::deduced_vec_t< _Vp > xvec::simd::copysign (const _Vp &magnitude, const _Vp &sign)
 Combine corresponding magnitudes and signs.
template<detail::math_floating_point _Vp>
constexpr detail::deduced_vec_t< _Vp > xvec::simd::sqrt (const _Vp &v)
 Compute the square root of each element.
template<detail::math_floating_point _Vp>
constexpr detail::deduced_vec_t< _Vp > xvec::simd::fma (const _Vp &lhs, const _Vp &rhs, const _Vp &acc)
 Compute (lhs * rhs) + acc element-wise with a single rounding.
template<detail::math_floating_point _Vp>
constexpr detail::deduced_vec_t< _Vp > xvec::simd::ceil (const _Vp &v)
 Round each element toward positive infinity.
template<detail::math_floating_point _Vp>
constexpr detail::deduced_vec_t< _Vp > xvec::simd::floor (const _Vp &v)
 Round each element toward negative infinity.
template<detail::math_floating_point _Vp>
constexpr detail::deduced_vec_t< _Vp > xvec::simd::trunc (const _Vp &v)
 Round each element toward zero.
template<detail::math_floating_point _Vp>
constexpr detail::deduced_vec_t< _Vp > xvec::simd::rint (const _Vp &v)
 Round each element to an integer using the current rounding mode.
template<detail::math_floating_point _Vp>
constexpr detail::deduced_vec_t< _Vp > xvec::simd::round (const _Vp &v)
 Round each element to the nearest integer value.
template<detail::math_floating_point _Vp>
constexpr detail::deduced_mask_t< _Vp > xvec::simd::isinf (const _Vp &v)
 Identify elements representing positive or negative infinity.
template<detail::math_floating_point _Vp>
constexpr detail::deduced_mask_t< _Vp > xvec::simd::isnan (const _Vp &v)
 Identify elements representing NaN.
template<detail::math_floating_point _Vp>
constexpr detail::deduced_mask_t< _Vp > xvec::simd::isfinite (const _Vp &v)
 Identify finite elements.
template<detail::math_floating_point _Vp>
constexpr detail::deduced_mask_t< _Vp > xvec::simd::isnormal (const _Vp &v)
 Identify normal floating-point elements.
template<detail::math_floating_point _Vp>
constexpr detail::deduced_mask_t< _Vp > xvec::simd::signbit (const _Vp &v)
 Identify elements whose sign bit is set. This includes negative zero and negative values of infinity or NaN.
template<detail::math_floating_point _Vp>
constexpr detail::deduced_mask_t< _Vp > xvec::simd::isgreater (const _Vp &x, const _Vp &y)
 Compare corresponding elements using greater-than.
template<detail::math_floating_point _Vp>
constexpr detail::deduced_mask_t< _Vp > xvec::simd::isgreaterequal (const _Vp &x, const _Vp &y)
 Compare corresponding elements using greater-than-or-equal.
template<detail::math_floating_point _Vp>
constexpr detail::deduced_mask_t< _Vp > xvec::simd::isless (const _Vp &x, const _Vp &y)
 Compare corresponding elements using less-than.
template<detail::math_floating_point _Vp>
constexpr detail::deduced_mask_t< _Vp > xvec::simd::islessequal (const _Vp &x, const _Vp &y)
 Compare corresponding elements using less-than-or-equal.
template<detail::math_floating_point _Vp>
constexpr detail::deduced_mask_t< _Vp > xvec::simd::islessgreater (const _Vp &x, const _Vp &y)
 Identify corresponding elements that compare less or greater.
template<detail::math_floating_point _Vp>
constexpr detail::deduced_mask_t< _Vp > xvec::simd::isunordered (const _Vp &x, const _Vp &y)
 Identify unordered element pairs.
template<detail::math_floating_point _Vp>
constexpr detail::deduced_vec_t< _Vp > xvec::simd::exp (const _Vp &v)
template<detail::math_floating_point _Vp>
constexpr detail::deduced_vec_t< _Vp > xvec::simd::exp2 (const _Vp &v)
template<detail::math_floating_point _Vp>
constexpr detail::deduced_vec_t< _Vp > xvec::simd::expm1 (const _Vp &v)
template<detail::math_floating_point _Vp>
constexpr detail::deduced_vec_t< _Vp > xvec::simd::log (const _Vp &v)
template<detail::math_floating_point _Vp>
constexpr detail::deduced_vec_t< _Vp > xvec::simd::log2 (const _Vp &v)
template<detail::math_floating_point _Vp>
constexpr detail::deduced_vec_t< _Vp > xvec::simd::log1p (const _Vp &v)
template<detail::math_floating_point _Vp>
constexpr detail::deduced_vec_t< _Vp > xvec::simd::sin (const _Vp &v)
template<detail::math_floating_point _Vp>
constexpr detail::deduced_vec_t< _Vp > xvec::simd::asin (const _Vp &v)
template<detail::math_floating_point _Vp>
constexpr detail::deduced_vec_t< _Vp > xvec::simd::cos (const _Vp &v)
template<detail::math_floating_point _Vp>
constexpr detail::deduced_vec_t< _Vp > xvec::simd::acos (const _Vp &v)
template<detail::math_floating_point _Vp>
constexpr detail::deduced_vec_t< _Vp > xvec::simd::tan (const _Vp &v)
template<detail::math_floating_point _Vp>
constexpr detail::deduced_vec_t< _Vp > xvec::simd::atan (const _Vp &v)
template<detail::math_floating_point _Vp>
constexpr detail::deduced_vec_t< _Vp > xvec::simd::sinh (const _Vp &v)
template<detail::math_floating_point _Vp>
constexpr detail::deduced_vec_t< _Vp > xvec::simd::asinh (const _Vp &v)
template<detail::math_floating_point _Vp>
constexpr detail::deduced_vec_t< _Vp > xvec::simd::cosh (const _Vp &v)
template<detail::math_floating_point _Vp>
constexpr detail::deduced_vec_t< _Vp > xvec::simd::acosh (const _Vp &v)
template<detail::math_floating_point _Vp>
constexpr detail::deduced_vec_t< _Vp > xvec::simd::tanh (const _Vp &v)
template<detail::math_floating_point _Vp>
constexpr detail::deduced_vec_t< _Vp > xvec::simd::atanh (const _Vp &v)
template<detail::math_floating_point _Vp>
constexpr detail::deduced_vec_t< _Vp > xvec::simd::cbrt (const _Vp &v)
template<detail::math_floating_point _Vp>
constexpr auto xvec::simd::hypot (const _Vp &v0, const _Vp &v1)
template<detail::math_floating_point _Vp>
constexpr auto xvec::simd::pow (const _Vp &v0, const _Vp &v1)
template<detail::math_floating_point _Vp>
constexpr detail::deduced_vec_t< _Vp > xvec::simd::erf (const _Vp &v)
template<detail::math_floating_point _Vp>
constexpr detail::deduced_vec_t< _Vp > xvec::simd::erfc (const _Vp &v)

Detailed Description

Element-wise mathematical functions for SIMD vectors.

See also
https://eel.is/c++draft/simd.math

Function Documentation

◆ abs()

template<detail::math_floating_point _Vp>
detail::deduced_vec_t< _Vp > xvec::simd::abs ( const _Vp & v)
constexpr

Compute the absolute value of each floating-point element.

Template Parameters
_VpThe input vector type.
Parameters
vThe input vector.
Returns
A vector containing the absolute values.

◆ ceil()

template<detail::math_floating_point _Vp>
detail::deduced_vec_t< _Vp > xvec::simd::ceil ( const _Vp & v)
constexpr

Round each element toward positive infinity.

Template Parameters
_VpThe input vector type.
Parameters
vThe input vector.
Returns
A vector containing the rounded values.

◆ copysign()

template<detail::math_floating_point _Vp>
detail::deduced_vec_t< _Vp > xvec::simd::copysign ( const _Vp & magnitude,
const _Vp & sign )
constexpr

Combine corresponding magnitudes and signs.

Template Parameters
_VpThe input vector type.
Parameters
magnitudeThe vector supplying the magnitudes.
signThe vector supplying the signs.
Returns
A vector with each magnitude from magnitude and each sign from sign.

◆ floor()

template<detail::math_floating_point _Vp>
detail::deduced_vec_t< _Vp > xvec::simd::floor ( const _Vp & v)
constexpr

Round each element toward negative infinity.

Template Parameters
_VpThe input vector type.
Parameters
vThe input vector.
Returns
A vector containing the rounded values.

◆ fma()

template<detail::math_floating_point _Vp>
detail::deduced_vec_t< _Vp > xvec::simd::fma ( const _Vp & lhs,
const _Vp & rhs,
const _Vp & acc )
constexpr

Compute (lhs * rhs) + acc element-wise with a single rounding.

Template Parameters
_VpThe input vector type.
Parameters
lhsThe left multiplication operand.
rhsThe right multiplication operand.
accThe value added to the product.
Returns
A vector containing the fused multiply-add results.

◆ isfinite()

template<detail::math_floating_point _Vp>
detail::deduced_mask_t< _Vp > xvec::simd::isfinite ( const _Vp & v)
constexpr

Identify finite elements.

Template Parameters
_VpThe input vector type.
Parameters
vThe input vector.
Returns
A mask whose elements are true for inputs that are neither infinite nor NaN.

◆ isgreater()

template<detail::math_floating_point _Vp>
detail::deduced_mask_t< _Vp > xvec::simd::isgreater ( const _Vp & x,
const _Vp & y )
constexpr

Compare corresponding elements using greater-than.

Parameters
xThe left operand.
yThe right operand.
Returns
A mask containing the element-wise comparison results.

◆ isgreaterequal()

template<detail::math_floating_point _Vp>
detail::deduced_mask_t< _Vp > xvec::simd::isgreaterequal ( const _Vp & x,
const _Vp & y )
constexpr

Compare corresponding elements using greater-than-or-equal.

Parameters
xThe left operand.
yThe right operand.
Returns
A mask containing the element-wise comparison results.

◆ isinf()

template<detail::math_floating_point _Vp>
detail::deduced_mask_t< _Vp > xvec::simd::isinf ( const _Vp & v)
constexpr

Identify elements representing positive or negative infinity.

Template Parameters
_VpThe input vector type.
Parameters
vThe input vector.
Returns
A mask whose elements are true for infinite input elements.

◆ isless()

template<detail::math_floating_point _Vp>
detail::deduced_mask_t< _Vp > xvec::simd::isless ( const _Vp & x,
const _Vp & y )
constexpr

Compare corresponding elements using less-than.

Parameters
xThe left operand.
yThe right operand.
Returns
A mask containing the element-wise comparison results.

◆ islessequal()

template<detail::math_floating_point _Vp>
detail::deduced_mask_t< _Vp > xvec::simd::islessequal ( const _Vp & x,
const _Vp & y )
constexpr

Compare corresponding elements using less-than-or-equal.

Parameters
xThe left operand.
yThe right operand.
Returns
A mask containing the element-wise comparison results.

◆ islessgreater()

template<detail::math_floating_point _Vp>
detail::deduced_mask_t< _Vp > xvec::simd::islessgreater ( const _Vp & x,
const _Vp & y )
constexpr

Identify corresponding elements that compare less or greater.

Parameters
xThe left operand.
yThe right operand.
Returns
A mask that is false for equal or unordered element pairs.

◆ isnan()

template<detail::math_floating_point _Vp>
detail::deduced_mask_t< _Vp > xvec::simd::isnan ( const _Vp & v)
constexpr

Identify elements representing NaN.

Template Parameters
_VpThe input vector type.
Parameters
vThe input vector.
Returns
A mask whose elements are true for NaN input elements.

◆ isnormal()

template<detail::math_floating_point _Vp>
detail::deduced_mask_t< _Vp > xvec::simd::isnormal ( const _Vp & v)
constexpr

Identify normal floating-point elements.

Template Parameters
_VpThe input vector type.
Parameters
vThe input vector.
Returns
A mask whose elements are true for normal, nonzero finite inputs.

◆ isunordered()

template<detail::math_floating_point _Vp>
detail::deduced_mask_t< _Vp > xvec::simd::isunordered ( const _Vp & x,
const _Vp & y )
constexpr

Identify unordered element pairs.

Parameters
xThe left operand.
yThe right operand.
Returns
A mask that is true where either corresponding input is NaN.

◆ rint()

template<detail::math_floating_point _Vp>
detail::deduced_vec_t< _Vp > xvec::simd::rint ( const _Vp & v)
constexpr

Round each element to an integer using the current rounding mode.

Template Parameters
_VpThe input vector type.
Parameters
vThe input vector.
Returns
A vector containing the rounded values.

◆ round()

template<detail::math_floating_point _Vp>
detail::deduced_vec_t< _Vp > xvec::simd::round ( const _Vp & v)
constexpr

Round each element to the nearest integer value.

Template Parameters
_VpThe input vector type.
Parameters
vThe input vector.
Returns
A vector containing the rounded values.

◆ signbit()

template<detail::math_floating_point _Vp>
detail::deduced_mask_t< _Vp > xvec::simd::signbit ( const _Vp & v)
constexpr

Identify elements whose sign bit is set. This includes negative zero and negative values of infinity or NaN.

Template Parameters
_VpThe input vector type.
Parameters
vThe input vector.
Returns
A mask containing the sign-bit state of each input element.

◆ sqrt()

template<detail::math_floating_point _Vp>
detail::deduced_vec_t< _Vp > xvec::simd::sqrt ( const _Vp & v)
constexpr

Compute the square root of each element.

Template Parameters
_VpThe input vector type.
Parameters
vThe input vector.
Returns
A vector containing the square roots.

◆ trunc()

template<detail::math_floating_point _Vp>
detail::deduced_vec_t< _Vp > xvec::simd::trunc ( const _Vp & v)
constexpr

Round each element toward zero.

Template Parameters
_VpThe input vector type.
Parameters
vThe input vector.
Returns
A vector containing the truncated values.