Skip to content
This repository has been archived by the owner on Apr 15, 2024. It is now read-only.

Kokkos::Complex

crtrott edited this page Aug 14, 2019 · 2 revisions

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);
    KOKKOS_INLINE_FUNCTION complex(const volatile 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 volatile complex<T>& src);
    template<class T>
    KOKKOS_INLINE_FUNCTION complex<Scalar>& operator= (const complex<T>& src) volatile;
    template<class T>
    KOKKOS_INLINE_FUNCTION complex<Scalar>& operator= (const volatile complex<T>& src) volatile;

    template<class T>
    KOKKOS_INLINE_FUNCTION complex<Scalar>& operator= (const T& re);
    template<class T>
    KOKKOS_INLINE_FUNCTION complex<Scalar>& operator= (const T& re) volatile;

    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 volatile RealType& imag() volatile;
    KOKKOS_INLINE_FUNCTION volatile RealType& real() volatile;
    KOKKOS_INLINE_FUNCTION const RealType imag() const volatile;
    KOKKOS_INLINE_FUNCTION const RealType real() const volatile;
    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>
    KOKKOS_INLINE_FUNCTION complex& operator += (const volatile complex<T>& src) volatile;
    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 volatile T& real) 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>
    KOKKOS_INLINE_FUNCTION complex& operator *= (const volatile complex<T>& src) volatile;
    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 volatile T& real) 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 re and im with value_type().

  •    KOKKOS_INLINE_FUNCTION complex(const complex& src);

    Copy constructor. Sets re = src.real() and im = src.imag().

  •    KOKKOS_INLINE_FUNCTION complex(const volatile complex& src);

    Copy constructor. Sets re = src.real() and im = src.imag().

  •    template<class T>
       KOKKOS_INLINE_FUNCTION complex(const T& real);

    Constructor from a real number. Sets re = real and im = value_type().

  •    template <class T1, class T2>
       KOKKOS_INLINE_FUNCTION complex(const T1& real, const T2& imag)

    Constructor from real numbers. Sets re = real and im = imag.

  •    template<class T>
       complex(const std::complex<T>& src);

    Copy constructor. Sets re = src.real() and im = src.imag().

Assignment and conversion

  •    template<class T>
       KOKKOS_INLINE_FUNCTION complex<Scalar>& operator= (const complex<T>& src);

    Sets re = src.real() and im = src.imag().

  •    template<class T>
       KOKKOS_INLINE_FUNCTION complex<Scalar>& operator= (const volatile complex<T>& src);

    Sets re = src.real() and im = src.imag().

  •    template<class T>
       KOKKOS_INLINE_FUNCTION complex<Scalar>& operator= (const complex<T>& src) volatile;

    Sets re = src.real() and im = src.imag().

  •    template<class T>
       KOKKOS_INLINE_FUNCTION complex<Scalar>& operator= (const volatile complex<T>& src) volatile;

    Sets re = src.real() and im = src.imag().

  •    template<class T>
       KOKKOS_INLINE_FUNCTION complex<Scalar>& operator= (const T& re);

    Sets re = src.real() and im = value_type().

  •    template<class T>
       KOKKOS_INLINE_FUNCTION complex<Scalar>& operator= (const T& re) volatile;

    Sets re = src.real() and im = value_type().

  •    template<class T>
       KOKKOS_INLINE_FUNCTION complex<Scalar>& operator= (const std::complex<T>& src);

    Sets re = src.real() and im = 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 volatile RealType& imag() volatile;

    Return im.

  •    KOKKOS_INLINE_FUNCTION volatile RealType& real() volatile;

    Return re.

  •    KOKKOS_INLINE_FUNCTION const RealType imag() const volatile;

    Return im.

  •    KOKKOS_INLINE_FUNCTION const RealType real() const volatile;

    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>
       KOKKOS_INLINE_FUNCTION complex& operator += (const volatile complex<T>& src) volatile;

    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 volatile T& real) 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>
       KOKKOS_INLINE_FUNCTION complex& operator *= (const volatile complex<T>& src) volatile;

    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 volatile T& real) 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().

Clone this wiki locally