Kokkos::complex#
Header File: Kokkos_Core.hpp
Usage:
Kokkos::complex<double> a,b;
a.imag() = 5.0; a.real() = 1.0
b = a;
a += b;
Synopsis#
template<class Scalar>
class complex {
public:
typedef Scalar value_type;
private:
value_type re,im;
public:
KOKKOS_INLINE_FUNCTION complex();
KOKKOS_INLINE_FUNCTION complex(const complex& src);
template<class T>
KOKKOS_INLINE_FUNCTION complex(const T& re);
template <class T1, class T2>
KOKKOS_INLINE_FUNCTION complex(const T1& re, const T2& im)
template<class T>
complex(const std::complex<T>& src);
template<class T>
KOKKOS_INLINE_FUNCTION complex<Scalar>& operator= (const complex<T>& src);
template<class T>
KOKKOS_INLINE_FUNCTION complex<Scalar>& operator= (const T& re);
template<class T>
KOKKOS_INLINE_FUNCTION complex<Scalar>& operator= (const std::complex<T>& src);
template<class T>
operator std::complex<Scalar>() const;
KOKKOS_INLINE_FUNCTION RealType& imag();
KOKKOS_INLINE_FUNCTION RealType& real();
KOKKOS_INLINE_FUNCTION const RealType imag() const;
KOKKOS_INLINE_FUNCTION const RealType real() const;
KOKKOS_INLINE_FUNCTION void imag(RealType v);
KOKKOS_INLINE_FUNCTION void real(RealType v);
template<class T>
KOKKOS_INLINE_FUNCTION complex& operator += (const complex<T>& src);
template<class T>
complex& operator += (const std::complex<T>& src);
template<class T>
KOKKOS_INLINE_FUNCTION complex& operator += (const T& real);
template<class T>
KOKKOS_INLINE_FUNCTION complex& operator -= (const complex<T>& src);
template<class T>
complex& operator -= (const std::complex<T>& src);
template<class T>
KOKKOS_INLINE_FUNCTION complex& operator -= (const T& real);
template<class T>
KOKKOS_INLINE_FUNCTION complex& operator *= (const complex<T>& src);
template<class T>
complex& operator *= (const std::complex<T>& src);
template<class T>
KOKKOS_INLINE_FUNCTION complex& operator *= (const T& real);
template<class T>
KOKKOS_INLINE_FUNCTION complex& operator /= (const complex<T>& src);
template<class T>
complex& operator /= (const std::complex<T>& src);
template<class T>
KOKKOS_INLINE_FUNCTION complex& operator /= (const T& real);
template<class T>
KOKKOS_INLINE_FUNCTION complex& operator == (const complex<T>& src);
template<class T>
complex& operator == (const std::complex<T>& src);
template<class T>
KOKKOS_INLINE_FUNCTION complex& operator == (const T& real);
template<class T>
KOKKOS_INLINE_FUNCTION complex& operator != (const complex<T>& src);
template<class T>
complex& operator != (const std::complex<T>& src);
template<class T>
KOKKOS_INLINE_FUNCTION complex& operator != (const T& real);
};
Public Class Members#
Typedefs#
value_type: The scalar type of the real and the imaginary component.
Constructors#
KOKKOS_INLINE_FUNCTION complex();
Default constructor. Initializes the
reandimwithvalue_type().KOKKOS_INLINE_FUNCTION complex(const complex& src);
Copy constructor. Sets
re = src.real()andim = src.imag().template<class T> KOKKOS_INLINE_FUNCTION complex(const T& real);
Constructor from a real number. Sets
re = realandim = value_type().template <class T1, class T2> KOKKOS_INLINE_FUNCTION complex(const T1& real, const T2& imag)
Constructor from real numbers. Sets
re = realandim = imag.template<class T> complex(const std::complex<T>& src);
Copy constructor. Sets
re = src.real()andim = src.imag().
Assignment and conversion#
template<class T> KOKKOS_INLINE_FUNCTION complex<Scalar>& operator= (const complex<T>& src);
Sets
re = src.real()andim = src.imag().template<class T> KOKKOS_INLINE_FUNCTION complex<Scalar>& operator= (const T& re);
Sets
re = src.real()andim = value_type().template<class T> KOKKOS_INLINE_FUNCTION complex<Scalar>& operator= (const std::complex<T>& src);
Sets
re = src.real()andim = src.imag().operator std::complex<value_type>() const;
Returns
std::complex<value_type>(re,im).
Functions#
KOKKOS_INLINE_FUNCTION RealType& imag();
Return
im.KOKKOS_INLINE_FUNCTION RealType& real();
Return
re.KOKKOS_INLINE_FUNCTION const RealType imag() const;
Return
im.KOKKOS_INLINE_FUNCTION const RealType real() const;
Return
re.KOKKOS_INLINE_FUNCTION void imag(RealType v);
Sets
im = v.KOKKOS_INLINE_FUNCTION void real(RealType v);
Sets
re = v.template<class T> KOKKOS_INLINE_FUNCTION complex& operator += (const complex<T>& src);
Executes
re += src.real(); im += src.imag(); return *this;template<class T> complex& operator += (const std::complex<T>& src);
Executes
re += src.real(); im += src.imag(); return *this;template<class T> KOKKOS_INLINE_FUNCTION complex& operator += (const T& real);
Executes
re += real; return *this;template<class T> KOKKOS_INLINE_FUNCTION complex& operator -= (const complex<T>& src);
Executes
re -= src.real(); im -= src.imag(); return *this;template<class T> complex& operator -= (const std::complex<T>& src);
Executes
re -= src.real(); im -= src.imag(); return *this;template<class T> KOKKOS_INLINE_FUNCTION complex& operator -= (const T& real);
Executes
re -= real; return *this;template<class T> KOKKOS_INLINE_FUNCTION complex& operator *= (const complex<T>& src);
Multiplies the current complex number with the complex number src.
template<class T> complex& operator *= (const std::complex<T>& src);
Multiplies the current complex number with the complex number
src.template<class T> KOKKOS_INLINE_FUNCTION complex& operator *= (const T& real);
Executes
re *= real; im *= real; return *this;template<class T> KOKKOS_INLINE_FUNCTION complex& operator /= (const complex<T>& src);
Divides the current complex number with the complex number
src.template<class T> complex& operator /= (const std::complex<T>& src);
Divides the current complex number with the complex number
src.template<class T> KOKKOS_INLINE_FUNCTION complex& operator /= (const T& real);
Executes
re /= real; im /= real; return *this;template<class T> KOKKOS_INLINE_FUNCTION complex& operator == (const complex<T>& src);
Returns
re == src.real() && im == src.imag().template<class T> complex& operator == (const std::complex<T>& src);
Returns
re == src.real() && im == src.imag().template<class T> KOKKOS_INLINE_FUNCTION complex& operator == (const T& real);
Returns
re == src.real() && im == value_type().template<class T> KOKKOS_INLINE_FUNCTION complex& operator != (const complex<T>& src);
Returns
re != src.real() || im != src.imag().template<class T> complex& operator != (const std::complex<T>& src);
Returns
re != src.real() || im != src.imag().template<class T> KOKKOS_INLINE_FUNCTION complex& operator != (const T& real);
Returns
re != src.real() || im != value_type().