cuda C++ cuFloatComplex/cufftComplex/复数 exp

cuComplex.h不支持exp()函数,因此需要自己写

__host__ __device__
cuFloatComplex my_complex_exp (cuFloatComplex arg)
{
   cuFloatComplex res;
   float s, c;
   float e = expf(arg.x);
   sincosf(arg.y, &s, &c);
   res.x = c * e;
   res.y = s * e;
   return res;
}

cuFloatComplex my_complex_exp (cuFloatComplex arg)
{
   cuFloatComplex res;
   float s, c;
   float e = expf(arg.x);
   sincosf(arg.y, &s, &c);
   res.x = c * e;
   res.y = s * e;
   return res;
}

参考:

  1. https://stackoverflow.com/questions/9860711/cucomplex-h-and-exp

你可能感兴趣的:(c++,cuda)