Kokkos Core Kernels Package  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Types | Public Member Functions | List of all members
Kokkos::complex< RealType > Class Template Reference

Partial reimplementation of std::complex that works as the result of a Kokkos::parallel_reduce. More...

#include <Kokkos_Complex.hpp>

Public Types

using value_type = RealType
 The type of the real or imaginary parts of this complex number. More...
 

Public Member Functions

KOKKOS_DEFAULTED_FUNCTION complex () noexcept=default
 Default constructor (initializes both real and imaginary parts to zero). More...
 
KOKKOS_DEFAULTED_FUNCTION complex (const complex &) noexcept=default
 Copy constructor. More...
 
template<class RType , typename std::enable_if< std::is_convertible< RType, RealType >::value, int >::type = 0>
KOKKOS_INLINE_FUNCTION complex (const complex< RType > &other) noexcept
 Conversion constructor from compatible RType. More...
 
KOKKOS_INLINE_FUNCTION complex (const std::complex< RealType > &src) noexcept
 Conversion constructor from std::complex. More...
 
 operator std::complex< RealType > () const noexcept
 Conversion operator to std::complex. More...
 
KOKKOS_INLINE_FUNCTION complex (const RealType &val) noexcept
 Constructor that takes just the real part, and sets the imaginary part to zero. More...
 
KOKKOS_INLINE_FUNCTION complex (const RealType &re, const RealType &im) noexcept
 Constructor that takes the real and imaginary parts. More...
 
KOKKOS_INLINE_FUNCTION complexoperator= (const RealType &val) noexcept
 Assignment operator (from a real number). More...
 
complexoperator= (const std::complex< RealType > &src) noexcept
 Assignment operator from std::complex. More...
 
KOKKOS_INLINE_FUNCTION
KOKKOS_CONSTEXPR_14 RealType & 
imag () noexcept
 The imaginary part of this complex number. More...
 
KOKKOS_INLINE_FUNCTION
KOKKOS_CONSTEXPR_14 RealType & 
real () noexcept
 The real part of this complex number. More...
 
KOKKOS_INLINE_FUNCTION
constexpr RealType 
imag () const noexcept
 The imaginary part of this complex number. More...
 
KOKKOS_INLINE_FUNCTION
constexpr RealType 
real () const noexcept
 The real part of this complex number. More...
 
KOKKOS_INLINE_FUNCTION
KOKKOS_CONSTEXPR_14 void 
imag (RealType v) noexcept
 Set the imaginary part of this complex number. More...
 
KOKKOS_INLINE_FUNCTION
KOKKOS_CONSTEXPR_14 void 
real (RealType v) noexcept
 Set the real part of this complex number. More...
 
template<class RType , typename std::enable_if< std::is_convertible< RType, RealType >::value, int >::type = 0>
KOKKOS_INLINE_FUNCTION complex (const volatile complex< RType > &src) noexcept
 Copy constructor from volatile. More...
 
template<class Complex , typename std::enable_if< std::is_same< Complex, complex >::value, int >::type = 0>
KOKKOS_INLINE_FUNCTION void operator= (const Complex &src) volatilenoexcept
 Assignment operator, for volatile *this and nonvolatile input. More...
 
template<class Complex , typename std::enable_if< std::is_same< Complex, complex >::value, int >::type = 0>
KOKKOS_INLINE_FUNCTION
volatile complex
operator= (const volatile Complex &src) volatilenoexcept
 Assignment operator, volatile LHS and volatile RHS. More...
 
template<class Complex , typename std::enable_if< std::is_same< Complex, complex >::value, int >::type = 0>
KOKKOS_INLINE_FUNCTION complexoperator= (const volatile Complex &src) noexcept
 Assignment operator, volatile RHS and non-volatile LHS. More...
 
KOKKOS_INLINE_FUNCTION void operator= (const volatile RealType &val) noexcept
 Assignment operator (from a volatile real number). More...
 
KOKKOS_INLINE_FUNCTION complexoperator= (const RealType &val) volatilenoexcept
 Assignment operator volatile LHS and non-volatile RHS. More...
 
KOKKOS_INLINE_FUNCTION complexoperator= (const volatile RealType &val) volatilenoexcept
 Assignment operator volatile LHS and volatile RHS. More...
 
KOKKOS_INLINE_FUNCTION
volatile RealType & 
imag () volatilenoexcept
 The imaginary part of this complex number (volatile overload). More...
 
KOKKOS_INLINE_FUNCTION
volatile RealType & 
real () volatilenoexcept
 The real part of this complex number (volatile overload). More...
 
KOKKOS_INLINE_FUNCTION RealType imag () const volatilenoexcept
 The imaginary part of this complex number (volatile overload). More...
 
KOKKOS_INLINE_FUNCTION RealType real () const volatilenoexcept
 The real part of this complex number (volatile overload). More...
 

Detailed Description

template<class RealType>
class Kokkos::complex< RealType >

Partial reimplementation of std::complex that works as the result of a Kokkos::parallel_reduce.

Template Parameters
RealTypeThe type of the real and imaginary parts of the complex number. As with std::complex, this is only defined for float, double, and long double. The latter is currently forbidden in CUDA device kernels.

Definition at line 62 of file Kokkos_Complex.hpp.

Member Typedef Documentation

template<class RealType>
using Kokkos::complex< RealType >::value_type = RealType

The type of the real or imaginary parts of this complex number.

Definition at line 73 of file Kokkos_Complex.hpp.

Constructor & Destructor Documentation

template<class RealType>
KOKKOS_DEFAULTED_FUNCTION Kokkos::complex< RealType >::complex ( )
defaultnoexcept

Default constructor (initializes both real and imaginary parts to zero).

template<class RealType>
KOKKOS_DEFAULTED_FUNCTION Kokkos::complex< RealType >::complex ( const complex< RealType > &  )
defaultnoexcept

Copy constructor.

template<class RealType>
template<class RType , typename std::enable_if< std::is_convertible< RType, RealType >::value, int >::type = 0>
KOKKOS_INLINE_FUNCTION Kokkos::complex< RealType >::complex ( const complex< RType > &  other)
inlinenoexcept

Conversion constructor from compatible RType.

Definition at line 90 of file Kokkos_Complex.hpp.

template<class RealType>
KOKKOS_INLINE_FUNCTION Kokkos::complex< RealType >::complex ( const std::complex< RealType > &  src)
inlinenoexcept

Conversion constructor from std::complex.

This constructor cannot be called in a CUDA device function, because std::complex's methods and nonmember functions are not marked as CUDA device functions.

Definition at line 102 of file Kokkos_Complex.hpp.

template<class RealType>
KOKKOS_INLINE_FUNCTION Kokkos::complex< RealType >::complex ( const RealType &  val)
inlinenoexcept

Constructor that takes just the real part, and sets the imaginary part to zero.

Definition at line 124 of file Kokkos_Complex.hpp.

template<class RealType>
KOKKOS_INLINE_FUNCTION Kokkos::complex< RealType >::complex ( const RealType &  re,
const RealType &  im 
)
inlinenoexcept

Constructor that takes the real and imaginary parts.

Definition at line 129 of file Kokkos_Complex.hpp.

template<class RealType>
template<class RType , typename std::enable_if< std::is_convertible< RType, RealType >::value, int >::type = 0>
KOKKOS_INLINE_FUNCTION Kokkos::complex< RealType >::complex ( const volatile complex< RType > &  src)
inlinenoexcept

Copy constructor from volatile.

Definition at line 292 of file Kokkos_Complex.hpp.

Member Function Documentation

template<class RealType>
Kokkos::complex< RealType >::operator std::complex< RealType > ( ) const
inlinenoexcept

Conversion operator to std::complex.

This operator cannot be called in a CUDA device function, because std::complex's methods and nonmember functions are not marked as CUDA device functions.

Definition at line 118 of file Kokkos_Complex.hpp.

template<class RealType>
KOKKOS_INLINE_FUNCTION complex& Kokkos::complex< RealType >::operator= ( const RealType &  val)
inlinenoexcept

Assignment operator (from a real number).

Definition at line 132 of file Kokkos_Complex.hpp.

template<class RealType>
complex& Kokkos::complex< RealType >::operator= ( const std::complex< RealType > &  src)
inlinenoexcept

Assignment operator from std::complex.

This constructor cannot be called in a CUDA device function, because std::complex's methods and nonmember functions are not marked as CUDA device functions.

Definition at line 143 of file Kokkos_Complex.hpp.

template<class RealType>
KOKKOS_INLINE_FUNCTION KOKKOS_CONSTEXPR_14 RealType& Kokkos::complex< RealType >::imag ( )
inlinenoexcept

The imaginary part of this complex number.

Definition at line 150 of file Kokkos_Complex.hpp.

template<class RealType>
KOKKOS_INLINE_FUNCTION KOKKOS_CONSTEXPR_14 RealType& Kokkos::complex< RealType >::real ( )
inlinenoexcept

The real part of this complex number.

Definition at line 154 of file Kokkos_Complex.hpp.

template<class RealType>
KOKKOS_INLINE_FUNCTION constexpr RealType Kokkos::complex< RealType >::imag ( ) const
inlinenoexcept

The imaginary part of this complex number.

Definition at line 158 of file Kokkos_Complex.hpp.

template<class RealType>
KOKKOS_INLINE_FUNCTION constexpr RealType Kokkos::complex< RealType >::real ( ) const
inlinenoexcept

The real part of this complex number.

Definition at line 162 of file Kokkos_Complex.hpp.

template<class RealType>
KOKKOS_INLINE_FUNCTION KOKKOS_CONSTEXPR_14 void Kokkos::complex< RealType >::imag ( RealType  v)
inlinenoexcept

Set the imaginary part of this complex number.

Definition at line 167 of file Kokkos_Complex.hpp.

template<class RealType>
KOKKOS_INLINE_FUNCTION KOKKOS_CONSTEXPR_14 void Kokkos::complex< RealType >::real ( RealType  v)
inlinenoexcept

Set the real part of this complex number.

Definition at line 172 of file Kokkos_Complex.hpp.

template<class RealType>
template<class Complex , typename std::enable_if< std::is_same< Complex, complex >::value, int >::type = 0>
KOKKOS_INLINE_FUNCTION void Kokkos::complex< RealType >::operator= ( const Complex &  src) volatile
inlinenoexcept

Assignment operator, for volatile *this and nonvolatile input.

Parameters
src[in] Input; right-hand side of the assignment.

This operator returns void instead of volatile complex& . See Kokkos Issue #177 for the explanation. In practice, this means that you should not chain assignments with volatile lvalues.

Definition at line 321 of file Kokkos_Complex.hpp.

template<class RealType>
template<class Complex , typename std::enable_if< std::is_same< Complex, complex >::value, int >::type = 0>
KOKKOS_INLINE_FUNCTION volatile complex& Kokkos::complex< RealType >::operator= ( const volatile Complex &  src) volatile
inlinenoexcept

Assignment operator, volatile LHS and volatile RHS.

Definition at line 344 of file Kokkos_Complex.hpp.

template<class RealType>
template<class Complex , typename std::enable_if< std::is_same< Complex, complex >::value, int >::type = 0>
KOKKOS_INLINE_FUNCTION complex& Kokkos::complex< RealType >::operator= ( const volatile Complex &  src)
inlinenoexcept

Assignment operator, volatile RHS and non-volatile LHS.

Definition at line 367 of file Kokkos_Complex.hpp.

template<class RealType>
KOKKOS_INLINE_FUNCTION void Kokkos::complex< RealType >::operator= ( const volatile RealType &  val)
inlinenoexcept

Assignment operator (from a volatile real number).

Definition at line 378 of file Kokkos_Complex.hpp.

template<class RealType>
KOKKOS_INLINE_FUNCTION complex& Kokkos::complex< RealType >::operator= ( const RealType &  val) volatile
inlinenoexcept

Assignment operator volatile LHS and non-volatile RHS.

Definition at line 386 of file Kokkos_Complex.hpp.

template<class RealType>
KOKKOS_INLINE_FUNCTION complex& Kokkos::complex< RealType >::operator= ( const volatile RealType &  val) volatile
inlinenoexcept

Assignment operator volatile LHS and volatile RHS.

Definition at line 395 of file Kokkos_Complex.hpp.

template<class RealType>
KOKKOS_INLINE_FUNCTION volatile RealType& Kokkos::complex< RealType >::imag ( ) volatile
inlinenoexcept

The imaginary part of this complex number (volatile overload).

Definition at line 404 of file Kokkos_Complex.hpp.

template<class RealType>
KOKKOS_INLINE_FUNCTION volatile RealType& Kokkos::complex< RealType >::real ( ) volatile
inlinenoexcept

The real part of this complex number (volatile overload).

Definition at line 408 of file Kokkos_Complex.hpp.

template<class RealType>
KOKKOS_INLINE_FUNCTION RealType Kokkos::complex< RealType >::imag ( ) const volatile
inlinenoexcept

The imaginary part of this complex number (volatile overload).

Definition at line 412 of file Kokkos_Complex.hpp.

template<class RealType>
KOKKOS_INLINE_FUNCTION RealType Kokkos::complex< RealType >::real ( ) const volatile
inlinenoexcept

The real part of this complex number (volatile overload).

Definition at line 416 of file Kokkos_Complex.hpp.


The documentation for this class was generated from the following file: