Complex Numbers
template <typename T> struct thrust::complex;
typedef see below value_type;
_CCCL_HOST_DEVICE complex(const T & re);
_CCCL_HOST_DEVICE complex(const T & re, const T & im);
template <typename U> _CCCL_HOST_DEVICE complex(const complex< U > & z);
__host__ __device__ complex(const std::complex< T > & z);
template <typename U> __host__ __device__ complex(const std::complex< U > & z);
_CCCL_HOST_DEVICE complex & operator=(const T & re);
complex & operator=(const complex< T > & z) = default;
template <typename U> _CCCL_HOST_DEVICE complex & operator=(const complex< U > & z);
__host__ __device__ complex & operator=(const std::complex< T > & z);
template <typename U> __host__ __device__ complex & operator=(const std::complex< U > & z);
template <typename U> _CCCL_HOST_DEVICE complex< T > & operator+=(const complex< U > & z);
template <typename U> _CCCL_HOST_DEVICE complex< T > & operator-=(const complex< U > & z);
template <typename U> _CCCL_HOST_DEVICE complex< T > & operator*=(const complex< U > & z);
template <typename U> _CCCL_HOST_DEVICE complex< T > & operator/=(const complex< U > & z);
template <typename U> _CCCL_HOST_DEVICE complex< T > & operator+=(const U & z);
template <typename U> _CCCL_HOST_DEVICE complex< T > & operator-=(const U & z);
template <typename U> _CCCL_HOST_DEVICE complex< T > & operator*=(const U & z);
template <typename U> _CCCL_HOST_DEVICE complex< T > & operator/=(const U & z);
_CCCL_HOST_DEVICE T real() const;
_CCCL_HOST_DEVICE T imag() const;
_CCCL_HOST_DEVICE T real() const;
_CCCL_HOST_DEVICE T imag() const;
_CCCL_HOST_DEVICE void real(T re);
_CCCL_HOST_DEVICE void imag(T im);
_CCCL_HOST_DEVICE void real(T re);
_CCCL_HOST_DEVICE void imag(T im);
__host__ operator std::complex< T >() const;
template <typename T> _CCCL_HOST_DEVICE T abs(const complex< T > & z);
template <typename T> _CCCL_HOST_DEVICE T arg(const complex< T > & z);
template <typename T> _CCCL_HOST_DEVICE T norm(const complex< T > & z);
template <typename T> _CCCL_HOST_DEVICE complex< T > conj(const complex< T > & z);
template <typename T0, typename T1> _CCCL_HOST_DEVICE complex< typename detail::promoted_numerical_type< T0, T1 >::type > polar(const T0 & m, const T1 & theta = T1());
template <typename T> _CCCL_HOST_DEVICE complex< T > proj(const T & z);
template <typename T0, typename T1> _CCCL_HOST_DEVICE complex< typename detail::promoted_numerical_type< T0, T1 >::type > operator+(const complex< T0 > & x, const complex< T1 > & y);
template <typename T0, typename T1> _CCCL_HOST_DEVICE complex< typename detail::promoted_numerical_type< T0, T1 >::type > operator+(const complex< T0 > & x, const T1 & y);
template <typename T0, typename T1> _CCCL_HOST_DEVICE complex< typename detail::promoted_numerical_type< T0, T1 >::type > operator+(const T0 & x, const complex< T1 > & y);
template <typename T0, typename T1> _CCCL_HOST_DEVICE complex< typename detail::promoted_numerical_type< T0, T1 >::type > operator-(const complex< T0 > & x, const complex< T1 > & y);
template <typename T0, typename T1> _CCCL_HOST_DEVICE complex< typename detail::promoted_numerical_type< T0, T1 >::type > operator-(const complex< T0 > & x, const T1 & y);
template <typename T0, typename T1> _CCCL_HOST_DEVICE complex< typename detail::promoted_numerical_type< T0, T1 >::type > operator-(const T0 & x, const complex< T1 > & y);
template <typename T0, typename T1> _CCCL_HOST_DEVICE complex< typename detail::promoted_numerical_type< T0, T1 >::type > operator*(const complex< T0 > & x, const complex< T1 > & y);
template <typename T0, typename T1> _CCCL_HOST_DEVICE complex< typename detail::promoted_numerical_type< T0, T1 >::type > operator*(const complex< T0 > & x, const T1 & y);
template <typename T0, typename T1> _CCCL_HOST_DEVICE complex< typename detail::promoted_numerical_type< T0, T1 >::type > operator*(const T0 & x, const complex< T1 > & y);
template <typename T0, typename T1> _CCCL_HOST_DEVICE complex< typename detail::promoted_numerical_type< T0, T1 >::type > operator/(const complex< T0 > & x, const complex< T1 > & y);
template <typename T0, typename T1> _CCCL_HOST_DEVICE complex< typename detail::promoted_numerical_type< T0, T1 >::type > operator/(const complex< T0 > & x, const T1 & y);
template <typename T0, typename T1> _CCCL_HOST_DEVICE complex< typename detail::promoted_numerical_type< T0, T1 >::type > operator/(const T0 & x, const complex< T1 > & y);
template <typename T> _CCCL_HOST_DEVICE complex< T > operator+(const complex< T > & y);
template <typename T> _CCCL_HOST_DEVICE complex< T > operator-(const complex< T > & y);
template <typename T> _CCCL_HOST_DEVICE complex< T > exp(const complex< T > & z);
template <typename T> _CCCL_HOST_DEVICE complex< T > log(const complex< T > & z);
template <typename T> _CCCL_HOST_DEVICE complex< T > log10(const complex< T > & z);
template <typename T0, typename T1> _CCCL_HOST_DEVICE complex< typename detail::promoted_numerical_type< T0, T1 >::type > pow(const complex< T0 > & x, const complex< T1 > & y);
template <typename T0, typename T1> _CCCL_HOST_DEVICE complex< typename detail::promoted_numerical_type< T0, T1 >::type > pow(const complex< T0 > & x, const T1 & y);
template <typename T0, typename T1> _CCCL_HOST_DEVICE complex< typename detail::promoted_numerical_type< T0, T1 >::type > pow(const T0 & x, const complex< T1 > & y);
template <typename T> _CCCL_HOST_DEVICE complex< T > sqrt(const complex< T > & z);
template <typename T> _CCCL_HOST_DEVICE complex< T > cos(const complex< T > & z);
template <typename T> _CCCL_HOST_DEVICE complex< T > sin(const complex< T > & z);
template <typename T> _CCCL_HOST_DEVICE complex< T > tan(const complex< T > & z);
template <typename T> _CCCL_HOST_DEVICE complex< T > cosh(const complex< T > & z);
template <typename T> _CCCL_HOST_DEVICE complex< T > sinh(const complex< T > & z);
template <typename T> _CCCL_HOST_DEVICE complex< T > tanh(const complex< T > & z);
template <typename T> _CCCL_HOST_DEVICE complex< T > acos(const complex< T > & z);
template <typename T> _CCCL_HOST_DEVICE complex< T > asin(const complex< T > & z);
template <typename T> _CCCL_HOST_DEVICE complex< T > atan(const complex< T > & z);
template <typename T> _CCCL_HOST_DEVICE complex< T > acosh(const complex< T > & z);
template <typename T> _CCCL_HOST_DEVICE complex< T > asinh(const complex< T > & z);
template <typename T> _CCCL_HOST_DEVICE complex< T > atanh(const complex< T > & z);
template <typename T, typename CharT, typename Traits> std::basic_ostream< CharT, Traits > & operator<<(std::basic_ostream< CharT, Traits > & os, const complex< T > & z);
template <typename T, typename CharT, typename Traits> __host__ std::basic_istream< CharT, Traits > & operator>>(std::basic_istream< CharT, Traits > & is, complex< T > & z);
template <typename T0, typename T1> _CCCL_HOST_DEVICE bool operator==(const complex< T0 > & x, const complex< T1 > & y);
template <typename T0, typename T1> __host__ __device__ bool operator==(const complex< T0 > & x, const std::complex< T1 > & y);
template <typename T0, typename T1> __host__ __device__ bool operator==(const std::complex< T0 > & x, const complex< T1 > & y);
template <typename T0, typename T1> _CCCL_HOST_DEVICE bool operator==(const T0 & x, const complex< T1 > & y);
template <typename T0, typename T1> _CCCL_HOST_DEVICE bool operator==(const complex< T0 > & x, const T1 & y);
template <typename T0, typename T1> _CCCL_HOST_DEVICE bool operator!=(const complex< T0 > & x, const complex< T1 > & y);
template <typename T0, typename T1> __host__ __device__ bool operator!=(const complex< T0 > & x, const std::complex< T1 > & y);
template <typename T0, typename T1> __host__ __device__ bool operator!=(const std::complex< T0 > & x, const complex< T1 > & y);
template <typename T0, typename T1> _CCCL_HOST_DEVICE bool operator!=(const T0 & x, const complex< T1 > & y);
template <typename T0, typename T1> _CCCL_HOST_DEVICE bool operator!=(const complex< T0 > & x, const T1 & y);
Member Classes
Struct thrust::complex
Types
Typedef value_type
typedef Tvalue_type;
value_type
is the type of complex's
real and imaginary parts.
Functions
Function complex
_CCCL_HOST_DEVICE complex(const T & re);
Construct a complex number with an imaginary part of 0.
Function Parameters: re
: The real part of the number.
Function complex
_CCCL_HOST_DEVICE complex(const T & re, const T & im);
Construct a complex number from its real and imaginary parts.
Function Parameters:
re
The real part of the number.im
The imaginary part of the number.
Function complex
complex() = default;
Default construct a complex number.
Function complex
complex(const complex< T > & z) = default;
This copy constructor copies from a complex
with a type that is convertible to this complex's
value_type
.
Function Parameters: z
: The complex
to copy from.
Function complex
template <typename U> _CCCL_HOST_DEVICE complex(const complex< U > & z);
This converting copy constructor copies from a complex
with a type that is convertible to this complex's
value_type
.
Template Parameters: U
: is convertible to value_type
.
Function Parameters: z
: The complex
to copy from.
Function complex
__host__ __device__ complex(const std::complex< T > & z);
This converting copy constructor copies from a std::complex
with a type that is convertible to this complex's
value_type
.
Function Parameters: z
: The complex
to copy from.
Function complex
template <typename U> __host__ __device__ complex(const std::complex< U > & z);
This converting copy constructor copies from a std::complex
with a type that is convertible to this complex's
value_type
.
Template Parameters: U
: is convertible to value_type
.
Function Parameters: z
: The complex
to copy from.
Function operator=
_CCCL_HOST_DEVICE complex & operator=(const T & re);
Assign re
to the real part of this complex
and set the imaginary part to 0.
Function Parameters: re
: The real part of the number.
Function operator=
complex & operator=(const complex< T > & z) = default;
Assign z.real()
and z.imag()
to the real and imaginary parts of this complex
respectively.
Function Parameters: z
: The complex
to copy from.
Function operator=
template <typename U> _CCCL_HOST_DEVICE complex & operator=(const complex< U > & z);
Assign z.real()
and z.imag()
to the real and imaginary parts of this complex
respectively.
Template Parameters: U
: is convertible to value_type
.
Function Parameters: z
: The complex
to copy from.
Function operator=
__host__ __device__ complex & operator=(const std::complex< T > & z);
Assign z.real()
and z.imag()
to the real and imaginary parts of this complex
respectively.
Function Parameters: z
: The complex
to copy from.
Function operator=
template <typename U> __host__ __device__ complex & operator=(const std::complex< U > & z);
Assign z.real()
and z.imag()
to the real and imaginary parts of this complex
respectively.
Template Parameters: U
: is convertible to value_type
.
Function Parameters: z
: The complex
to copy from.
Function operator+=
template <typename U> _CCCL_HOST_DEVICE complex< T > & operator+=(const complex< U > & z);
Adds a complex
to this complex
and assigns the result to this complex
.
Template Parameters: U
: is convertible to value_type
.
Function Parameters: z
: The complex
to be added.
Function operator-=
template <typename U> _CCCL_HOST_DEVICE complex< T > & operator-=(const complex< U > & z);
Subtracts a complex
from this complex
and assigns the result to this complex
.
Template Parameters: U
: is convertible to value_type
.
Function Parameters: z
: The complex
to be subtracted.
Function operator*=
template <typename U> _CCCL_HOST_DEVICE complex< T > & operator*=(const complex< U > & z);
Multiplies this complex
by another complex
and assigns the result to this complex
.
Template Parameters: U
: is convertible to value_type
.
Function Parameters: z
: The complex
to be multiplied.
Function operator/=
template <typename U> _CCCL_HOST_DEVICE complex< T > & operator/=(const complex< U > & z);
Divides this complex
by another complex
and assigns the result to this complex
.
Template Parameters: U
: is convertible to value_type
.
Function Parameters: z
: The complex
to be divided.
Function operator+=
template <typename U> _CCCL_HOST_DEVICE complex< T > & operator+=(const U & z);
Adds a scalar to this complex
and assigns the result to this complex
.
Template Parameters: U
: is convertible to value_type
.
Function Parameters: z
: The complex
to be added.
Function operator-=
template <typename U> _CCCL_HOST_DEVICE complex< T > & operator-=(const U & z);
Subtracts a scalar from this complex
and assigns the result to this complex
.
Template Parameters: U
: is convertible to value_type
.
Function Parameters: z
: The scalar to be subtracted.
Function operator*=
template <typename U> _CCCL_HOST_DEVICE complex< T > & operator*=(const U & z);
Multiplies this complex
by a scalar and assigns the result to this complex
.
Template Parameters: U
: is convertible to value_type
.
Function Parameters: z
: The scalar to be multiplied.
Function operator/=
template <typename U> _CCCL_HOST_DEVICE complex< T > & operator/=(const U & z);
Divides this complex
by a scalar and assigns the result to this complex
.
Template Parameters: U
: is convertible to value_type
.
Function Parameters: z
: The scalar to be divided.
Function real
_CCCL_HOST_DEVICE T real() const;
Returns the real part of this complex
.
Function imag
_CCCL_HOST_DEVICE T imag() const;
Returns the imaginary part of this complex
.
Function real
_CCCL_HOST_DEVICE T real() const;
Returns the real part of this complex
.
Function imag
_CCCL_HOST_DEVICE T imag() const;
Returns the imaginary part of this complex
.
Function real
_CCCL_HOST_DEVICE void real(T re);
Sets the real part of this complex
.
Function Parameters: re
: The new real part of this complex
.
Function imag
_CCCL_HOST_DEVICE void imag(T im);
Sets the imaginary part of this complex
.
Function Parameters: im
: The new imaginary part of this complex.e
Function real
_CCCL_HOST_DEVICE void real(T re);
Sets the real part of this complex
.
Function Parameters: re
: The new real part of this complex
.
Function imag
_CCCL_HOST_DEVICE void imag(T im);
Sets the imaginary part of this complex
.
Function Parameters: im
: The new imaginary part of this complex
.
Function operator std::complex< T >
__host__ operator std::complex< T >() const;
Casts this complex
to a std::complex
of the same type.
Function abs
template <typename T> _CCCL_HOST_DEVICE T abs(const complex< T > & z);
Returns the magnitude (also known as absolute value) of a complex
.
Function Parameters: z
: The complex
from which to calculate the absolute value.
Function arg
template <typename T> _CCCL_HOST_DEVICE T arg(const complex< T > & z);
Returns the phase angle (also known as argument) in radians of a complex
.
Function Parameters: z
: The complex
from which to calculate the phase angle.
Function norm
template <typename T> _CCCL_HOST_DEVICE T norm(const complex< T > & z);
Returns the square of the magnitude of a complex
.
Function Parameters: z
: The complex
from which to calculate the norm.
Function conj
template <typename T> _CCCL_HOST_DEVICE complex< T > conj(const complex< T > & z);
Returns the complex conjugate of a complex
.
Function Parameters: z
: The complex
from which to calculate the complex conjugate.
Function polar
template <typename T0, typename T1> _CCCL_HOST_DEVICE complex< typename detail::promoted_numerical_type< T0, T1 >::type > polar(const T0 & m, const T1 & theta = T1());
Returns a complex
with the specified magnitude and phase.
Function Parameters:
m
The magnitude of the returnedcomplex
.theta
The phase of the returnedcomplex
in radians.
Function proj
template <typename T> _CCCL_HOST_DEVICE complex< T > proj(const T & z);
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.
Function Parameters: z
: The complex
argument.
Function operator+
template <typename T0, typename T1> _CCCL_HOST_DEVICE complex< typename detail::promoted_numerical_type< T0, T1 >::type > operator+(const complex< T0 > & x, const complex< T1 > & y);
Adds two complex
numbers.
The value types of the two complex
types should be compatible and the type of the returned complex
is the promoted type of the two arguments.
Function Parameters:
x
The firstcomplex
.y
The secondcomplex
.
Function operator+
template <typename T0, typename T1> _CCCL_HOST_DEVICE complex< typename detail::promoted_numerical_type< T0, T1 >::type > operator+(const complex< T0 > & x, const T1 & y);
Adds a scalar to a complex
number.
The value 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.
Function Parameters:
x
Thecomplex
.y
The scalar.
Function operator+
template <typename T0, typename T1> _CCCL_HOST_DEVICE complex< typename detail::promoted_numerical_type< T0, T1 >::type > operator+(const T0 & x, const complex< T1 > & y);
Adds a complex
number to a scalar.
The value 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.
Function Parameters:
x
The scalar.y
Thecomplex
.
Function operator-
template <typename T0, typename T1> _CCCL_HOST_DEVICE complex< typename detail::promoted_numerical_type< T0, T1 >::type > operator-(const complex< T0 > & x, const complex< T1 > & y);
Subtracts two complex
numbers.
The value types of the two complex
types should be compatible and the type of the returned complex
is the promoted type of the two arguments.
Function Parameters:
x
The firstcomplex
(minuend).y
The secondcomplex
(subtrahend).
Function operator-
template <typename T0, typename T1> _CCCL_HOST_DEVICE complex< typename detail::promoted_numerical_type< T0, T1 >::type > operator-(const complex< T0 > & x, const T1 & y);
Subtracts a scalar from a complex
number.
The value 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.
Function Parameters:
x
Thecomplex
(minuend).y
The scalar (subtrahend).
Function operator-
template <typename T0, typename T1> _CCCL_HOST_DEVICE complex< typename detail::promoted_numerical_type< T0, T1 >::type > operator-(const T0 & x, const complex< T1 > & y);
Subtracts a complex
number from a scalar.
The value 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.
Function Parameters:
x
The scalar (minuend).y
Thecomplex
(subtrahend).
Function operator*
template <typename T0, typename T1> _CCCL_HOST_DEVICE complex< typename detail::promoted_numerical_type< T0, T1 >::type > operator*(const complex< T0 > & x, const complex< T1 > & y);
Multiplies two complex
numbers.
The value types of the two complex
types should be compatible and the type of the returned complex
is the promoted type of the two arguments.
Function Parameters:
x
The firstcomplex
.y
The secondcomplex
.
Function operator*
template <typename T0, typename T1> _CCCL_HOST_DEVICE complex< typename detail::promoted_numerical_type< T0, T1 >::type > operator*(const complex< T0 > & x, const T1 & y);
Multiplies a complex
number by a scalar.
Function Parameters:
x
Thecomplex
.y
The scalar.
Function operator*
template <typename T0, typename T1> _CCCL_HOST_DEVICE complex< typename detail::promoted_numerical_type< T0, T1 >::type > operator*(const T0 & x, const complex< T1 > & y);
Multiplies a scalar by a complex
number.
The value 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.
Function Parameters:
x
The scalar.y
Thecomplex
.
Function operator/
template <typename T0, typename T1> _CCCL_HOST_DEVICE complex< typename detail::promoted_numerical_type< T0, T1 >::type > operator/(const complex< T0 > & x, const complex< T1 > & y);
Divides two complex
numbers.
The value types of the two complex
types should be compatible and the type of the returned complex
is the promoted type of the two arguments.
Function Parameters:
x
The numerator (dividend).y
The denomimator (divisor).
Function operator/
template <typename T0, typename T1> _CCCL_HOST_DEVICE complex< typename detail::promoted_numerical_type< T0, T1 >::type > operator/(const complex< T0 > & x, const T1 & y);
Divides a complex
number by a scalar.
The value 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.
Function Parameters:
x
The complex numerator (dividend).y
The scalar denomimator (divisor).
Function operator/
template <typename T0, typename T1> _CCCL_HOST_DEVICE complex< typename detail::promoted_numerical_type< T0, T1 >::type > operator/(const T0 & x, const complex< T1 > & y);
Divides a scalar by a complex
number.
The value 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.
Function Parameters:
x
The scalar numerator (dividend).y
The complex denomimator (divisor).
Function operator+
template <typename T> _CCCL_HOST_DEVICE complex< T > operator+(const complex< T > & y);
Unary plus, returns its complex
argument.
Function Parameters: y
: The complex
argument.
Function operator-
template <typename T> _CCCL_HOST_DEVICE complex< T > operator-(const complex< T > & y);
Unary minus, returns the additive inverse (negation) of its complex
argument.
Function Parameters: y
: The complex
argument.
Function exp
template <typename T> _CCCL_HOST_DEVICE complex< T > exp(const complex< T > & z);
Returns the complex exponential of a complex
number.
Function Parameters: z
: The complex
argument.
Function log
template <typename T> _CCCL_HOST_DEVICE complex< T > log(const complex< T > & z);
Returns the complex natural logarithm of a complex
number.
Function Parameters: z
: The complex
argument.
Function log10
template <typename T> _CCCL_HOST_DEVICE complex< T > log10(const complex< T > & z);
Returns the complex base 10 logarithm of a complex
number.
Function Parameters: z
: The complex
argument.
Function pow
template <typename T0, typename T1> _CCCL_HOST_DEVICE complex< typename detail::promoted_numerical_type< T0, T1 >::type > pow(const complex< T0 > & x, const complex< T1 > & y);
Returns a complex
number raised to another.
The value types of the two complex
types should be compatible and the type of the returned complex
is the promoted type of the two arguments.
Function Parameters:
x
The base.y
The exponent.
Function pow
template <typename T0, typename T1> _CCCL_HOST_DEVICE complex< typename detail::promoted_numerical_type< T0, T1 >::type > pow(const complex< T0 > & x, const T1 & y);
Returns a complex
number raised to a scalar.
The value 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.
Function Parameters:
x
The base.y
The exponent.
Function pow
template <typename T0, typename T1> _CCCL_HOST_DEVICE complex< typename detail::promoted_numerical_type< T0, T1 >::type > pow(const T0 & x, const complex< T1 > & y);
Returns a scalar raised to a complex
number.
The value 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.
Function Parameters:
x
The base.y
The exponent.
Function sqrt
template <typename T> _CCCL_HOST_DEVICE complex< T > sqrt(const complex< T > & z);
Returns the complex square root of a complex
number.
Function Parameters: z
: The complex
argument.
Function cos
template <typename T> _CCCL_HOST_DEVICE complex< T > cos(const complex< T > & z);
Returns the complex cosine of a complex
number.
Function Parameters: z
: The complex
argument.
Function sin
template <typename T> _CCCL_HOST_DEVICE complex< T > sin(const complex< T > & z);
Returns the complex sine of a complex
number.
Function Parameters: z
: The complex
argument.
Function tan
template <typename T> _CCCL_HOST_DEVICE complex< T > tan(const complex< T > & z);
Returns the complex tangent of a complex
number.
Function Parameters: z
: The complex
argument.
Function cosh
template <typename T> _CCCL_HOST_DEVICE complex< T > cosh(const complex< T > & z);
Returns the complex hyperbolic cosine of a complex
number.
Function Parameters: z
: The complex
argument.
Function sinh
template <typename T> _CCCL_HOST_DEVICE complex< T > sinh(const complex< T > & z);
Returns the complex hyperbolic sine of a complex
number.
Function Parameters: z
: The complex
argument.
Function tanh
template <typename T> _CCCL_HOST_DEVICE complex< T > tanh(const complex< T > & z);
Returns the complex hyperbolic tangent of a complex
number.
Function Parameters: z
: The complex
argument.
Function acos
template <typename T> _CCCL_HOST_DEVICE complex< T > 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]
Function Parameters: z
: The complex
argument.
Function asin
template <typename T> _CCCL_HOST_DEVICE complex< T > 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]
Function Parameters: z
: The complex
argument.
Function atan
template <typename T> _CCCL_HOST_DEVICE complex< T > 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]
Function Parameters: z
: The complex
argument.
Function acosh
template <typename T> _CCCL_HOST_DEVICE complex< T > 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]
Function Parameters: z
: The complex
argument.
Function asinh
template <typename T> _CCCL_HOST_DEVICE complex< T > 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]
Function Parameters: z
: The complex
argument.
Function atanh
template <typename T> _CCCL_HOST_DEVICE complex< T > 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]
Function Parameters: z
: The complex
argument.
Function operator<<
template <typename T, typename CharT, typename Traits> std::basic_ostream< CharT, Traits > & operator<<(std::basic_ostream< CharT, Traits > & os, const complex< T > & z);
Writes to an output stream a complex
number in the form (real, imaginary).
Function Parameters:
os
The output stream.z
Thecomplex
number to output.
Function operator>>
template <typename T, typename CharT, typename Traits> __host__ std::basic_istream< CharT, Traits > & operator>>(std::basic_istream< CharT, Traits > & is, complex< T > & 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
Function Parameters:
is
The input stream.z
Thecomplex
number to set.
Function operator==
template <typename T0, typename T1> _CCCL_HOST_DEVICE bool operator==(const complex< T0 > & x, const complex< T1 > & y);
Returns true if two complex
numbers are equal and false otherwise.
Function Parameters:
x
The firstcomplex
.y
The secondcomplex
.
Function operator==
template <typename T0, typename T1> __host__ __device__ bool operator==(const complex< T0 > & x, const std::complex< T1 > & y);
Returns true if two complex
numbers are equal and false otherwise.
Function Parameters:
x
The firstcomplex
.y
The secondcomplex
.
Function operator==
template <typename T0, typename T1> __host__ __device__ bool operator==(const std::complex< T0 > & x, const complex< T1 > & y);
Returns true if two complex
numbers are equal and false otherwise.
Function Parameters:
x
The firstcomplex
.y
The secondcomplex
.
Function operator==
template <typename T0, typename T1> _CCCL_HOST_DEVICE bool operator==(const T0 & x, const complex< T1 > & y);
Returns true if the imaginary part of the complex
number is zero and the real part is equal to the scalar. Returns false otherwise.
Function Parameters:
x
The scalar.y
Thecomplex
.
Function operator==
template <typename T0, typename T1> _CCCL_HOST_DEVICE bool operator==(const complex< T0 > & x, const T1 & y);
Returns true if the imaginary part of the complex
number is zero and the real part is equal to the scalar. Returns false otherwise.
Function Parameters:
x
Thecomplex
.y
The scalar.
Function operator!=
template <typename T0, typename T1> _CCCL_HOST_DEVICE bool operator!=(const complex< T0 > & x, const complex< T1 > & y);
Returns true if two complex
numbers are different and false otherwise.
Function Parameters:
x
The firstcomplex
.y
The secondcomplex
.
Function operator!=
template <typename T0, typename T1> __host__ __device__ bool operator!=(const complex< T0 > & x, const std::complex< T1 > & y);
Returns true if two complex
numbers are different and false otherwise.
Function Parameters:
x
The firstcomplex
.y
The secondcomplex
.
Function operator!=
template <typename T0, typename T1> __host__ __device__ bool operator!=(const std::complex< T0 > & x, const complex< T1 > & y);
Returns true if two complex
numbers are different and false otherwise.
Function Parameters:
x
The firstcomplex
.y
The secondcomplex
.
Function operator!=
template <typename T0, typename T1> _CCCL_HOST_DEVICE bool operator!=(const T0 & x, const complex< T1 > & y);
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.
Function Parameters:
x
The scalar.y
Thecomplex
.
Function operator!=
template <typename T0, typename T1> _CCCL_HOST_DEVICE bool operator!=(const complex< T0 > & x, const T1 & y);
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.
Function Parameters:
x
Thecomplex
.y
The scalar.