27 #include <cuComplex.h>    34 #if !defined(__CUDACC_RTC__)    56 float const &
real(cuFloatComplex 
const &z) { 
return z.x; }
    60 float &
real(cuFloatComplex &z) { 
return z.x; }
    64 double const &
real(cuDoubleComplex 
const &z) { 
return z.x; }
    68 double &
real(cuDoubleComplex &z) { 
return z.x; }
    72 float const &
imag(cuFloatComplex 
const &z) { 
return z.y; }
    76 float &
imag(cuFloatComplex &z) { 
return z.y; }
    80 double const &
imag(cuDoubleComplex 
const &z) { 
return z.y; }
    84 double &
imag(cuDoubleComplex &z) { 
return z.y; }
   116   complex(T r = T(0)) : _real(r), _imag(T(0)) {}
   129   complex(cuFloatComplex 
const &z) : _real(static_cast<T>(cuCrealf(z))), _imag(static_cast<T>(cuCimagf(z))) {}
   133   complex(cuDoubleComplex 
const &z) : _real(static_cast<T>(cuCreal(z))), _imag(static_cast<T>(cuCimag(z))) {}
   140     _real = 
static_cast<T
>(z.
real());
   141     _imag = 
static_cast<T
>(z.
imag());
   152     return !(*
this == rhs);
   156     template <
typename A>
   162     template <
typename A>
   168     template <
typename A>
   175     template <
typename A>
   181     template <
typename A>
   190     template <
typename A>
   196     template <
typename A>
   203   template <
typename A>
   210   template <
typename A>
   217   template <
typename A>
   224   template <
typename A>
   232   T 
const &
real()
 const { 
return _real; }
   240   T 
const &
imag()
 const { 
return _imag; }
   248   explicit operator cuFloatComplex()
 const { 
return make_cuFloatComplex(
float(
real()), 
float(
imag())); }
   252   explicit operator cuDoubleComplex()
 const { 
return make_cuDoubleComplex(
real(), 
imag()); }
   262 template <
typename T>
   268 template <
typename T>
   274 template <
typename T>
   280 template <
typename T>
   289 #if !defined(__CUDACC_RTC__)   290 template <
typename T>
   291 std::ostream &operator<<(std::ostream &out, complex<T> 
const &z) {
   296     return out << _r << 
"+i" << _i;
   312 template <
typename T>
   318 template <
typename T>
   324 template <
typename T>
   332     return static_cast<int8_t
>(z * z);
   336 template <
typename T>
   342 template <
typename T, 
typename R>
   344   return accumulator + 
static_cast<R
>(x) * static_cast<R>(x);
   348 template <
typename T, 
typename R>
   350   return accumulator + 
static_cast<R
>(
real(z)) * static_cast<R>(
real(z)) + 
   351     static_cast<R>(
imag(z)) * static_cast<R>(
imag(z));
   355 template <
typename T>
   361 template <
typename T>
   368 template <
typename T>
   374 template <
typename T>
   380 template <
typename T>
   386 template <
typename T>
   388   return log(z) / T(
log(T(10)));
   392 template <
typename T>
   394   return sqrt(T(2)) / T(2) *
   400 template <
typename T>
   402   return (
exp(z) + 
exp(-z)) / T(2);
   406 template <
typename T>
   414 template <
typename T>
 CUTLASS_HOST_DEVICE complex< T > cos(complex< T > const &z)
Computes the cosine of complex z. 
Definition: complex.h:401
CUTLASS_HOST_DEVICE complex(cuDoubleComplex const &z)
Conversion from cuDoubleComplex. 
Definition: complex.h:133
CUTLASS_HOST_DEVICE complex< T > & operator-=(complex< A > const &rhs)
Subtraction. 
Definition: complex.h:204
CUTLASS_HOST_DEVICE complex< T > operator-(complex< A > const &rhs) const 
Subtraction. 
Definition: complex.h:163
Definition: aligned_buffer.h:35
ComplexTransform
Enumeraed type describing a transformation on a complex value. 
Definition: complex.h:43
CUTLASS_HOST_DEVICE complex< T > & operator=(complex< A > const &z)
Assignment. 
Definition: complex.h:138
CUTLASS_HOST_DEVICE T abs(complex< T > const &z)
Returns the magnitude of the complex number. 
Definition: complex.h:313
CUTLASS_HOST_DEVICE float const & imag(cuFloatComplex const &z)
Returns the imaginary part of the complex number. 
Definition: complex.h:72
CUTLASS_HOST_DEVICE complex(T r=T(0))
Constructor. 
Definition: complex.h:116
CUTLASS_HOST_DEVICE R norm_accumulate(T const &x, R const &accumulator)
Norm-accumulate calculation. 
Definition: complex.h:343
Defines a class for using IEEE half-precision floating-point types in host or device code...
CUTLASS_HOST_DEVICE T norm(T const &z)
Returns the squared magnitude of a real number. 
Definition: complex.h:325
CUTLASS_HOST_DEVICE complex< T > polar(T const &r, T const &theta=T())
Returns a complex number with magnitude r and phase theta. 
Definition: complex.h:369
IEEE half-precision floating-point type. 
Definition: half.h:126
CUTLASS_HOST_DEVICE bool operator!=(complex< T > const &rhs) const 
Inequality operator. 
Definition: complex.h:151
CUTLASS_HOST_DEVICE float const & real(cuFloatComplex const &z)
Returns the real part of the complex number. 
Definition: complex.h:56
CUTLASS_HOST_DEVICE complex< T > exp(complex< T > const &z)
Computes the complex exponential of z. 
Definition: complex.h:375
CUTLASS_HOST_DEVICE T const & imag() const 
Accesses the imaginary part of the complex number. 
Definition: complex.h:240
CUTLASS_HOST_DEVICE T arg(complex< T > const &z)
Returns the magnitude of the complex number. 
Definition: complex.h:319
CUTLASS_HOST_DEVICE complex< T > log(complex< T > const &z)
Computes the complex exponential of z. 
Definition: complex.h:381
CUTLASS_HOST_DEVICE complex(T r, T i)
Constructor. 
Definition: complex.h:120
CUTLASS_HOST_DEVICE bool operator==(complex< T > const &rhs) const 
Equality operator. 
Definition: complex.h:146
CUTLASS_HOST_DEVICE complex< T > conj(complex< T > const &z)
Returns the complex conjugate. 
Definition: complex.h:356
CUTLASS_HOST_DEVICE complex< T > & operator*=(complex< A > const &rhs)
Multiplication. 
Definition: complex.h:211
#define CUTLASS_HOST_DEVICE
Definition: cutlass.h:89
CUTLASS_HOST_DEVICE T & imag()
Accesses the imaginary part of the complex number. 
Definition: complex.h:244
CUTLASS_HOST_DEVICE complex< T > sin(complex< T > const &z)
Computes the sin of complex z. 
Definition: complex.h:407
CUTLASS_HOST_DEVICE complex(cuFloatComplex const &z)
Conversion from cuFloatComplex. 
Definition: complex.h:129
CUTLASS_HOST_DEVICE complex< T > operator+(complex< A > const &rhs) const 
Addition. 
Definition: complex.h:157
CUTLASS_HOST_DEVICE T const & real() const 
Accesses the real part of the complex number. 
Definition: complex.h:232
CUTLASS_HOST_DEVICE complex< T > proj(complex< T > const &z)
Projects the complex number z onto the Riemann sphere. 
Definition: complex.h:362
CUTLASS_HOST_DEVICE complex< T > operator*(complex< A > const &rhs) const 
Multiplication. 
Definition: complex.h:169
CUTLASS_HOST_DEVICE complex< T > & operator*=(A s)
Scalar multiplication. 
Definition: complex.h:218
CUTLASS_HOST_DEVICE T & real()
Accesses the real part of the complex number. 
Definition: complex.h:236
CUTLASS_HOST_DEVICE complex< T > operator*(A const &s) const 
Scalar Multiplication. 
Definition: complex.h:176
CUTLASS_HOST_DEVICE complex< T > & operator+=(complex< A > const &rhs)
Addition. 
Definition: complex.h:197
CUTLASS_HOST_DEVICE complex< T > operator/(complex< A > const &rhs) const 
Division. 
Definition: complex.h:182
CUTLASS_HOST_DEVICE complex< T > & operator/=(complex< A > const &rhs)
Division. 
Definition: complex.h:225
CUTLASS_HOST_DEVICE complex(complex< A > const &z)
Constructor. 
Definition: complex.h:125
CUTLASS_HOST_DEVICE complex< T > log10(complex< T > const &z)
Computes the complex exponential of z. 
Definition: complex.h:387
Used to determine the real-valued underlying type of a numeric type T. 
Definition: real.h:31
Basic include for CUTLASS. 
CUTLASS_HOST_DEVICE complex< T > operator/(A const &s) const 
Scalar Division. 
Definition: complex.h:191
CUTLASS_HOST_DEVICE complex< T > sqrt(complex< T > const &z)
Computes the square root of complex number z. 
Definition: complex.h:393
T Type
Definition: complex.h:416