thrust
Classes | Typedefs | Functions
Complex Numbers

Classes

struct  thrust::complex< T >
 

Typedefs

typedef T thrust::complex< T >::value_type
 

Functions

__host__ __device__ thrust::complex< T >::complex (const T &re=T(), const T &im=T())
 
template<typename X >
__host__ __device__ thrust::complex< T >::complex (const complex< X > &z)
 
template<typename X >
__host__ thrust::complex< T >::complex (const std::complex< X > &z)
 
__host__ __device__ complex< T > & thrust::complex< T >::operator+= (const complex< T > z)
 
__host__ __device__ complex< T > & thrust::complex< T >::operator-= (const complex< T > z)
 
__host__ __device__ complex< T > & thrust::complex< T >::operator*= (const complex< T > z)
 
__host__ __device__ complex< T > & thrust::complex< T >::operator/= (const complex< T > z)
 
__host__ __device__ T thrust::complex< T >::real () const volatile
 
__host__ __device__ T thrust::complex< T >::imag () const volatile
 
__host__ __device__ T thrust::complex< T >::real () const
 
__host__ __device__ T thrust::complex< T >::imag () const
 
__host__ __device__ void thrust::complex< T >::real (T re) volatile
 
__host__ __device__ void thrust::complex< T >::imag (T im) volatile
 
__host__ __device__ void thrust::complex< T >::real (T re)
 
__host__ __device__ void thrust::complex< T >::imag (T im)
 
 thrust::complex< T >::operator std::complex< T > () const
 
template<typename T >
__host__ __device__ T thrust::abs (const complex< T > &z)
 
template<typename T >
__host__ __device__ T thrust::arg (const complex< T > &z)
 
template<typename T >
__host__ __device__ T thrust::norm (const complex< T > &z)
 
template<typename T >
__host__ __device__ complex< T > thrust::conj (const complex< T > &z)
 
template<typename T >
__host__ __device__ complex< T > thrust::polar (const T &m, const T &theta=0)
 
template<typename T >
__host__ __device__ complex< T > thrust::proj (const T &z)
 
template<typename T >
__host__ __device__ complex< T > thrust::operator* (const complex< T > &lhs, const complex< T > &rhs)
 
template<typename T >
__host__ __device__ complex< T > thrust::operator* (const complex< T > &lhs, const T &rhs)
 
template<typename T >
__host__ __device__ complex< T > thrust::operator* (const T &lhs, const complex< T > &rhs)
 
template<typename T >
__host__ __device__ complex< T > thrust::operator/ (const complex< T > &lhs, const complex< T > &rhs)
 
template<typename T >
__host__ __device__ complex< T > thrust::operator/ (const complex< T > &lhs, const T &rhs)
 
template<typename T >
__host__ __device__ complex< T > thrust::operator/ (const T &lhs, const complex< T > &rhs)
 
template<typename T >
__host__ __device__ complex< T > thrust::operator+ (const complex< T > &lhs, const complex< T > &rhs)
 
template<typename T >
__host__ __device__ complex< T > thrust::operator+ (const complex< T > &lhs, const T &rhs)
 
template<typename T >
__host__ __device__ complex< T > thrust::operator+ (const T &lhs, const complex< T > &rhs)
 
template<typename T >
__host__ __device__ complex< T > thrust::operator- (const complex< T > &lhs, const complex< T > &rhs)
 
template<typename T >
__host__ __device__ complex< T > thrust::operator- (const complex< T > &lhs, const T &rhs)
 
template<typename T >
__host__ __device__ complex< T > thrust::operator- (const T &lhs, const complex< T > &rhs)
 
template<typename T >
__host__ __device__ complex< T > thrust::operator+ (const complex< T > &rhs)
 
template<typename T >
__host__ __device__ complex< T > thrust::operator- (const complex< T > &rhs)
 
template<typename T >
__host__ __device__ complex< T > thrust::exp (const complex< T > &z)
 
template<typename T >
__host__ __device__ complex< T > thrust::log (const complex< T > &z)
 
template<typename T >
__host__ __device__ complex< T > thrust::log10 (const complex< T > &z)
 
template<typename T >
__host__ __device__ complex< T > thrust::pow (const complex< T > &x, const complex< T > &y)
 
template<typename T >
__host__ __device__ complex< T > thrust::pow (const complex< T > &x, const T &y)
 
template<typename T >
__host__ __device__ complex< T > thrust::pow (const T &x, const complex< T > &y)
 
template<typename T , typename U >
__host__ __device__ complex
< typename
detail::promoted_numerical_type
< T, U >::type > 
thrust::pow (const complex< T > &x, const complex< U > &y)
 
template<typename T , typename U >
__host__ __device__ complex
< typename
detail::promoted_numerical_type
< T, U >::type > 
thrust::pow (const complex< T > &x, const U &y)
 
template<typename T , typename U >
__host__ __device__ complex
< typename
detail::promoted_numerical_type
< T, U >::type > 
thrust::pow (const T &x, const complex< U > &y)
 
template<typename T >
__host__ __device__ complex< T > thrust::sqrt (const complex< T > &z)
 
template<typename T >
__host__ __device__ complex< T > thrust::cos (const complex< T > &z)
 
template<typename T >
__host__ __device__ complex< T > thrust::sin (const complex< T > &z)
 
template<typename T >
__host__ __device__ complex< T > thrust::tan (const complex< T > &z)
 
template<typename T >
__host__ __device__ complex< T > thrust::cosh (const complex< T > &z)
 
template<typename T >
__host__ __device__ complex< T > thrust::sinh (const complex< T > &z)
 
template<typename T >
__host__ __device__ complex< T > thrust::tanh (const complex< T > &z)
 
template<typename T >
__host__ __device__ complex< T > thrust::acos (const complex< T > &z)
 
template<typename T >
__host__ __device__ complex< T > thrust::asin (const complex< T > &z)
 
template<typename T >
__host__ __device__ complex< T > thrust::atan (const complex< T > &z)
 
template<typename T >
__host__ __device__ complex< T > thrust::acosh (const complex< T > &z)
 
template<typename T >
__host__ __device__ complex< T > thrust::asinh (const complex< T > &z)
 
template<typename T >
__host__ __device__ complex< T > thrust::atanh (const complex< T > &z)
 
template<typename ValueType , class charT , class traits >
std::basic_ostream< charT,
traits > & 
thrust::operator<< (std::basic_ostream< charT, traits > &os, const complex< ValueType > &z)
 
template<typename ValueType , typename charT , class traits >
std::basic_istream< charT,
traits > & 
thrust::operator>> (std::basic_istream< charT, traits > &is, complex< ValueType > &z)
 
template<typename T >
__host__ __device__ bool thrust::operator== (const complex< T > &lhs, const complex< T > &rhs)
 
template<typename T >
__host__ __device__ bool thrust::operator== (const T &lhs, const complex< T > &rhs)
 
template<typename T >
__host__ __device__ bool thrust::operator== (const complex< T > &lhs, const T &rhs)
 
template<typename T >
__host__ __device__ bool thrust::operator!= (const complex< T > &lhs, const complex< T > &rhs)
 
template<typename T >
__host__ __device__ bool thrust::operator!= (const T &lhs, const complex< T > &rhs)
 
template<typename T >
__host__ __device__ bool thrust::operator!= (const complex< T > &lhs, const T &rhs)
 

Detailed Description

Typedef Documentation

template<typename T>
typedef T thrust::complex< T >::value_type

value_type is the type of complex's real and imaginary parts.

Function Documentation

template<typename T >
__host__ __device__ T thrust::abs ( const complex< T > &  z)
inline

Returns the magnitude (also known as absolute value) of a complex.

Parameters
zThe complex from which to calculate the absolute value.
template<typename T >
__host__ __device__ complex<T> thrust::acos ( const complex< T > &  z)

Returns the complex arc cosine of a complex number.

The range of the real part of the result is [0, Pi] and the range of the imaginary part is [-inf, +inf]

Parameters
zThe complex argument.
template<typename T >
__host__ __device__ complex<T> thrust::acosh ( const complex< T > &  z)

Returns the complex inverse hyperbolic cosine of a complex number.

The range of the real part of the result is [0, +inf] and the range of the imaginary part is [-Pi, Pi]

Parameters
zThe complex argument.
template<typename T >
__host__ __device__ T thrust::arg ( const complex< T > &  z)
inline

Returns the phase angle (also known as argument) in radians of a complex.

Parameters
zThe complex from which to calculate the phase angle.
template<typename T >
__host__ __device__ complex<T> thrust::asin ( const complex< T > &  z)

Returns the complex arc sine of a complex number.

The range of the real part of the result is [-Pi/2, Pi/2] and the range of the imaginary part is [-inf, +inf]

Parameters
zThe complex argument.
template<typename T >
__host__ __device__ complex<T> thrust::asinh ( const complex< T > &  z)

Returns the complex inverse hyperbolic sine of a complex number.

The range of the real part of the result is [-inf, +inf] and the range of the imaginary part is [-Pi/2, Pi/2]

Parameters
zThe complex argument.
template<typename T >
__host__ __device__ complex<T> thrust::atan ( const complex< T > &  z)

Returns the complex arc tangent of a complex number.

The range of the real part of the result is [-Pi/2, Pi/2] and the range of the imaginary part is [-inf, +inf]

Parameters
zThe complex argument.
template<typename T >
__host__ __device__ complex<T> thrust::atanh ( const complex< T > &  z)

Returns the complex inverse hyperbolic tangent of a complex number.

The range of the real part of the result is [-inf, +inf] and the range of the imaginary part is [-Pi/2, Pi/2]

Parameters
zThe complex argument.
template<typename T>
__host__ __device__ thrust::complex< T >::complex ( const T &  re = T(),
const T &  im = T() 
)
inline

Construct a complex number from its real and imaginary parts.

Parameters
reThe real part of the number.
imThe imaginary part of the number.
template<typename T>
template<typename X >
__host__ __device__ thrust::complex< T >::complex ( const complex< X > &  z)
inline

This copy constructor copies from a complex with a type that is convertible to this complex value_type.

Parameters
zThe complex to copy from.
Template Parameters
Xis convertible to value_type.
template<typename T>
template<typename X >
__host__ thrust::complex< T >::complex ( const std::complex< X > &  z)
inline

This copy constructor copies from a std::complex with a type that is convertible to this complex value_type.

Parameters
zThe complex to copy from.
Template Parameters
Xis convertible to value_type.
template<typename T >
__host__ __device__ complex<T> thrust::conj ( const complex< T > &  z)
inline

Returns the complex conjugate of a complex.

Parameters
zThe complex from which to calculate the complex conjugate.
template<typename T >
__host__ __device__ complex<T> thrust::cos ( const complex< T > &  z)

Returns the complex cosine of a complex number.

Parameters
zThe complex argument.
template<typename T >
__host__ __device__ complex<T> thrust::cosh ( const complex< T > &  z)

Returns the complex hyperbolic cosine of a complex number.

Parameters
zThe complex argument.
template<typename T >
__host__ __device__ complex<T> thrust::exp ( const complex< T > &  z)

Returns the complex exponential of a complex number.

Parameters
zThe complex argument.
template<typename T>
__host__ __device__ T thrust::complex< T >::imag ( ) const volatile
inline

Returns the imaginary part of this complex.

Referenced by thrust::complex< T >::operator std::complex< T >().

template<typename T>
__host__ __device__ T thrust::complex< T >::imag ( ) const
inline

Returns the imaginary part of this complex.

template<typename T>
__host__ __device__ void thrust::complex< T >::imag ( im) volatile
inline

Sets the imaginary part of this complex.

Parameters
imThe new imaginary part of this complex.e
template<typename T>
__host__ __device__ void thrust::complex< T >::imag ( im)
inline

Sets the imaginary part of this complex.

Parameters
imThe new imaginary part of this complex.
template<typename T >
__host__ __device__ complex<T> thrust::log ( const complex< T > &  z)

Returns the complex natural logarithm of a complex number.

Parameters
zThe complex argument.
template<typename T >
__host__ __device__ complex<T> thrust::log10 ( const complex< T > &  z)
inline

Returns the complex base 10 logarithm of a complex number.

Parameters
zThe complex argument.
template<typename T >
__host__ __device__ T thrust::norm ( const complex< T > &  z)
inline

Returns the square of the magnitude of a complex.

Parameters
zThe complex from which to calculate the norm.
template<typename T>
thrust::complex< T >::operator std::complex< T > ( ) const
inline

Casts this complex to a std::complex of the same type.

References thrust::complex< T >::imag(), and thrust::complex< T >::real().

template<typename T >
__host__ __device__ bool thrust::operator!= ( const complex< T > &  lhs,
const complex< T > &  rhs 
)
inline

Returns true if two complex numbers are different and false otherwise.

Parameters
lhsThe first complex.
rhsThe second complex.
template<typename T >
__host__ __device__ bool thrust::operator!= ( const T &  lhs,
const complex< T > &  rhs 
)
inline

Returns true if the imaginary part of the complex number is not zero or the real part is different from the scalar. Returns false otherwise.

Parameters
lhsThe scalar.
rhsThe complex.
template<typename T >
__host__ __device__ bool thrust::operator!= ( const complex< T > &  lhs,
const T &  rhs 
)
inline

Returns true if the imaginary part of the complex number is not zero or the real part is different from the scalar. Returns false otherwise.

Parameters
lhsThe complex.
rhsThe scalar.
template<typename T >
__host__ __device__ complex<T> thrust::operator* ( const complex< T > &  lhs,
const complex< T > &  rhs 
)
inline

Multiplies two complex numbers.

Parameters
lhsThe first complex.
rhsThe second complex.
template<typename T >
__host__ __device__ complex<T> thrust::operator* ( const complex< T > &  lhs,
const T &  rhs 
)
inline

Multiplies a complex number by a scalar.

Parameters
lhsThe complex.
rhsThe scalar.
template<typename T >
__host__ __device__ complex<T> thrust::operator* ( const T &  lhs,
const complex< T > &  rhs 
)
inline

Multiplies a scalr by a complex number.

Parameters
lhsThe scalar.
rhsThe complex.
template<typename T>
__host__ __device__ complex<T>& thrust::complex< T >::operator*= ( const complex< T >  z)
inline

Multiplies this complex by another complex and assigns the result to this complex.

Parameters
zThe complex to be multiplied.
template<typename T >
__host__ __device__ complex<T> thrust::operator+ ( const complex< T > &  lhs,
const complex< T > &  rhs 
)
inline

Adds two complex numbers.

Parameters
lhsThe first complex.
rhsThe second complex.
template<typename T >
__host__ __device__ complex<T> thrust::operator+ ( const complex< T > &  lhs,
const T &  rhs 
)
inline

Adds a scalar to a complex number.

Parameters
lhsThe complex.
rhsThe scalar.
template<typename T >
__host__ __device__ complex<T> thrust::operator+ ( const T &  lhs,
const complex< T > &  rhs 
)
inline

Adds a complex number to a scalar.

Parameters
lhsThe scalar.
rhsThe complex.
template<typename T >
__host__ __device__ complex<T> thrust::operator+ ( const complex< T > &  rhs)
inline

Unary plus, returns its complex argument.

Parameters
rhsThe complex argument.
template<typename T>
__host__ __device__ complex<T>& thrust::complex< T >::operator+= ( const complex< T >  z)
inline

Adds a complex to this complex and assigns the result to this complex.

Parameters
zThe complex to be Added.
template<typename T >
__host__ __device__ complex<T> thrust::operator- ( const complex< T > &  lhs,
const complex< T > &  rhs 
)
inline

Subtracts two complex numbers.

Parameters
lhsThe first complex (minuend).
rhsThe second complex (subtrahend).
template<typename T >
__host__ __device__ complex<T> thrust::operator- ( const complex< T > &  lhs,
const T &  rhs 
)
inline

Subtracts a scalar from a complex number.

Parameters
lhsThe complex (minuend).
rhsThe scalar (subtrahend).
template<typename T >
__host__ __device__ complex<T> thrust::operator- ( const T &  lhs,
const complex< T > &  rhs 
)
inline

Subtracts a complex number from a scalar.

Parameters
lhsThe scalar (minuend).
rhsThe complex (subtrahend).
template<typename T >
__host__ __device__ complex<T> thrust::operator- ( const complex< T > &  rhs)
inline

Unary minus, returns the additive inverse (negation) of its complex argument.

Parameters
rhsThe complex argument.
template<typename T>
__host__ __device__ complex<T>& thrust::complex< T >::operator-= ( const complex< T >  z)
inline

Subtracts a complex from this complex and assigns the result to this complex.

Parameters
zThe complex to be subtracted.
template<typename T >
__host__ __device__ complex<T> thrust::operator/ ( const complex< T > &  lhs,
const complex< T > &  rhs 
)
inline

Divides two complex numbers.

Parameters
lhsThe numerator (dividend).
rhsThe denomimator (divisor).
template<typename T >
__host__ __device__ complex<T> thrust::operator/ ( const complex< T > &  lhs,
const T &  rhs 
)
inline

Divides a complex number by a scalar.

Parameters
lhsThe complex numerator (dividend).
rhsThe scalar denomimator (divisor).
template<typename T >
__host__ __device__ complex<T> thrust::operator/ ( const T &  lhs,
const complex< T > &  rhs 
)
inline

Divides a scalar by a complex number.

Parameters
lhsThe scalar numerator (dividend).
rhsThe complex denomimator (divisor).
template<typename T>
__host__ __device__ complex<T>& thrust::complex< T >::operator/= ( const complex< T >  z)
inline

Divides this complex by another complex and assigns the result to this complex.

Parameters
zThe complex to be divided.
template<typename ValueType , class charT , class traits >
std::basic_ostream<charT, traits>& thrust::operator<< ( std::basic_ostream< charT, traits > &  os,
const complex< ValueType > &  z 
)

Writes to an output stream a complex number in the form (real,imaginary).

Parameters
osThe output stream.
zThe complex number to output.
template<typename T >
__host__ __device__ bool thrust::operator== ( const complex< T > &  lhs,
const complex< T > &  rhs 
)
inline

Returns true if two complex numbers are equal and false otherwise.

Parameters
lhsThe first complex.
rhsThe second complex.
template<typename T >
__host__ __device__ bool thrust::operator== ( const T &  lhs,
const complex< T > &  rhs 
)
inline

Returns true if the imaginary part of the complex number is zero and the real part is equal to the scalar. Returns false otherwise.

Parameters
lhsThe scalar.
rhsThe complex.
template<typename T >
__host__ __device__ bool thrust::operator== ( const complex< T > &  lhs,
const T &  rhs 
)
inline

Returns true if the imaginary part of the complex number is zero and the real part is equal to the scalar. Returns false otherwise.

Parameters
lhsThe complex.
rhsThe scalar.
template<typename ValueType , typename charT , class traits >
std::basic_istream<charT, traits>& thrust::operator>> ( std::basic_istream< charT, traits > &  is,
complex< ValueType > &  z 
)

Reads a complex number from an input stream. The recognized formats are:

  • real
  • (real)
  • (real, imaginary)

The values read must be convertible to the complex's value_type

Parameters
isThe input stream.
zThe complex number to set.
template<typename T >
__host__ __device__ complex<T> thrust::polar ( const T &  m,
const T &  theta = 0 
)
inline

Returns a complex with the specified magnitude and phase.

Parameters
mThe magnitude of the returned complex.
thetaThe phase of the returned complex in radians.
template<typename T >
__host__ __device__ complex<T> thrust::pow ( const complex< T > &  x,
const complex< T > &  y 
)

Returns a complex number raised to another.

Parameters
xThe base.
yThe exponent.
template<typename T >
__host__ __device__ complex<T> thrust::pow ( const complex< T > &  x,
const T &  y 
)

Returns a complex number raised to a scalar.

Parameters
xThe complex base.
yThe scalar exponent.
template<typename T >
__host__ __device__ complex<T> thrust::pow ( const T &  x,
const complex< T > &  y 
)

Returns a scalar raised to a complex number.

Parameters
xThe scalar base.
yThe complex exponent.
template<typename T , typename U >
__host__ __device__ complex<typename detail::promoted_numerical_type<T,U>::type > thrust::pow ( const complex< T > &  x,
const complex< U > &  y 
)

Returns a complex number raised to another. The types of the two complex should be compatible and the type of the returned complex is the promoted type of the two arguments.

Parameters
xThe base.
yThe exponent.
template<typename T , typename U >
__host__ __device__ complex<typename detail::promoted_numerical_type<T,U>::type > thrust::pow ( const complex< T > &  x,
const U &  y 
)

Returns a complex number raised to a scalar. The type of the complex should be compatible with the scalar and the type of the returned complex is the promoted type of the two arguments.

Parameters
xThe base.
yThe exponent.
template<typename T , typename U >
__host__ __device__ complex<typename detail::promoted_numerical_type<T,U>::type > thrust::pow ( const T &  x,
const complex< U > &  y 
)

Returns a scalar raised to a complex number. The type of the complex should be compatible with the scalar and the type of the returned complex is the promoted type of the two arguments.

Parameters
xThe base.
yThe exponent.
template<typename T >
__host__ __device__ complex<T> thrust::proj ( const T &  z)
inline

Returns the projection of a complex on the Riemann sphere. For all finite complex it returns the argument. For complexs with a non finite part returns (INFINITY,+/-0) where the sign of the zero matches the sign of the imaginary part of the argument.

Parameters
zThe complex argument.
template<typename T>
__host__ __device__ T thrust::complex< T >::real ( ) const volatile
inline

Returns the real part of this complex.

Referenced by thrust::complex< T >::operator std::complex< T >().

template<typename T>
__host__ __device__ T thrust::complex< T >::real ( ) const
inline

Returns the real part of this complex.

template<typename T>
__host__ __device__ void thrust::complex< T >::real ( re) volatile
inline

Sets the real part of this complex.

Parameters
reThe new real part of this complex.
template<typename T>
__host__ __device__ void thrust::complex< T >::real ( re)
inline

Sets the real part of this complex.

Parameters
reThe new real part of this complex.
template<typename T >
__host__ __device__ complex<T> thrust::sin ( const complex< T > &  z)

Returns the complex sine of a complex number.

Parameters
zThe complex argument.
template<typename T >
__host__ __device__ complex<T> thrust::sinh ( const complex< T > &  z)

Returns the complex hyperbolic sine of a complex number.

Parameters
zThe complex argument.
template<typename T >
__host__ __device__ complex<T> thrust::sqrt ( const complex< T > &  z)

Returns the complex square root of a complex number.

Parameters
zThe complex argument.
template<typename T >
__host__ __device__ complex<T> thrust::tan ( const complex< T > &  z)

Returns the complex tangent of a complex number.

Parameters
zThe complex argument.
template<typename T >
__host__ __device__ complex<T> thrust::tanh ( const complex< T > &  z)

Returns the complex hyperbolic tangent of a complex number.

Parameters
zThe complex argument.