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

Namespaces

namespace  concepts
namespace  detail

Classes

struct  Abs
struct  Acos
struct  Acosh
struct  Arg
struct  Asin
struct  Asinh
struct  Atan
struct  Atan2
struct  Atanh
struct  Cbrt
struct  Ceil
class  Complex
 Implementation of a complex number usable on host and device. More...
struct  Conj
struct  Copysign
struct  Cos
struct  Cosh
struct  CudaHipMath
struct  Erf
struct  Exp
struct  Floor
struct  Fma
struct  Fmod
struct  Isfinite
struct  Isinf
struct  Isnan
struct  Llround
struct  Log
struct  Log10
struct  Log2
struct  Lround
struct  Max
struct  Min
struct  Pow
struct  Remainder
struct  Round
struct  Rsqrt
struct  Sin
struct  SinCos
struct  Sinh
struct  Sqrt
struct  StlMath
struct  SyclMath
struct  Tan
struct  Tanh
struct  Trunc

Functions

template<concepts::FloatingPoint T>
constexpr bool ieeeIsfinite (T const &arg)
template<concepts::FloatingPoint T>
constexpr bool ieeeIsinf (T const &arg)
template<concepts::FloatingPoint T>
constexpr bool ieeeIsnan (T const &arg)
template<typename T, typename TChar, typename TTraits>
std::basic_ostream< TChar, TTraits > & operator<< (std::basic_ostream< TChar, TTraits > &os, Complex< T > const &x)
 Host-only output of a complex number.
template<typename T, typename TChar, typename TTraits>
std::basic_istream< TChar, TTraits > & operator>> (std::basic_istream< TChar, TTraits > &is, Complex< T > const &x)
 Host-only input of a complex number.
template<typename T>
constexpr Complex< T > operator+ (Complex< T > const &val)
 Host-device arithmetic operations matching std::complex<T>.
template<typename T>
constexpr Complex< T > operator- (Complex< T > const &val)
 Unary minus.
template<typename T>
constexpr Complex< T > operator+ (Complex< T > const &lhs, Complex< T > const &rhs)
 Addition of two complex numbers.
template<typename T>
constexpr Complex< T > operator+ (Complex< T > const &lhs, T const &rhs)
 Addition of a complex and a real number.
template<typename T>
constexpr Complex< T > operator+ (T const &lhs, Complex< T > const &rhs)
 Addition of a real and a complex number.
template<typename T>
constexpr Complex< T > operator- (Complex< T > const &lhs, Complex< T > const &rhs)
 Subtraction of two complex numbers.
template<typename T>
constexpr Complex< T > operator- (Complex< T > const &lhs, T const &rhs)
 Subtraction of a complex and a real number.
template<typename T>
constexpr Complex< T > operator- (T const &lhs, Complex< T > const &rhs)
 Subtraction of a real and a complex number.
template<typename T>
constexpr Complex< T > operator* (Complex< T > const &lhs, Complex< T > const &rhs)
 Muptiplication of two complex numbers.
template<typename T>
constexpr Complex< T > operator* (Complex< T > const &lhs, T const &rhs)
 Muptiplication of a complex and a real number.
template<typename T>
constexpr Complex< T > operator* (T const &lhs, Complex< T > const &rhs)
 Muptiplication of a real and a complex number.
template<typename T>
constexpr Complex< T > operator/ (Complex< T > const &lhs, Complex< T > const &rhs)
 Division of two complex numbers.
template<typename T>
constexpr Complex< T > operator/ (Complex< T > const &lhs, T const &rhs)
 Division of complex and a real number.
template<typename T>
constexpr Complex< T > operator/ (T const &lhs, Complex< T > const &rhs)
 Division of a real and a complex number.
template<typename T>
constexpr bool operator== (Complex< T > const &lhs, Complex< T > const &rhs)
 Equality of two complex numbers.
template<typename T>
constexpr bool operator== (Complex< T > const &lhs, T const &rhs)
 Equality of a complex and a real number.
template<typename T>
constexpr bool operator== (T const &lhs, Complex< T > const &rhs)
 Equality of a real and a complex number.
template<typename T>
constexpr bool operator!= (Complex< T > const &lhs, Complex< T > const &rhs)
 Inequality of two complex numbers.
template<typename T>
constexpr bool operator!= (Complex< T > const &lhs, T const &rhs)
 Inequality of a complex and a real number.
template<typename T>
constexpr bool operator!= (T const &lhs, Complex< T > const &rhs)
 Inequality of a real and a complex number.
template<typename T>
constexpr T abs (Complex< T > const &x)
 Host-only math functions matching std::complex<T>.
template<typename T>
constexpr Complex< T > acos (Complex< T > const &x)
 Arc cosine.
template<typename T>
constexpr Complex< T > acosh (Complex< T > const &x)
 Arc hyperbolic cosine.
template<typename T>
constexpr T arg (Complex< T > const &x)
 Argument.
template<typename T>
constexpr Complex< T > asin (Complex< T > const &x)
 Arc sine.
template<typename T>
constexpr Complex< T > asinh (Complex< T > const &x)
 Arc hyperbolic sine.
template<typename T>
constexpr Complex< T > atan (Complex< T > const &x)
 Arc tangent.
template<typename T>
constexpr Complex< T > atanh (Complex< T > const &x)
 Arc hyperbolic tangent.
template<typename T>
constexpr Complex< T > conj (Complex< T > const &x)
 Complex conjugate.
template<typename T>
constexpr Complex< T > cos (Complex< T > const &x)
 Cosine.
template<typename T>
constexpr Complex< T > cosh (Complex< T > const &x)
 Hyperbolic cosine.
template<typename T>
constexpr Complex< T > exp (Complex< T > const &x)
 Exponential.
template<typename T>
constexpr Complex< T > log (Complex< T > const &x)
 Natural logarithm.
template<typename T>
constexpr Complex< T > log10 (Complex< T > const &x)
 Base 10 logarithm.
template<typename T>
constexpr T norm (Complex< T > const &x)
 Squared magnitude.
template<typename T>
constexpr Complex< T > polar (T const &r, T const &theta=T())
 Get a complex number with given magnitude and phase angle.
template<typename T, typename U>
constexpr auto pow (Complex< T > const &x, Complex< U > const &y)
 Complex power of a complex number.
template<typename T, typename U>
constexpr auto pow (Complex< T > const &x, U const &y)
 Real power of a complex number.
template<typename T, typename U>
constexpr auto pow (T const &x, Complex< U > const &y)
 Complex power of a real number.
template<typename T>
constexpr Complex< T > proj (Complex< T > const &x)
 Projection onto the Riemann sphere.
template<typename T>
constexpr Complex< T > sin (Complex< T > const &x)
 Sine.
template<typename T>
constexpr Complex< T > sinh (Complex< T > const &x)
 Hyperbolic sine.
template<typename T>
constexpr Complex< T > sqrt (Complex< T > const &x)
 Square root.
template<typename T>
constexpr Complex< T > tan (Complex< T > const &x)
 Tangent.
template<typename T>
constexpr Complex< T > tanh (Complex< T > const &x)
 Hyperbolic tangent.

Variables

constexpr auto cudaHipMath = CudaHipMath{}
constexpr auto stlMath = StlMath{}
constexpr auto syclMath = SyclMath{}

Function Documentation

◆ abs()

template<typename T>
T alpaka::math::internal::abs ( Complex< T > const & x)
constexpr

Host-only math functions matching std::complex<T>.

Due to issue #1688, these functions are technically marked host-device and suppress related warnings. However, they must be called for host only.

They take and return alpaka::math::Complex (or a real number when appropriate). Internally cast, fall back to std::complex implementation and cast back. These functions can be used directly on the host side. They are also picked up by ADL in math traits for CPU backends.

On the device side, alpaka math traits must be used instead. Note that the set of the traits is currently a bit smaller. Absolute value

Definition at line 378 of file Complex.hpp.

◆ acos()

template<typename T>
Complex< T > alpaka::math::internal::acos ( Complex< T > const & x)
constexpr

Arc cosine.

Definition at line 385 of file Complex.hpp.

◆ acosh()

template<typename T>
Complex< T > alpaka::math::internal::acosh ( Complex< T > const & x)
constexpr

Arc hyperbolic cosine.

Definition at line 392 of file Complex.hpp.

◆ arg()

template<typename T>
T alpaka::math::internal::arg ( Complex< T > const & x)
constexpr

Argument.

Definition at line 399 of file Complex.hpp.

◆ asin()

template<typename T>
Complex< T > alpaka::math::internal::asin ( Complex< T > const & x)
constexpr

Arc sine.

Definition at line 406 of file Complex.hpp.

◆ asinh()

template<typename T>
Complex< T > alpaka::math::internal::asinh ( Complex< T > const & x)
constexpr

Arc hyperbolic sine.

Definition at line 413 of file Complex.hpp.

◆ atan()

template<typename T>
Complex< T > alpaka::math::internal::atan ( Complex< T > const & x)
constexpr

Arc tangent.

Definition at line 420 of file Complex.hpp.

◆ atanh()

template<typename T>
Complex< T > alpaka::math::internal::atanh ( Complex< T > const & x)
constexpr

Arc hyperbolic tangent.

Definition at line 427 of file Complex.hpp.

◆ conj()

template<typename T>
Complex< T > alpaka::math::internal::conj ( Complex< T > const & x)
constexpr

Complex conjugate.

Definition at line 434 of file Complex.hpp.

◆ cos()

template<typename T>
Complex< T > alpaka::math::internal::cos ( Complex< T > const & x)
constexpr

Cosine.

Definition at line 441 of file Complex.hpp.

◆ cosh()

template<typename T>
Complex< T > alpaka::math::internal::cosh ( Complex< T > const & x)
constexpr

Hyperbolic cosine.

Definition at line 448 of file Complex.hpp.

◆ exp()

template<typename T>
Complex< T > alpaka::math::internal::exp ( Complex< T > const & x)
constexpr

Exponential.

Definition at line 455 of file Complex.hpp.

◆ ieeeIsfinite()

template<concepts::FloatingPoint T>
bool alpaka::math::internal::ieeeIsfinite ( T const & arg)
constexpr

Definition at line 67 of file ieee754.hpp.

◆ ieeeIsinf()

template<concepts::FloatingPoint T>
bool alpaka::math::internal::ieeeIsinf ( T const & arg)
constexpr

Definition at line 46 of file ieee754.hpp.

◆ ieeeIsnan()

template<concepts::FloatingPoint T>
bool alpaka::math::internal::ieeeIsnan ( T const & arg)
constexpr

Definition at line 25 of file ieee754.hpp.

◆ log()

template<typename T>
Complex< T > alpaka::math::internal::log ( Complex< T > const & x)
constexpr

Natural logarithm.

Definition at line 462 of file Complex.hpp.

◆ log10()

template<typename T>
Complex< T > alpaka::math::internal::log10 ( Complex< T > const & x)
constexpr

Base 10 logarithm.

Definition at line 469 of file Complex.hpp.

◆ norm()

template<typename T>
T alpaka::math::internal::norm ( Complex< T > const & x)
constexpr

Squared magnitude.

Definition at line 476 of file Complex.hpp.

◆ operator!=() [1/3]

template<typename T>
bool alpaka::math::internal::operator!= ( Complex< T > const & lhs,
Complex< T > const & rhs )
constexpr

Inequality of two complex numbers.

Note
this and other versions of operator != should be removed since C++20, as so does std::complex

Definition at line 319 of file Complex.hpp.

◆ operator!=() [2/3]

template<typename T>
bool alpaka::math::internal::operator!= ( Complex< T > const & lhs,
T const & rhs )
constexpr

Inequality of a complex and a real number.

Definition at line 326 of file Complex.hpp.

◆ operator!=() [3/3]

template<typename T>
bool alpaka::math::internal::operator!= ( T const & lhs,
Complex< T > const & rhs )
constexpr

Inequality of a real and a complex number.

Definition at line 334 of file Complex.hpp.

◆ operator*() [1/3]

template<typename T>
Complex< T > alpaka::math::internal::operator* ( Complex< T > const & lhs,
Complex< T > const & rhs )
constexpr

Muptiplication of two complex numbers.

Definition at line 243 of file Complex.hpp.

◆ operator*() [2/3]

template<typename T>
Complex< T > alpaka::math::internal::operator* ( Complex< T > const & lhs,
T const & rhs )
constexpr

Muptiplication of a complex and a real number.

Definition at line 252 of file Complex.hpp.

◆ operator*() [3/3]

template<typename T>
Complex< T > alpaka::math::internal::operator* ( T const & lhs,
Complex< T > const & rhs )
constexpr

Muptiplication of a real and a complex number.

Definition at line 259 of file Complex.hpp.

◆ operator+() [1/4]

template<typename T>
Complex< T > alpaka::math::internal::operator+ ( Complex< T > const & lhs,
Complex< T > const & rhs )
constexpr

Addition of two complex numbers.

Definition at line 201 of file Complex.hpp.

◆ operator+() [2/4]

template<typename T>
Complex< T > alpaka::math::internal::operator+ ( Complex< T > const & lhs,
T const & rhs )
constexpr

Addition of a complex and a real number.

Definition at line 208 of file Complex.hpp.

◆ operator+() [3/4]

template<typename T>
Complex< T > alpaka::math::internal::operator+ ( Complex< T > const & val)
constexpr

Host-device arithmetic operations matching std::complex<T>.

They take and return alpaka::math::Complex. Unary plus (added for compatibility with std::complex)

Definition at line 187 of file Complex.hpp.

◆ operator+() [4/4]

template<typename T>
Complex< T > alpaka::math::internal::operator+ ( T const & lhs,
Complex< T > const & rhs )
constexpr

Addition of a real and a complex number.

Definition at line 215 of file Complex.hpp.

◆ operator-() [1/4]

template<typename T>
Complex< T > alpaka::math::internal::operator- ( Complex< T > const & lhs,
Complex< T > const & rhs )
constexpr

Subtraction of two complex numbers.

Definition at line 222 of file Complex.hpp.

◆ operator-() [2/4]

template<typename T>
Complex< T > alpaka::math::internal::operator- ( Complex< T > const & lhs,
T const & rhs )
constexpr

Subtraction of a complex and a real number.

Definition at line 229 of file Complex.hpp.

◆ operator-() [3/4]

template<typename T>
Complex< T > alpaka::math::internal::operator- ( Complex< T > const & val)
constexpr

Unary minus.

Definition at line 194 of file Complex.hpp.

◆ operator-() [4/4]

template<typename T>
Complex< T > alpaka::math::internal::operator- ( T const & lhs,
Complex< T > const & rhs )
constexpr

Subtraction of a real and a complex number.

Definition at line 236 of file Complex.hpp.

◆ operator/() [1/3]

template<typename T>
Complex< T > alpaka::math::internal::operator/ ( Complex< T > const & lhs,
Complex< T > const & rhs )
constexpr

Division of two complex numbers.

Definition at line 266 of file Complex.hpp.

◆ operator/() [2/3]

template<typename T>
Complex< T > alpaka::math::internal::operator/ ( Complex< T > const & lhs,
T const & rhs )
constexpr

Division of complex and a real number.

Definition at line 277 of file Complex.hpp.

◆ operator/() [3/3]

template<typename T>
Complex< T > alpaka::math::internal::operator/ ( T const & lhs,
Complex< T > const & rhs )
constexpr

Division of a real and a complex number.

Definition at line 284 of file Complex.hpp.

◆ operator<<()

template<typename T, typename TChar, typename TTraits>
std::basic_ostream< TChar, TTraits > & alpaka::math::internal::operator<< ( std::basic_ostream< TChar, TTraits > & os,
Complex< T > const & x )

Host-only output of a complex number.

Definition at line 334 of file Complex.hpp.

◆ operator==() [1/3]

template<typename T>
bool alpaka::math::internal::operator== ( Complex< T > const & lhs,
Complex< T > const & rhs )
constexpr

Equality of two complex numbers.

Definition at line 293 of file Complex.hpp.

◆ operator==() [2/3]

template<typename T>
bool alpaka::math::internal::operator== ( Complex< T > const & lhs,
T const & rhs )
constexpr

Equality of a complex and a real number.

Definition at line 301 of file Complex.hpp.

◆ operator==() [3/3]

template<typename T>
bool alpaka::math::internal::operator== ( T const & lhs,
Complex< T > const & rhs )
constexpr

Equality of a real and a complex number.

Definition at line 309 of file Complex.hpp.

◆ operator>>()

template<typename T, typename TChar, typename TTraits>
std::basic_istream< TChar, TTraits > & alpaka::math::internal::operator>> ( std::basic_istream< TChar, TTraits > & is,
Complex< T > const & x )

Host-only input of a complex number.

Definition at line 352 of file Complex.hpp.

◆ polar()

template<typename T>
Complex< T > alpaka::math::internal::polar ( T const & r,
T const & theta = T() )
constexpr

Get a complex number with given magnitude and phase angle.

Definition at line 483 of file Complex.hpp.

◆ pow() [1/3]

template<typename T, typename U>
auto alpaka::math::internal::pow ( Complex< T > const & x,
Complex< U > const & y )
constexpr

Complex power of a complex number.

Definition at line 490 of file Complex.hpp.

◆ pow() [2/3]

template<typename T, typename U>
auto alpaka::math::internal::pow ( Complex< T > const & x,
U const & y )
constexpr

Real power of a complex number.

Definition at line 500 of file Complex.hpp.

◆ pow() [3/3]

template<typename T, typename U>
auto alpaka::math::internal::pow ( T const & x,
Complex< U > const & y )
constexpr

Complex power of a real number.

Definition at line 507 of file Complex.hpp.

◆ proj()

template<typename T>
Complex< T > alpaka::math::internal::proj ( Complex< T > const & x)
constexpr

Projection onto the Riemann sphere.

Definition at line 514 of file Complex.hpp.

◆ sin()

template<typename T>
Complex< T > alpaka::math::internal::sin ( Complex< T > const & x)
constexpr

Sine.

Definition at line 521 of file Complex.hpp.

◆ sinh()

template<typename T>
Complex< T > alpaka::math::internal::sinh ( Complex< T > const & x)
constexpr

Hyperbolic sine.

Definition at line 528 of file Complex.hpp.

◆ sqrt()

template<typename T>
Complex< T > alpaka::math::internal::sqrt ( Complex< T > const & x)
constexpr

Square root.

Definition at line 535 of file Complex.hpp.

◆ tan()

template<typename T>
Complex< T > alpaka::math::internal::tan ( Complex< T > const & x)
constexpr

Tangent.

Definition at line 542 of file Complex.hpp.

◆ tanh()

template<typename T>
Complex< T > alpaka::math::internal::tanh ( Complex< T > const & x)
constexpr

Hyperbolic tangent.

Definition at line 549 of file Complex.hpp.

Variable Documentation

◆ cudaHipMath

auto alpaka::math::internal::cudaHipMath = CudaHipMath{}
constexpr

Definition at line 24 of file tag.hpp.

◆ stlMath

auto alpaka::math::internal::stlMath = StlMath{}
constexpr

Definition at line 17 of file stlMath.hpp.

◆ syclMath

auto alpaka::math::internal::syclMath = SyclMath{}
constexpr

Definition at line 24 of file tag.hpp.