title: Difference between image of FT in matlab vs. cuda
body: <p>I am trying to implement a matlab code that I have that does a 2D convolution. </p>
  
  <p>The matlab code first centers the 3x3 kernel in a padded matrix the size of the Image. I do the same thing in my C++ code.</p>
  
  <p>I have outputted my array and the matlab matrix to .csv files and confirmed that they are identical. I then run a forward FFT on each of these. In matlab, the FT image of the kernel looks like you'd expect - basically intense in the middle, radiating out in a circle. However, the CUDA FT image (which i am drawing in matlab after importing it as a csv) looks like an oval. </p>
  
  <p>What can be causing this? It looks almost as if the kernel was not centered in the image, but like I said, I dumped out the padded Kernel data to a csv and used imagesc to see it in matlab, and it looks centered to me, and in fact is the exact same as the padded matlab kernel.</p>
  
  <p>This is the code I used to put my kernel in the center of my padded array:</p>
  
  <pre><code>kSize = 3;
  halfl = 0.5*(kSize-1);
  
  if(chipW%2 == 0)
      dcW = (.5*chipW) +1;
  else
      dcW = round(chipW*.5);
  
  if(chipH%2 == 0)
      dcH = (.5*chipH) +1;
  else
      dcH = round(chipH*.5);
  
  dcH--;
  dcW--;
  
  
  for(int i = dcH-halfl ; i &lt;= dcH+halfl ; i++)
  
  {
      for(int j = dcW -halfl ; j &lt;= dcW+halfl ; j++)
  
      {
          h_PaddedKernel[i*chipW + j] = make_cuComplex(hp_kernel[(i-(dcH-halfl))*kSize + (j-(dcW-halfl))], 0.0);
  
      }
  
  
  }
  </code></pre>
  
  <p>kSize is the width of one size of my kernel, chipW and chipH are the width and height of the image i am trying to process</p>