16namespace alpaka::math::internal
19#define ALPAKA_MATH_UNARY_FUNCTOR(FUNC_NAME, OP_NAME) \
22 template<typename T_MathImpl, typename T_Arg> \
25 constexpr auto operator()(T_MathImpl, T_Arg const& argument) const \
27 if constexpr(std::same_as<T_MathImpl, StlMath>) \
31 return OP_NAME(argument); \
34 return OP_NAME(argument); \
81#undef ALPAKA_MATH_UNARY_FUNCTOR
86 template<
typename T_Arg>
91 return static_cast<T_Arg
>(1) / sqrt(arg);
97 template<
typename T_MathImpl,
typename T_Arg>
100 constexpr auto operator()(T_MathImpl, T_Arg
const& arg)
const
102 if constexpr(std::same_as<T_MathImpl, StlMath>)
116 template<
typename T_MathImpl,
typename T_Y,
typename T_X>
119 constexpr auto operator()(T_MathImpl, T_Y
const& y, T_X
const& x)
const
121 if constexpr(std::same_as<T_MathImpl, StlMath>)
136 template<
typename T_Arg>
137 constexpr auto sincos(T_Arg
const& arg, T_Arg& result_sin, T_Arg& result_cos)
141 result_sin =
sin(arg);
143 result_cos =
cos(arg);
150 template<
typename T_MathImpl,
typename T_Arg>
153 constexpr auto operator()(T_MathImpl, T_Arg
const& arg, T_Arg& result_sin, T_Arg& result_cos)
const
155 if constexpr(std::same_as<T_MathImpl, StlMath>)
158 using detail::sincos;
159 return sincos(arg, result_sin, result_cos);
162 return sincos(arg, result_sin, result_cos);
169 template<
typename T_MathImpl,
typename T_Mag,
typename T_Sgn>
172 constexpr auto operator()(T_MathImpl, T_Mag
const& mag, T_Sgn
const& sgn)
const
174 if constexpr(std::same_as<T_MathImpl, StlMath>)
188 template<
typename T_MathImpl,
typename T_A,
typename T_B>
191 constexpr auto operator()(T_MathImpl, T_A
const& a, T_B
const& b)
const
193 if constexpr(std::same_as<T_MathImpl, StlMath>)
207 template<
typename T_MathImpl,
typename T_A,
typename T_B>
210 constexpr auto operator()(T_MathImpl, T_A
const& a, T_B
const& b)
const
212 if constexpr(std::same_as<T_MathImpl, StlMath>)
226 template<
typename T_MathImpl,
typename T_Base,
typename T_Exp>
229 constexpr auto operator()(T_MathImpl, T_Base
const& base, T_Exp
const& exp)
const
231 if constexpr(std::same_as<T_MathImpl, StlMath>)
235 return pow(base, exp);
238 return pow(base, exp);
245 template<
typename T_MathImpl,
typename T_X,
typename T_Y>
248 constexpr auto operator()(T_MathImpl, T_X
const& x, T_Y
const& y)
const
250 if constexpr(std::same_as<T_MathImpl, StlMath>)
264 template<
typename T_MathImpl,
typename T_X,
typename T_Y>
267 constexpr auto operator()(T_MathImpl, T_X
const& x, T_Y
const& y)
const
269 if constexpr(std::same_as<T_MathImpl, StlMath>)
272 using std::remainder;
283 template<
typename T_MathImpl,
typename T_X,
typename T_Y,
typename T_Z>
286 constexpr auto operator()(T_MathImpl, T_X
const& x, T_Y
const& y, T_Z
const& z)
const
288 if constexpr(std::same_as<T_MathImpl, StlMath>)
#define ALPAKA_FN_INLINE
Macro defining the inline function attribute.
#define ALPAKA_MATH_UNARY_FUNCTOR(FUNC_NAME, OP_NAME)
constexpr auto floor(auto const &arg)
constexpr auto sin(auto const &arg)
constexpr auto rsqrt(auto const &arg)
constexpr auto ceil(auto const &arg)
constexpr auto fmod(auto const &x, auto const &y)
constexpr auto fma(auto const &x, auto const &y, auto const &z)
constexpr auto atan2(auto const &y, auto const &x)
constexpr auto isnan(auto const &arg)
constexpr auto lround(auto const &arg)
Computes the nearest integer value to arg (in in integer format), rounding halfway cases away from ze...
constexpr auto copysign(auto const &mag, auto const &sgn)
Creates a value with the magnitude of mag and the sign of sgn.
constexpr auto sincos(auto const &arg, auto &result_sin, auto &result_cos)
constexpr auto cbrt(auto const &arg)
constexpr auto remainder(auto const &x, auto const &y)
constexpr auto isinf(auto const &arg)
constexpr auto log2(auto const &arg)
Computes the natural (base 2) logarithm of arg.
constexpr auto trunc(auto const &arg)
constexpr auto round(auto const &arg)
Computes the nearest integer value to arg (in floating-point format), rounding halfway cases away fro...
constexpr auto erf(auto const &arg)
constexpr auto min(auto const &a, auto const &b)
constexpr auto isfinite(auto const &arg)
constexpr auto llround(auto const &arg)
Computes the nearest integer value to arg (in in integer format), rounding halfway cases away from ze...
constexpr auto cos(auto const &arg)
constexpr auto max(auto const &a, auto const &b)
constexpr auto pow(auto const &base, auto const &exp)