2namespace NATIVE_BACKEND_NAMESPACE::native {
4 template<
bool Flush = false,
unsigned Degree = 6,
float_register V, std::
size_t N>
5 requires (Degree >= 1 && Degree <= 7)
7 if constexpr (N == 0)
return input;
9 auto const [masks, replacements, values, exponents] =
10 ::math::detail::exp_reduced<Flush, Degree>(::wide::promote(input));
11 auto const & [...in_range] = masks;
12 auto const & [...replacement] = replacements;
13 auto const & [...y] = values;
14 auto const & [...n] = exponents;
17 return {{::wide::detail::native_ops<V>::exp_scale(in_range, replacement, y, n)...}};
20 template<
bool Flush = false,
unsigned Degree = 6,
float_register V>
21 requires (Degree >= 1 && Degree <= 7)
23 return ::NATIVE_BACKEND_NAMESPACE::native::exp<Flush, Degree>(std::array{x})[0];
25#if NATIVE_HAS_ARM_NEON
27 return ::NATIVE_BACKEND_NAMESPACE::native::exp(fp32x4(x)).value;
29 template<std::
size_t N>
31 if constexpr (N == 0)
return {};
33 auto const & [...value] = input;
34 auto const [...result] = ::NATIVE_BACKEND_NAMESPACE::native::exp(std::array{fp32x4(value)...});
35 return {{result.value...}};
43#define NATIVE_PROMOTED_MATH_ENTRY(name) \
44 template<std::size_t L, ::native::isa<> Arch> \
45 requires NATIVE_ARCH_REQUIRES(Arch) && ::NATIVE_BACKEND_NAMESPACE::float_shape<L> \
46 native_nodiscard native_inline constexpr simd<float,L,Arch> name(simd<float,L,Arch> input) noexcept { \
47 return ::math::name(input); \
49 template<std::size_t L, std::size_t N, ::native::isa<> Arch> \
50 requires NATIVE_ARCH_REQUIRES(Arch) && ::NATIVE_BACKEND_NAMESPACE::float_shape<L> \
51 native_nodiscard native_inline constexpr std::array<simd<float,L,Arch>,N> \
52 name(std::array<simd<float,L,Arch>,N> const & input) noexcept { return ::math::name(input); }
53 NATIVE_PROMOTED_MATH_ENTRY(
expm1)
55 NATIVE_PROMOTED_MATH_ENTRY(
log)
56 NATIVE_PROMOTED_MATH_ENTRY(
log2)
57 NATIVE_PROMOTED_MATH_ENTRY(
log1p)
58 NATIVE_PROMOTED_MATH_ENTRY(
tanh)
59#undef NATIVE_PROMOTED_MATH_ENTRY
62 template<
bool Flush = false, std::
size_t L, ::native::isa<> Arch>
63 requires NATIVE_ARCH_REQUIRES(Arch) && ::NATIVE_BACKEND_NAMESPACE::float_shape<L>
68 template<
bool Flush = false, std::
size_t L, std::
size_t N, ::native::isa<> Arch>
69 requires NATIVE_ARCH_REQUIRES(Arch) && ::NATIVE_BACKEND_NAMESPACE::float_shape<L>
74 template<
bool Flush, std::
size_t L, ::native::isa<> Arch>
75 requires NATIVE_ARCH_REQUIRES(Arch) && ::NATIVE_BACKEND_NAMESPACE::float_shape<L>
80 template<
bool Flush, std::
size_t L, std::
size_t N, ::native::isa<> Arch>
81 requires NATIVE_ARCH_REQUIRES(Arch) && ::NATIVE_BACKEND_NAMESPACE::float_shape<L>
84 return ::math::exp2<Flush>(input);
88 template<std::
size_t L, ::native::isa<> Arch>
89 requires NATIVE_ARCH_REQUIRES(Arch) && ::NATIVE_BACKEND_NAMESPACE::float_shape<L>
94 template<std::
size_t L, std::
size_t N, ::native::isa<> Arch>
95 requires NATIVE_ARCH_REQUIRES(Arch) && ::NATIVE_BACKEND_NAMESPACE::float_shape<L>
108 template<
bool Flush = false,
unsigned Degree = 6, std::
size_t L, ::native::isa<> Arch>
requires (Degree >= 1 && Degree <= 7) && NATIVE_ARCH_REQUIRES(Arch) && ::NATIVE_BACKEND_NAMESPACE::float_shape<L>
110 return ::NATIVE_BACKEND_NAMESPACE::native::exp<Flush, Degree>(input);
114 template<
bool Flush = false,
unsigned Degree = 6, std::
size_t L, std::
size_t N, ::native::isa<> Arch>
requires (Degree >= 1 && Degree <= 7) && NATIVE_ARCH_REQUIRES(Arch) && ::NATIVE_BACKEND_NAMESPACE::float_shape<L>
116 return ::NATIVE_BACKEND_NAMESPACE::native::exp<Flush, Degree>(input);
122 template<
bool Flush,
unsigned Degree = 6, std::
size_t L, std::
size_t N, ::native::isa<> Arch>
requires (Degree >= 1 && Degree <= 7) && NATIVE_ARCH_REQUIRES(Arch) && ::NATIVE_BACKEND_NAMESPACE::float_shape<L>
124 std::array<
simd<float,L,Arch>,N>
const & input, std::bool_constant<Flush>, std::integral_constant<unsigned, Degree> = {})
noexcept {
125 return ::NATIVE_BACKEND_NAMESPACE::native::exp<Flush, Degree>(input);
129 template<
bool Flush,
unsigned Degree = 6, std::
size_t L, ::native::isa<> Arch>
requires (Degree >= 1 && Degree <= 7) && NATIVE_ARCH_REQUIRES(Arch) && ::NATIVE_BACKEND_NAMESPACE::float_shape<L>
131 return ::NATIVE_BACKEND_NAMESPACE::native::exp<Flush, Degree>(input);
#define native_inline
inline [[always_inline]]
#define native_flatten
portable [[flatten]]
#define native_nodiscard
C++17 [[nodiscard]].
#define native_pure
[[pure]]
constexpr simd< float, L, Arch > atan2(simd< float, L, Arch > y, simd< float, L, Arch > x) noexcept
constexpr simd< float, L, Arch > exp2(simd< float, L, Arch > input) noexcept
constexpr simd< float, L, Arch > exp(simd< float, L, Arch > input) noexcept
Evaluate the binary32 range-reduced exponential approximation. Degree selects a polynomial from one t...
constexpr wide< R, N > tanh(wide< R, N > const &input) noexcept([] { if constexpr(requires(std::array< R, N > const &a) { detail::wide_generic_detail::adl_tanh(a);}) return noexcept(wide< R, N >{detail::wide_generic_detail::adl_tanh(std::declval< std::array< R, N > const & >())});else return noexcept(wide< R, N >()) &&std::is_nothrow_move_constructible_v< wide< R, N > > &&(N==0||noexcept(std::declval< R & >()=detail::wide_generic_detail::adl_tanh(std::declval< R const & >())));}())
constexpr wide< R, N > log(wide< R, N > const &input) noexcept([] { if constexpr(requires(std::array< R, N > const &a) { detail::wide_generic_detail::adl_log(a);}) return noexcept(wide< R, N >{detail::wide_generic_detail::adl_log(std::declval< std::array< R, N > const & >())});else return noexcept(wide< R, N >()) &&std::is_nothrow_move_constructible_v< wide< R, N > > &&(N==0||noexcept(std::declval< R & >()=detail::wide_generic_detail::adl_log(std::declval< R const & >())));}())
constexpr wide< R, N > log2(wide< R, N > const &input) noexcept([] { if constexpr(requires(std::array< R, N > const &a) { detail::wide_generic_detail::adl_log2(a);}) return noexcept(wide< R, N >{detail::wide_generic_detail::adl_log2(std::declval< std::array< R, N > const & >())});else return noexcept(wide< R, N >()) &&std::is_nothrow_move_constructible_v< wide< R, N > > &&(N==0||noexcept(std::declval< R & >()=detail::wide_generic_detail::adl_log2(std::declval< R const & >())));}())
constexpr wide< R, N > damping_gain(wide< R, N > const &input) noexcept([] { if constexpr(requires(std::array< R, N > const &a) { detail::wide_generic_detail::adl_damping_gain(a);}) return noexcept(wide< R, N >{detail::wide_generic_detail::adl_damping_gain(std::declval< std::array< R, N > const & >())});else return noexcept(wide< R, N >()) &&std::is_nothrow_move_constructible_v< wide< R, N > > &&(N==0||noexcept(std::declval< R & >()=detail::wide_generic_detail::adl_damping_gain(std::declval< R const & >())));}())
constexpr wide< R, N > expm1(wide< R, N > const &input) noexcept([] { if constexpr(requires(std::array< R, N > const &a) { detail::wide_generic_detail::adl_expm1(a);}) return noexcept(wide< R, N >{detail::wide_generic_detail::adl_expm1(std::declval< std::array< R, N > const & >())});else return noexcept(wide< R, N >()) &&std::is_nothrow_move_constructible_v< wide< R, N > > &&(N==0||noexcept(std::declval< R & >()=detail::wide_generic_detail::adl_expm1(std::declval< R const & >())));}())
constexpr wide< R, N > log1p(wide< R, N > const &input) noexcept([] { if constexpr(requires(std::array< R, N > const &a) { detail::wide_generic_detail::adl_log1p(a);}) return noexcept(wide< R, N >{detail::wide_generic_detail::adl_log1p(std::declval< std::array< R, N > const & >())});else return noexcept(wide< R, N >()) &&std::is_nothrow_move_constructible_v< wide< R, N > > &&(N==0||noexcept(std::declval< R & >()=detail::wide_generic_detail::adl_log1p(std::declval< R const & >())));}())
Architecture-tagged vectors, register packs and supporting value types. Native arithmetic follows its...
Omitted architecture arguments use the native.simd provider's baseline.