29 Numerics library [numerics]

29.10 Data-parallel types [simd]

29.10.8 basic_vec non-member operations [simd.nonmembers]

29.10.8.13 Mathematical functions [simd.math]

template<math-floating-point V> constexpr rebind_t<int, deduced-vec-t<V>> ilogb(const V& x); template<math-floating-point V> constexpr deduced-vec-t<V> abs(const V& j); template<math-floating-point V> constexpr deduced-vec-t<V> fabs(const V& x); template<math-floating-point V> constexpr deduced-vec-t<V> ceil(const V& x); template<math-floating-point V> constexpr deduced-vec-t<V> floor(const V& x); template<math-floating-point V> deduced-vec-t<V> nearbyint(const V& x); template<math-floating-point V> deduced-vec-t<V> rint(const V& x); template<math-floating-point V> rebind_t<long int, deduced-vec-t<V>> lrint(const V& x); template<math-floating-point V> rebind_t<long long int, deduced-vec-t<V>> llrint(const V& x); template<math-floating-point V> constexpr deduced-vec-t<V> round(const V& x); template<math-floating-point V> constexpr rebind_t<long int, deduced-vec-t<V>> lround(const V& x); template<math-floating-point V> constexpr rebind_t<long long int, deduced-vec-t<V>> llround(const V& x); template<math-floating-point V> constexpr deduced-vec-t<V> fmod(const V& x, const V& y); template<math-floating-point V> constexpr deduced-vec-t<V> fmod(const deduced-vec-t<V>& x, const V& y); template<math-floating-point V> constexpr deduced-vec-t<V> fmod(const V& x, const deduced-vec-t<V>& y); template<math-floating-point V> constexpr deduced-vec-t<V> trunc(const V& x); template<math-floating-point V> constexpr deduced-vec-t<V> remainder(const V& x, const V& y); template<math-floating-point V> constexpr deduced-vec-t<V> remainder(const deduced-vec-t<V>& x, const V& y); template<math-floating-point V> constexpr deduced-vec-t<V> remainder(const V& x, const deduced-vec-t<V>& y); template<math-floating-point V> constexpr deduced-vec-t<V> copysign(const V& x, const V& y); template<math-floating-point V> constexpr deduced-vec-t<V> copysign(const deduced-vec-t<V>& x, const V& y); template<math-floating-point V> constexpr deduced-vec-t<V> copysign(const V& x, const deduced-vec-t<V>& y); template<math-floating-point V> constexpr deduced-vec-t<V> nextafter(const V& x, const V& y); template<math-floating-point V> constexpr deduced-vec-t<V> nextafter(const deduced-vec-t<V>& x, const V& y); template<math-floating-point V> constexpr deduced-vec-t<V> nextafter(const V& x, const deduced-vec-t<V>& y); template<math-floating-point V> constexpr deduced-vec-t<V> fdim(const V& x, const V& y); template<math-floating-point V> constexpr deduced-vec-t<V> fdim(const deduced-vec-t<V>& x, const V& y); template<math-floating-point V> constexpr deduced-vec-t<V> fdim(const V& x, const deduced-vec-t<V>& y); template<math-floating-point V> constexpr deduced-vec-t<V> fmax(const V& x, const V& y); template<math-floating-point V> constexpr deduced-vec-t<V> fmax(const deduced-vec-t<V>& x, const V& y); template<math-floating-point V> constexpr deduced-vec-t<V> fmax(const V& x, const deduced-vec-t<V>& y); template<math-floating-point V> constexpr deduced-vec-t<V> fmin(const V& x, const V& y); template<math-floating-point V> constexpr deduced-vec-t<V> fmin(const deduced-vec-t<V>& x, const V& y); template<math-floating-point V> constexpr deduced-vec-t<V> fmin(const V& x, const deduced-vec-t<V>& y); template<math-floating-point V> constexpr deduced-vec-t<V> fma(const V& x, const V& y, const V& z); template<math-floating-point V> constexpr deduced-vec-t<V> fma(const deduced-vec-t<V>& x, const V& y, const V& z); template<math-floating-point V> constexpr deduced-vec-t<V> fma(const V& x, const deduced-vec-t<V>& y, const V& z); template<math-floating-point V> constexpr deduced-vec-t<V> fma(const V& x, const V& y, const deduced-vec-t<V>& z); template<math-floating-point V> constexpr deduced-vec-t<V> fma(const deduced-vec-t<V>& x, const deduced-vec-t<V>& y, const V& z); template<math-floating-point V> constexpr deduced-vec-t<V> fma(const deduced-vec-t<V>& x, const V& y, const deduced-vec-t<V>& z); template<math-floating-point V> constexpr deduced-vec-t<V> fma(const V& x, const deduced-vec-t<V>& y, const deduced-vec-t<V>& z); template<math-floating-point V> constexpr rebind_t<int, deduced-vec-t<V>> fpclassify(const V& x); template<math-floating-point V> constexpr typename deduced-vec-t<V>::mask_type isfinite(const V& x); template<math-floating-point V> constexpr typename deduced-vec-t<V>::mask_type isinf(const V& x); template<math-floating-point V> constexpr typename deduced-vec-t<V>::mask_type isnan(const V& x); template<math-floating-point V> constexpr typename deduced-vec-t<V>::mask_type isnormal(const V& x); template<math-floating-point V> constexpr typename deduced-vec-t<V>::mask_type signbit(const V& x); template<math-floating-point V> constexpr typename deduced-vec-t<V>::mask_type isgreater(const V& x, const V& y); template<math-floating-point V> constexpr typename deduced-vec-t<V>::mask_type isgreater(const deduced-vec-t<V>& x, const V& y); template<math-floating-point V> constexpr typename deduced-vec-t<V>::mask_type isgreater(const V& x, const deduced-vec-t<V>& y); template<math-floating-point V> constexpr typename deduced-vec-t<V>::mask_type isgreaterequal(const V& x, const V& y); template<math-floating-point V> constexpr typename \exposid{deduced-vec-t}<V>::mask_type isgreaterequal(const deduced-vec-t<V>& x, const V& y); template<math-floating-point V> constexpr typename deduced-vec-t<V>::mask_type isgreaterequal(const V& x, const deduced-vec-t<V>& y); template<math-floating-point V> constexpr typename deduced-vec-t<V>::mask_type isless(const V& x, const V& y); template<math-floating-point V> constexpr typename deduced-vec-t<V>::mask_type isless(const deduced-vec-t<V>& x, const V& y); template<math-floating-point V> constexpr typename deduced-vec-t<V>::mask_type isless(const V& x, const deduced-vec-t<V>& y); template<math-floating-point V> constexpr typename deduced-vec-t<V>::mask_type islessequal(const V& x, const V& y); template<math-floating-point V> constexpr typename deduced-vec-t<V>::mask_type islessequal(const deduced-vec-t<V>& x, const V& y); template<math-floating-point V> constexpr typename deduced-vec-t<V>::mask_type islessequal(const V& x, const deduced-vec-t<V>& y); template<math-floating-point V> constexpr typename deduced-vec-t<V>::mask_type islessgreater(const V& x, const V& y); template<math-floating-point V> constexpr typename deduced-vec-t<V>::mask_type islessgreater(const deduced-vec-t<V>& x, const V& y); template<math-floating-point V> constexpr typename deduced-vec-t<V>::mask_type islessgreater(const V& x, const deduced-vec-t<V>& y); template<math-floating-point V> constexpr typename deduced-vec-t<V>::mask_type isunordered(const V& x, const V& y); template<math-floating-point V> constexpr typename deduced-vec-t<V>::mask_type isunordered(const deduced-vec-t<V>& x, const V& y); template<math-floating-point V> constexpr typename deduced-vec-t<V>::mask_type isunordered(const V& x, const deduced-vec-t<V>& y);
Let Ret denote the return type of the specialization of a function template with the name math-func.
Let math-func-vec denote: template<class... Args> Ret math-func-vec(const Args&... args) { return Ret([&](simd-size-type i) { return math-func(deduced-vec-t<V>(args)[i]...); }); }
Returns: A value ret of type Ret, that is element-wise equal to the result of calling math-func-vec with the parameters of the above functions.
If in an invocation of a scalar overload of math-func for index i in math-func-vec a domain, pole, or range error would occur, the value of ret[i] is unspecified.
Remarks: It is unspecified whether errno ([errno]) is accessed.
template<math-floating-point V> constexpr deduced-vec-t<V> ldexp(const V& x, const rebind_t<int, deduced-vec-t<V>>& exp); template<math-floating-point V> constexpr deduced-vec-t<V> scalbn(const V& x, const rebind_t<int, deduced-vec-t<V>>& n); template<math-floating-point V> constexpr deduced-vec-t<V> scalbln(const V& x, const rebind_t<long int, deduced-vec-t<V>>& n);
Let Ret be deduced-vec-t<V>.
Let math-func denote the name of the function template.
Let math-func-vec denote: Ret math-func-vec(const deduced-vec-t<V>& a, const auto& b) { return Ret([&](simd-size-type i) { return math-func(a[i], b[i]); }); }
Returns: A value ret of type Ret, that is element-wise equal to the result of calling math-func-vec with the parameters of the above functions.
If in an invocation of a scalar overload of math-func for index i in math-func-vec a domain, pole, or range error would occur, the value of ret[i] is unspecified.
Remarks: It is unspecified whether errno ([errno]) is accessed.
template<signed_integral T, class Abi> constexpr basic_vec<T, Abi> abs(const basic_vec<T, Abi>& j);
Preconditions: all_of(j >= -numeric_limits<T>​::​max()) is true.
Returns: An object where the element is initialized to the result of std​::​abs(j[i]) for all i in the range [0, j.size()).
template<math-floating-point V> constexpr deduced-vec-t<V> acos(const V& x); template<math-floating-point V> constexpr deduced-vec-t<V> asin(const V& x); template<math-floating-point V> constexpr deduced-vec-t<V> atan(const V& x); template<math-floating-point V> constexpr deduced-vec-t<V> atan2(const V& y, const V& x); template<math-floating-point V> constexpr deduced-vec-t<V> atan2(const deduced-vec-t<V>& x, const V& y); template<math-floating-point V> constexpr deduced-vec-t<V> atan2(const V& x, const deduced-vec-t<V>& y); template<math-floating-point V> constexpr deduced-vec-t<V> cos(const V& x); template<math-floating-point V> constexpr deduced-vec-t<V> sin(const V& x); template<math-floating-point V> constexpr deduced-vec-t<V> tan(const V& x); template<math-floating-point V> constexpr deduced-vec-t<V> acosh(const V& x); template<math-floating-point V> constexpr deduced-vec-t<V> asinh(const V& x); template<math-floating-point V> constexpr deduced-vec-t<V> atanh(const V& x); template<math-floating-point V> constexpr deduced-vec-t<V> cosh(const V& x); template<math-floating-point V> constexpr deduced-vec-t<V> sinh(const V& x); template<math-floating-point V> constexpr deduced-vec-t<V> tanh(const V& x); template<math-floating-point V> constexpr deduced-vec-t<V> exp(const V& x); template<math-floating-point V> constexpr deduced-vec-t<V> exp2(const V& x); template<math-floating-point V> constexpr deduced-vec-t<V> expm1(const V& x); template<math-floating-point V> constexpr deduced-vec-t<V> log(const V& x); template<math-floating-point V> constexpr deduced-vec-t<V> log10(const V& x); template<math-floating-point V> constexpr deduced-vec-t<V> log1p(const V& x); template<math-floating-point V> constexpr deduced-vec-t<V> log2(const V& x); template<math-floating-point V> constexpr deduced-vec-t<V> logb(const V& x); template<math-floating-point V> constexpr deduced-vec-t<V> cbrt(const V& x); template<math-floating-point V> constexpr deduced-vec-t<V> hypot(const V& x, const V& y); template<math-floating-point V> constexpr deduced-vec-t<V> hypot(const deduced-vec-t<V>& x, const V& y); template<math-floating-point V> constexpr deduced-vec-t<V> hypot(const V& x, const deduced-vec-t<V>& y); template<math-floating-point V> constexpr deduced-vec-t<V> hypot(const V& x, const V& y, const V& z); template<math-floating-point V> constexpr deduced-vec-t<V> hypot(const deduced-vec-t<V>& x, const V& y, const V& z); template<math-floating-point V> constexpr deduced-vec-t<V> hypot(const V& x, const deduced-vec-t<V>& y, const V& z); template<math-floating-point V> constexpr deduced-vec-t<V> hypot(const V& x, const V& y, const deduced-vec-t<V>& z); template<math-floating-point V> constexpr deduced-vec-t<V> hypot(const deduced-vec-t<V>& x, const deduced-vec-t<V>& y, const V& z); template<math-floating-point V> constexpr deduced-vec-t<V> hypot(const deduced-vec-t<V>& x, const V& y, const deduced-vec-t<V>& z); template<math-floating-point V> constexpr deduced-vec-t<V> hypot(const V& x, const deduced-vec-t<V>& y, const deduced-vec-t<V>& z); template<math-floating-point V> constexpr deduced-vec-t<V> pow(const V& x, const V& y); template<math-floating-point V> constexpr deduced-vec-t<V> pow(const deduced-vec-t<V>& x, const V& y); template<math-floating-point V> constexpr deduced-vec-t<V> pow(const V& x, const deduced-vec-t<V>& y); template<math-floating-point V> constexpr deduced-vec-t<V> sqrt(const V& x); template<math-floating-point V> constexpr deduced-vec-t<V> erf(const V& x); template<math-floating-point V> constexpr deduced-vec-t<V> erfc(const V& x); template<math-floating-point V> constexpr deduced-vec-t<V> lgamma(const V& x); template<math-floating-point V> constexpr deduced-vec-t<V> tgamma(const V& x); template<math-floating-point V> constexpr deduced-vec-t<V> lerp(const V& a, const V& b, const V& t) noexcept; template<math-floating-point V> constexpr deduced-vec-t<V> lerp(const deduced-vec-t<V>& x, const V& y, const V& z); template<math-floating-point V> constexpr deduced-vec-t<V> lerp(const V& x, const deduced-vec-t<V>& y, const V& z); template<math-floating-point V> constexpr deduced-vec-t<V> lerp(const V& x, const V& y, const deduced-vec-t<V>& z); template<math-floating-point V> constexpr deduced-vec-t<V> lerp(const deduced-vec-t<V>& x, const deduced-vec-t<V>& y, const V& z); template<math-floating-point V> constexpr deduced-vec-t<V> lerp(const deduced-vec-t<V>& x, const V& y, const deduced-vec-t<V>& z); template<math-floating-point V> constexpr deduced-vec-t<V> lerp(const V& x, const deduced-vec-t<V>& y, const deduced-vec-t<V>& z); template<math-floating-point V> deduced-vec-t<V> beta(const V& x, const V& y); template<math-floating-point V> deduced-vec-t<V> beta(const deduced-vec-t<V>& x, const V& y); template<math-floating-point V> deduced-vec-t<V> beta(const V& x, const deduced-vec-t<V>& y); template<math-floating-point V> deduced-vec-t<V> comp_ellint_1(const V& k); template<math-floating-point V> deduced-vec-t<V> comp_ellint_2(const V& k); template<math-floating-point V> deduced-vec-t<V> comp_ellint_3(const V& k, const V& nu); template<math-floating-point V> deduced-vec-t<V> comp_ellint_3(const deduced-vec-t<V>& x, const V& y); template<math-floating-point V> deduced-vec-t<V> comp_ellint_3(const V& x, const deduced-vec-t<V>& y); template<math-floating-point V> deduced-vec-t<V> cyl_bessel_i(const V& nu, const V& x); template<math-floating-point V> deduced-vec-t<V> cyl_bessel_i(const deduced-vec-t<V>& x, const V& y); template<math-floating-point V> deduced-vec-t<V> cyl_bessel_i(const V& x, const deduced-vec-t<V>& y); template<math-floating-point V> deduced-vec-t<V> cyl_bessel_j(const V& nu, const V& x); template<math-floating-point V> deduced-vec-t<V> cyl_bessel_j(const deduced-vec-t<V>& x, const V& y); template<math-floating-point V> deduced-vec-t<V> cyl_bessel_j(const V& x, const deduced-vec-t<V>& y); template<math-floating-point V> deduced-vec-t<V> cyl_bessel_k(const V& nu, const V& x); template<math-floating-point V> deduced-vec-t<V> cyl_bessel_k(const deduced-vec-t<V>& x, const V& y); template<math-floating-point V> deduced-vec-t<V> cyl_bessel_k(const V& x, const deduced-vec-t<V>& y); template<math-floating-point V> deduced-vec-t<V> cyl_neumann(const V& nu, const V& x); template<math-floating-point V> deduced-vec-t<V> cyl_neumann(const deduced-vec-t<V>& x, const V& y); template<math-floating-point V> deduced-vec-t<V> cyl_neumann(const V& x, const deduced-vec-t<V>& y); template<math-floating-point V> deduced-vec-t<V> ellint_1(const V& k, const V& phi); template<math-floating-point V> deduced-vec-t<V> ellint_1(const deduced-vec-t<V>& x, const V& y); template<math-floating-point V> deduced-vec-t<V> ellint_1(const V& x, const deduced-vec-t<V>& y); template<math-floating-point V> deduced-vec-t<V> ellint_2(const V& k, const V& phi); template<math-floating-point V> deduced-vec-t<V> ellint_2(const deduced-vec-t<V>& x, const V& y); template<math-floating-point V> deduced-vec-t<V> ellint_2(const V& x, const deduced-vec-t<V>& y); template<math-floating-point V> deduced-vec-t<V> ellint_3(const V& k, const V& nu, const V& phi); template<math-floating-point V> deduced-vec-t<V> ellint_3(const deduced-vec-t<V>& x, const V& y, const V& z); template<math-floating-point V> deduced-vec-t<V> ellint_3(const V& x, const deduced-vec-t<V>& y, const V& z); template<math-floating-point V> deduced-vec-t<V> ellint_3(const V& x, const V& y, const deduced-vec-t<V>& z); template<math-floating-point V> deduced-vec-t<V> ellint_3(const deduced-vec-t<V>& x, const deduced-vec-t<V>& y, const V& z); template<math-floating-point V> deduced-vec-t<V> ellint_3(const deduced-vec-t<V>& x, const V& y, const deduced-vec-t<V>& z); template<math-floating-point V> deduced-vec-t<V> ellint_3(const V& x, const deduced-vec-t<V>& y, const deduced-vec-t<V>& z); template<math-floating-point V> deduced-vec-t<V> expint(const V& x); template<math-floating-point V> deduced-vec-t<V> riemann_zeta(const V& x);
Let Ret denote the return type of the specialization of a function template with the name math-func.
Let math-func-vec denote: template<class... Args> Ret math-func-vec(const Args&... args) { return Ret([&](simd-size-type i) { return math-func(deduced-vec-t<V>(args)[i]...); }); }
Returns: A value ret of type Ret, that is element-wise approximately equal to the result of calling math-func-vec with the parameters of the above functions.
If in an invocation of a scalar overload of math-func for index i in math-func-vec a domain, pole, or range error would occur, the value of ret[i] is unspecified.
Remarks: It is unspecified whether errno ([errno]) is accessed.
template<math-floating-point V> deduced-vec-t<V> assoc_laguerre(const rebind_t<unsigned, deduced-vec-t<V>>& n, const rebind_t<unsigned, deduced-vec-t<V>>& m, const V& x); template<math-floating-point V> deduced-vec-t<V> assoc_legendre(const rebind_t<unsigned, deduced-vec-t<V>>& l, const rebind_t<unsigned, deduced-vec-t<V>>& m, const V& x); template<math-floating-point V> deduced-vec-t<V> sph_legendre(const rebind_t<unsigned, deduced-vec-t<V>>& l, const rebind_t<unsigned, deduced-vec-t<V>>& m, const V& theta);
Let math-func denote the name of the function template.
Let math-func-vec denote: auto math-func-vec(const auto& a, const auto& b, const deduced-vec-t<V>& c) { return deduced-vec-t<V>([&](simd-size-type i) { return std::math-func(a[i], b[i], c[i]); }); }
Returns: An object that is element-wise approximately equal to the result of calling math-func-vec with the parameters of the above functions.
template<math-floating-point V> deduced-vec-t<V> hermite(const rebind_t<unsigned, deduced-vec-t<V>>& n, const V& x); template<math-floating-point V> deduced-vec-t<V> laguerre(const rebind_t<unsigned, deduced-vec-t<V>>& n, const V& x); template<math-floating-point V> deduced-vec-t<V> legendre(const rebind_t<unsigned, deduced-vec-t<V>>& l, const V& x); template<math-floating-point V> deduced-vec-t<V> sph_bessel(const rebind_t<unsigned, deduced-vec-t<V>>& n, const V& x); template<math-floating-point V> deduced-vec-t<V> sph_neumann(const rebind_t<unsigned, deduced-vec-t<V>>& n, const V& x);
Let math-func denote the name of the function template.
Let math-func-vec denote: auto math-func-vec(const auto& a, const deduced-vec-t<V>& b) { return deduced-vec-t<V>([&](simd-size-type i) { return std::math-func(a[i], b[i]); }); \}
Returns: An object that is element-wise approximately equal to the result of calling math-func-vec with the parameters of the above functions.
template<math-floating-point V> constexpr deduced-vec-t<V> frexp(const V& value, rebind_t<int, deduced-vec-t<V>>* exp);
Let Ret be deduced-vec-t<V>.
Let frexp-vec denote: template<class V> pair<Ret, rebind_t<int, Ret>> frexp-vec(const deduced-vec-t<V>& x) { int r1[Ret::size()]; Ret r0([&](simd-size-type i) { return frexp(x[i], &r1[i]); }); return {r0, rebind_t<int, Ret>(r1)}; }
Let ret be a value of type pair<Ret, rebind_t<int, Ret>> that is the same value as the result of calling frexp-vec(x).
Effects: Sets *exp to ret.second.
Returns: ret.first.
template<math-floating-point V> constexpr deduced-vec-t<V> remquo(const V& x, const V& y, rebind_t<int, deduced-vec-t<V>>* quo); template<math-floating-point V> constexpr deduced-vec-t<V> remquo(const deduced-vec-t<V>& x, const V& y, rebind_t<int, deduced-vec-t<V>>* quo); template<math-floating-point V> constexpr deduced-vec-t<V> remquo(const V& x, const deduced-vec-t<V>& y, rebind_t<int, deduced-vec-t<V>>* quo);
Let V0 be deduced-vec-t<V>.
Let remquo-vec denote: pair<V0, rebind_t<int, V0>> remquo-vec(const V0& x, const V0& y) { int r1[V0::size()]; V0 r0([&](simd-size-type i) { return remquo(x[i], y[i], &r1[i]); }); return {r0, rebind_t<int, V0>(r1)}; }
Let ret be a value of type pair<V0, rebind_t<int, V0>> that is the same value as the result of calling remquo-vec(x, y).
If in an invocation of a scalar overload of remquo for index i in remquo-vec a domain, pole, or range error would occur, the value of ret[i] is unspecified.
Effects: Sets *quo to ret.second.
Returns: ret.first.
Remarks: It is unspecified whether errno ([errno]) is accessed.
template<class T, class Abi> constexpr basic_vec<T, Abi> modf(const type_identity_t<basic_vec<T, Abi>>& value, basic_vec<T, Abi>* iptr);
Let V be basic_vec<T, Abi>.
Let modf-vec denote: pair<V, V> modf-vec(const V& x) { T r1[Ret::size()]; V r0([&](simd-size-type i) { return modf(V(x)[i], &r1[i]); }); return {r0, V(r1)}; }
Let ret be a value of type pair<V, V> that is the same value as the result of calling modf-vec(value).
Effects: Sets *iptr to ret.second.
Returns: ret.first.