title: CuFFT Double to Complex
body: <p>i want to make a FFT from double to std::complex with the CuFFT Lib. My Code looks like</p>
  
  <pre><code>#include &lt;complex&gt;
  #include &lt;iostream&gt;
  #include &lt;cufft.h&gt;
  #include &lt;cuda_runtime_api.h&gt;
  
  typedef std::complex&lt;double&gt; Complex;
  using namespace std;
  
  int main(){
    int n = 100;
    double* in;
    Complex* out;
    in = (double*) malloc(sizeof(double) * n);
    out = (Complex*) malloc(sizeof(Complex) * n/2+1);
    for(int i=0; i&lt;n; i++){
       in[i] = 1;
    }
  
    cufftHandle plan;
    plan = cufftPlan1d(&amp;plan, n, CUFFT_D2Z, 1);
    unsigned int mem_size = sizeof(double)*n;
    cufftDoubleReal *d_in;
    cufftDoubleComplex *d_out;
    cudaMalloc((void **)&amp;d_in, mem_size);
    cudaMalloc((void **)&amp;d_out, mem_size);
    cudaMemcpy(d_in, in, mem_size, cudaMemcpyHostToDevice);
    cudaMemcpy(d_out, out, mem_size, cudaMemcpyHostToDevice);
    int succes = cufftExecD2Z(plan,(cufftDoubleReal *) d_in,(cufftDoubleComplex *) d_out);
    cout &lt;&lt; succes &lt;&lt; endl;
    cudaMemcpy(out, d_out, mem_size, cudaMemcpyDeviceToHost);
  
    for(int i=0; i&lt;n/2; i++){
       cout &lt;&lt; "out: " &lt;&lt; i &lt;&lt; " "  &lt;&lt; out[i].real() &lt;&lt; " " &lt;&lt;  out[i].imag() &lt;&lt; endl;
    }
    return 0;
  }
  </code></pre>
  
  <p>but it seems to me this must be wrong, because i think the transformed values should be 1 0 0 0 0 .... or without the normalization 100 0 0 0 0 .... but i just get 0 0 0 0 0 ...</p>
  
  <p>Furthermore i would like it more if the cufftExecD2Z would work in place, which should be possible but i haven't figured out how to correctly do so. Can anybody help? </p>