thrust::complex
Defined in thrust/complex.h
- 
template<typename T>
 struct complex
- complexis the Thrust equivalent to- std::complex. It is functionally identical to it, but can also be used in device code which- std::complexcurrently cannot.- Template Parameters
- T – The type used to hold the real and imaginary parts. Should be - floator- double. Others types are not supported.
 - Public Functions - 
complex(const T &re)
- Construct a complex number with an imaginary part of 0. - Parameters
- re – The real part of the number. 
 
 - 
complex(const T &re, const T &im)
- Construct a complex number from its real and imaginary parts. - Parameters
- re – The real part of the number. 
- im – The imaginary part of the number. 
 
 
 - 
complex() = default
- Default construct a complex number. 
 - 
complex(const complex<T> &z) = default
- This copy constructor copies from a - complexwith a type that is convertible to this- complex's- value_type.- Parameters
- z – The - complexto copy from.
 
 - 
template<typename U>
 complex(const complex<U> &z)
- This converting copy constructor copies from a - complexwith a type that is convertible to this- complex's- value_type.- Parameters
- z – The - complexto copy from.
- Template Parameters
- U – is convertible to - value_type.
 
 - 
complex(const std::complex<T> &z)
- This converting copy constructor copies from a - std::complexwith a type that is convertible to this- complex's- value_type.- Parameters
- z – The - complexto copy from.
 
 - 
template<typename U>
 complex(const std::complex<U> &z)
- This converting copy constructor copies from a - std::complexwith a type that is convertible to this- complex's- value_type.- Parameters
- z – The - complexto copy from.
- Template Parameters
- U – is convertible to - value_type.
 
 - 
complex &operator=(const T &re)
- Assign - reto the real part of this- complexand set the imaginary part to 0.- Parameters
- re – The real part of the number. 
 
 - 
complex &operator=(const complex<T> &z) = default
- Assign - z.real()and- z.imag()to the real and imaginary parts of this- complexrespectively.- Parameters
- z – The - complexto copy from.
 
 - 
template<typename U>
 complex &operator=(const complex<U> &z)
- Assign - z.real()and- z.imag()to the real and imaginary parts of this- complexrespectively.- Parameters
- z – The - complexto copy from.
- Template Parameters
- U – is convertible to - value_type.
 
 - 
complex &operator=(const std::complex<T> &z)
- Assign - z.real()and- z.imag()to the real and imaginary parts of this- complexrespectively.- Parameters
- z – The - complexto copy from.
 
 - 
template<typename U>
 complex &operator=(const std::complex<U> &z)
- Assign - z.real()and- z.imag()to the real and imaginary parts of this- complexrespectively.- Parameters
- z – The - complexto copy from.
- Template Parameters
- U – is convertible to - value_type.
 
 - 
template<typename U>
 complex<T> &operator+=(const complex<U> &z)
- Adds a - complexto this- complexand assigns the result to this- complex.- Parameters
- z – The - complexto be added.
- Template Parameters
- U – is convertible to - value_type.
 
 - 
template<typename U>
 complex<T> &operator-=(const complex<U> &z)
- Subtracts a - complexfrom this- complexand assigns the result to this- complex.- Parameters
- z – The - complexto be subtracted.
- Template Parameters
- U – is convertible to - value_type.
 
 - 
template<typename U>
 complex<T> &operator*=(const complex<U> &z)
- Multiplies this - complexby another- complexand assigns the result to this- complex.- Parameters
- z – The - complexto be multiplied.
- Template Parameters
- U – is convertible to - value_type.
 
 - 
template<typename U>
 complex<T> &operator/=(const complex<U> &z)
- Divides this - complexby another- complexand assigns the result to this- complex.- Parameters
- z – The - complexto be divided.
- Template Parameters
- U – is convertible to - value_type.
 
 - 
template<typename U>
 complex<T> &operator+=(const U &z)
- Adds a scalar to this - complexand assigns the result to this- complex.- Parameters
- z – The - complexto be added.
- Template Parameters
- U – is convertible to - value_type.
 
 - 
template<typename U>
 complex<T> &operator-=(const U &z)
- Subtracts a scalar from this - complexand assigns the result to this- complex.- Parameters
- z – The scalar to be subtracted. 
- Template Parameters
- U – is convertible to - value_type.
 
 - 
template<typename U>
 complex<T> &operator*=(const U &z)
- Multiplies this - complexby a scalar and assigns the result to this- complex.- Parameters
- z – The scalar to be multiplied. 
- Template Parameters
- U – is convertible to - value_type.
 
 - 
template<typename U>
 complex<T> &operator/=(const U &z)
- Divides this - complexby a scalar and assigns the result to this- complex.- Parameters
- z – The scalar to be divided. 
- Template Parameters
- U – is convertible to - value_type.
 
 - 
inline void real(T re) volatile
- Sets the real part of this - complex.- Parameters
- re – The new real part of this - complex.
 
 - 
inline void imag(T im) volatile
- Sets the imaginary part of this - complex.- Parameters
- im – The new imaginary part of this - complex.e
 
 - 
inline void real(T re)
- Sets the real part of this - complex.- Parameters
- re – The new real part of this - complex.