Kokkos Core Kernels Package Version of the Day
Loading...
Searching...
No Matches
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.
 

Public Member Functions

KOKKOS_DEFAULTED_FUNCTION complex ()=default
 Default constructor (initializes both real and imaginary parts to zero).
 
KOKKOS_DEFAULTED_FUNCTION complex (const complex &) noexcept=default
 Copy constructor.
 
template<class RType , std::enable_if_t< std::is_convertible< RType, RealType >::value, int > = 0>
KOKKOS_INLINE_FUNCTION complex (const complex< RType > &other) noexcept
 Conversion constructor from compatible RType.
 
KOKKOS_INLINE_FUNCTION complex (const std::complex< RealType > &src) noexcept
 Conversion constructor from std::complex.
 
 operator std::complex< RealType > () const noexcept
 Conversion operator to std::complex.
 
KOKKOS_INLINE_FUNCTION complex (const RealType &val) noexcept
 Constructor that takes just the real part, and sets the imaginary part to zero.
 
KOKKOS_INLINE_FUNCTION complex (const RealType &re, const RealType &im) noexcept
 Constructor that takes the real and imaginary parts.
 
KOKKOS_INLINE_FUNCTION complexoperator= (const RealType &val) noexcept
 Assignment operator (from a real number).
 
complexoperator= (const std::complex< RealType > &src) noexcept
 Assignment operator from std::complex.
 
KOKKOS_INLINE_FUNCTION constexpr RealType & imag () noexcept
 The imaginary part of this complex number.
 
KOKKOS_INLINE_FUNCTION constexpr RealType & real () noexcept
 The real part of this complex number.
 
KOKKOS_INLINE_FUNCTION constexpr RealType imag () const noexcept
 The imaginary part of this complex number.
 
KOKKOS_INLINE_FUNCTION constexpr RealType real () const noexcept
 The real part of this complex number.
 
KOKKOS_INLINE_FUNCTION constexpr void imag (RealType v) noexcept
 Set the imaginary part of this complex number.
 
KOKKOS_INLINE_FUNCTION constexpr void real (RealType v) noexcept
 Set the real part of this complex number.
 

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 42 of file Kokkos_Complex.hpp.

Member Typedef Documentation

◆ value_type

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 53 of file Kokkos_Complex.hpp.

Constructor & Destructor Documentation

◆ complex() [1/6]

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

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

◆ complex() [2/6]

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

Copy constructor.

◆ complex() [3/6]

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

Conversion constructor from compatible RType.

Definition at line 70 of file Kokkos_Complex.hpp.

◆ complex() [4/6]

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 82 of file Kokkos_Complex.hpp.

◆ complex() [5/6]

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 104 of file Kokkos_Complex.hpp.

◆ complex() [6/6]

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 109 of file Kokkos_Complex.hpp.

Member Function Documentation

◆ operator std::complex< RealType >()

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 98 of file Kokkos_Complex.hpp.

◆ operator=() [1/2]

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

Assignment operator (from a real number).

Definition at line 112 of file Kokkos_Complex.hpp.

◆ operator=() [2/2]

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 123 of file Kokkos_Complex.hpp.

◆ imag() [1/3]

template<class RealType >
KOKKOS_INLINE_FUNCTION constexpr RealType & Kokkos::complex< RealType >::imag ( )
inlineconstexprnoexcept

The imaginary part of this complex number.

Definition at line 130 of file Kokkos_Complex.hpp.

◆ real() [1/3]

template<class RealType >
KOKKOS_INLINE_FUNCTION constexpr RealType & Kokkos::complex< RealType >::real ( )
inlineconstexprnoexcept

The real part of this complex number.

Definition at line 134 of file Kokkos_Complex.hpp.

◆ imag() [2/3]

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

The imaginary part of this complex number.

Definition at line 138 of file Kokkos_Complex.hpp.

◆ real() [2/3]

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

The real part of this complex number.

Definition at line 142 of file Kokkos_Complex.hpp.

◆ imag() [3/3]

template<class RealType >
KOKKOS_INLINE_FUNCTION constexpr void Kokkos::complex< RealType >::imag ( RealType  v)
inlineconstexprnoexcept

Set the imaginary part of this complex number.

Definition at line 146 of file Kokkos_Complex.hpp.

◆ real() [3/3]

template<class RealType >
KOKKOS_INLINE_FUNCTION constexpr void Kokkos::complex< RealType >::real ( RealType  v)
inlineconstexprnoexcept

Set the real part of this complex number.

Definition at line 150 of file Kokkos_Complex.hpp.


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