alpaka
Abstraction Library for Parallel Kernel Acceleration
Loading...
Searching...
No Matches
alpaka::math Namespace Reference

Namespaces

namespace  constants

Classes

class  Complex
 Implementation of a complex number usable on host and device. More...

Functions

constexpr auto abs (auto const &arg)
constexpr auto acos (auto const &arg)
constexpr auto acosh (auto const &arg)
constexpr auto arg (auto const &arg)
constexpr auto asin (auto const &arg)
constexpr auto asinh (auto const &arg)
constexpr auto atan (auto const &arg)
constexpr auto atan2 (auto const &y, auto const &x)
constexpr auto atanh (auto const &arg)
constexpr auto cbrt (auto const &arg)
constexpr auto ceil (auto const &arg)
constexpr auto conj (auto const &arg)
 Computes the complex conjugate of arg.
constexpr auto copysign (auto const &mag, auto const &sgn)
 Creates a value with the magnitude of mag and the sign of sgn.
constexpr auto cos (auto const &arg)
constexpr auto cosh (auto const &arg)
constexpr auto erf (auto const &arg)
constexpr auto exp (auto const &arg)
template<typename T>
ALPAKA_FN_INLINE constexpr auto floatEqualExactNoWarning (T a, T b) -> bool
 Compare two floating point numbers for exact equivalence.
constexpr auto floor (auto const &arg)
constexpr auto fma (auto const &x, auto const &y, auto const &z)
constexpr auto fmod (auto const &x, auto const &y)
constexpr auto isfinite (auto const &arg)
constexpr auto isinf (auto const &arg)
constexpr auto isnan (auto const &arg)
constexpr auto llround (auto const &arg)
 Computes the nearest integer value to arg (in integer format), rounding halfway cases away from zero, regardless of the current rounding mode.
constexpr auto log (auto const &arg)
 Computes the natural (base e) logarithm of arg.
constexpr auto log10 (auto const &arg)
constexpr auto log2 (auto const &arg)
 Computes the base 2 logarithm of arg.
constexpr auto lround (auto const &arg)
 Computes the nearest integer value to arg (in integer format), rounding halfway cases away from zero, regardless of the current rounding mode.
constexpr auto max (auto const &a, auto const &b)
constexpr auto min (auto const &a, auto const &b)
constexpr auto pow (auto const &base, auto const &exp)
constexpr auto remainder (auto const &x, auto const &y)
constexpr auto round (auto const &arg)
 Computes the nearest integer value to arg (in floating-point format), rounding halfway cases away from zero, regardless of the current rounding mode.
constexpr auto rsqrt (auto const &arg)
constexpr auto sin (auto const &arg)
constexpr auto sincos (auto const &arg, auto &result_sin, auto &result_cos)
constexpr auto sinh (auto const &arg)
constexpr auto sqrt (auto const &arg)
constexpr auto tan (auto const &arg)
constexpr auto tanh (auto const &arg)
constexpr auto trunc (auto const &arg)

Function Documentation

◆ abs()

auto alpaka::math::abs ( auto const & arg)
constexpr

Definition at line 15 of file math.hpp.

◆ acos()

auto alpaka::math::acos ( auto const & arg)
constexpr

Definition at line 246 of file math.hpp.

◆ acosh()

auto alpaka::math::acosh ( auto const & arg)
constexpr

Definition at line 27 of file math.hpp.

◆ arg()

auto alpaka::math::arg ( auto const & arg)
constexpr

Definition at line 146 of file math.hpp.

◆ asin()

auto alpaka::math::asin ( auto const & arg)
constexpr

Definition at line 253 of file math.hpp.

◆ asinh()

auto alpaka::math::asinh ( auto const & arg)
constexpr

Definition at line 33 of file math.hpp.

◆ atan()

auto alpaka::math::atan ( auto const & arg)
constexpr

Definition at line 45 of file math.hpp.

◆ atan2()

auto alpaka::math::atan2 ( auto const & y,
auto const & x )
constexpr

Definition at line 152 of file math.hpp.

◆ atanh()

auto alpaka::math::atanh ( auto const & arg)
constexpr

Definition at line 69 of file math.hpp.

◆ cbrt()

auto alpaka::math::cbrt ( auto const & arg)
constexpr

Definition at line 81 of file math.hpp.

◆ ceil()

auto alpaka::math::ceil ( auto const & arg)
constexpr

Definition at line 87 of file math.hpp.

◆ conj()

auto alpaka::math::conj ( auto const & arg)
constexpr

Computes the complex conjugate of arg.

Definition at line 266 of file math.hpp.

◆ copysign()

auto alpaka::math::copysign ( auto const & mag,
auto const & sgn )
constexpr

Creates a value with the magnitude of mag and the sign of sgn.

Definition at line 121 of file math.hpp.

◆ cos()

auto alpaka::math::cos ( auto const & arg)
constexpr

Definition at line 178 of file math.hpp.

◆ cosh()

auto alpaka::math::cosh ( auto const & arg)
constexpr

Definition at line 184 of file math.hpp.

◆ erf()

auto alpaka::math::erf ( auto const & arg)
constexpr

Definition at line 190 of file math.hpp.

◆ exp()

auto alpaka::math::exp ( auto const & arg)
constexpr

Definition at line 140 of file math.hpp.

◆ floatEqualExactNoWarning()

template<typename T>
ALPAKA_FN_INLINE constexpr auto alpaka::math::floatEqualExactNoWarning ( T a,
T b ) -> bool
constexpr

Compare two floating point numbers for exact equivalence.

Use only when necessary, and be aware of the implications. Most codes should not use this function and instead implement a correct epsilon-based comparison. If you are unfamiliar with the topic, check out https://www.geeksforgeeks.org/problem-in-comparing-floating-point-numbers-and-how-to-compare-them-correctly/ or Goldberg 1991: "What every computer scientist should know about floating-point arithmetic", https://dl.acm.org/doi/10.1145/103162.103163

This function calls the == operator for floating point types, but disables the warning issued by the compiler when compiling with the float equality warning checks enabled. This warning is valid an valuable in most codes and should be generally enabled, but there are specific instances where a piece of code might need to do an exact comparison (e.g. CudaVectorArrayWrapperTest.cpp). The verbose name for the function is intentional as it should raise a red flag if used while not absolutely needed. Users are advised to add a justification whenever they use this function.

Template Parameters
Tboth operands have to be the same type and conform to std::is_floating_point
Parameters
afirst operand
bsecond operand
Returns
a == b

Definition at line 35 of file floatEqualExact.hpp.

◆ floor()

auto alpaka::math::floor ( auto const & arg)
constexpr

Definition at line 196 of file math.hpp.

◆ fma()

auto alpaka::math::fma ( auto const & x,
auto const & y,
auto const & z )
constexpr

Definition at line 305 of file math.hpp.

◆ fmod()

auto alpaka::math::fmod ( auto const & x,
auto const & y )
constexpr

Definition at line 293 of file math.hpp.

◆ isfinite()

auto alpaka::math::isfinite ( auto const & arg)
constexpr

Definition at line 63 of file math.hpp.

◆ isinf()

auto alpaka::math::isinf ( auto const & arg)
constexpr

Definition at line 57 of file math.hpp.

◆ isnan()

auto alpaka::math::isnan ( auto const & arg)
constexpr

Definition at line 259 of file math.hpp.

◆ llround()

auto alpaka::math::llround ( auto const & arg)
constexpr

Computes the nearest integer value to arg (in integer format), rounding halfway cases away from zero, regardless of the current rounding mode.

Definition at line 114 of file math.hpp.

◆ log()

auto alpaka::math::log ( auto const & arg)
constexpr

Computes the natural (base e) logarithm of arg.

Valid real arguments are non-negative. For other values the result may depend on the backend and compilation options, will likely be NaN.

Definition at line 208 of file math.hpp.

◆ log10()

auto alpaka::math::log10 ( auto const & arg)
constexpr

Definition at line 232 of file math.hpp.

◆ log2()

auto alpaka::math::log2 ( auto const & arg)
constexpr

Computes the base 2 logarithm of arg.

Valid real arguments are non-negative. For other values the result may depend on the backend and compilation options, will likely be NaN.

Definition at line 220 of file math.hpp.

◆ lround()

auto alpaka::math::lround ( auto const & arg)
constexpr

Computes the nearest integer value to arg (in integer format), rounding halfway cases away from zero, regardless of the current rounding mode.

Definition at line 105 of file math.hpp.

◆ max()

auto alpaka::math::max ( auto const & a,
auto const & b )
constexpr

Definition at line 278 of file math.hpp.

◆ min()

auto alpaka::math::min ( auto const & a,
auto const & b )
constexpr

Definition at line 272 of file math.hpp.

◆ pow()

auto alpaka::math::pow ( auto const & base,
auto const & exp )
constexpr

Definition at line 284 of file math.hpp.

◆ remainder()

auto alpaka::math::remainder ( auto const & x,
auto const & y )
constexpr

Definition at line 299 of file math.hpp.

◆ round()

auto alpaka::math::round ( auto const & arg)
constexpr

Computes the nearest integer value to arg (in floating-point format), rounding halfway cases away from zero, regardless of the current rounding mode.

Definition at line 96 of file math.hpp.

◆ rsqrt()

auto alpaka::math::rsqrt ( auto const & arg)
constexpr

Definition at line 171 of file math.hpp.

◆ sin()

auto alpaka::math::sin ( auto const & arg)
constexpr

Definition at line 21 of file math.hpp.

◆ sincos()

auto alpaka::math::sincos ( auto const & arg,
auto & result_sin,
auto & result_cos )
constexpr

Definition at line 130 of file math.hpp.

◆ sinh()

auto alpaka::math::sinh ( auto const & arg)
constexpr

Definition at line 39 of file math.hpp.

◆ sqrt()

auto alpaka::math::sqrt ( auto const & arg)
constexpr

Definition at line 159 of file math.hpp.

◆ tan()

auto alpaka::math::tan ( auto const & arg)
constexpr

Definition at line 239 of file math.hpp.

◆ tanh()

auto alpaka::math::tanh ( auto const & arg)
constexpr

Definition at line 75 of file math.hpp.

◆ trunc()

auto alpaka::math::trunc ( auto const & arg)
constexpr

Definition at line 51 of file math.hpp.