cufftExecR2C

why is the output of Real to Complex in cufftExecR2C has its sign different than matlab result for the imaginary part. for example cuda give 5+4j, matlab is 5-4j

also whats the easy/fast way to convert values store in section of memory from float to double?

most likely because you have made a mistake of some sort, either in calculation or interpretation of results. The R2C CUFFT functions have a data layout that is not the same as C2C, and this trips up many users of CUFFT.

one possible approach:

__global__ void convert(double *da, const float *fa, const int len){

   int idx= threadIdx.x+blockDim.x*blockIdx.x;
   if (idx < len) da[idx] = fa[idx];
}

However this may be overkill. You may be able to cast the float data to double on the fly, depending on what you are doing exactly.

I check it, didn’t find any errors, I match the real fft input against matlab it match. not sure why only the sign on img is wrong for all the output.