Converting real numbers to complex

I need to convert array of numbers from real to complex by:
real = num.
complex = cos(num) + j*sin(num).
Mayble someone know a way to do that without using sin and cos (maybe cuFFT)?

Your case will need the ‘cos’ and ‘sin’ eventually. Also, even if you use cufft (if it is needed for your case), cufft will in turn be using then as well :)

According to the formula you’ve given us above, num seems to be an angle in the complex plane.

There is a __sincosf function in CUDA that returns sine and cosine simultaneously. See the programming guide. It does have some restrictions on the argument to be in order to be really accuarte.

If you need to generate the cuComplex data type, there is a make_cuComplex() macro that takes real and imaginary component and returns a cuComplex.

And, if the accuracy of __sincosf() isn’t high enough, there is sincosf(), which is faster than sinf() and cosf() separately.