![]() |
alpaka
Abstraction Library for Parallel Kernel Acceleration
|
Implementation of a complex number usable on host and device. More...
#include <Complex.hpp>
Implementation of a complex number usable on host and device.
It follows the layout of std::complex and so array-oriented access. The class template implements all methods and operators as std::complex<T>. Additionally, it provides an implicit conversion to and from std::complex<T>. All methods besides operators << and >> are host-device. It does not provide non-member functions of std::complex besides the operators. Those are provided the same way as alpaka math functions for real numbers.
Note that unlike most of alpaka, this is a concrete type template, and not merely a concept.
Naming and order of the methods match https://en.cppreference.com/w/cpp/numeric/complex in C++17. Implementation chose to not extend it e.g. by adding constexpr to some places that would get it in C++20. The motivation is that with internal conversion to std::complex<T> for CPU backends, it would define the common interface for generic code anyways. So it is more clear to have alpaka's interface exactly matching when possible, and not "improving".
| T | type of the real and imaginary part: float, double, or long double. |
Definition at line 41 of file Complex.hpp.