title: Convert complex<double>* to double*
body: <p>I have a image represented by <code>std::complex&lt;double&gt;* c1</code> and I want to convert it to <code>double*</code> of twice the size (array size not data size). The complex image comes from some previous FFT operations. I need to do some images pixel-wise additions
  so I think representing the data using <code>double*</code> would be more convenient. If you want to ask why I have to do that since I want to use CUDA to do the additions and complex addition in kernel code doesn't really support atomic operation (Or, is there any that you know?:> ). So adding double will hopefully give the same result.</p>
  
  <p>I have tried comparing the types of <code>std::complex&lt;double&gt;</code> and <code>double</code>. For example, using the function of printing binary format of a variable provided by this <a href="https://stackoverflow.com/questions/111928/is-there-a-printf-converter-to-print-in-binary-format">link</a>, I print two numbers:</p>
  
  <pre><code>double a1 = 1.0;
  complex&lt;double&gt; a2(1.0, 1.0);
  
  printBits(sizeof(double), &amp;a1);
  printBits(sizeof(complex&lt;double&gt;), &amp;a2);
  </code></pre>
  
  <p>which gives</p>
  
  <pre><code>0011111111110000000000000000000000000000000000000000000000000000
  00111111111100000000000000000000000000000000000000000000000000000011111111110000000000000000000000000000000000000000000000000000.
  </code></pre>
  
  <p>So the second one is the exact two copies of the first one, which sounds to me that double complex is just concatenating 2 double's together. </p>
  
  <p>So for my image, I used the following two versions of conversion (suppose my image is stored in a <code>complex&lt;double&gt;</code> array "image"):</p>
  
  <pre><code>// C type cast
  double* C_image = (double*)image;
  // Reinterpret cast
  double* reinterpret_image = reinterpret_cast&lt;double*&gt;(c1);
  </code></pre>
  
  <p>Both results seem to be correct. Since I am doing a lot of this type of conversions in my image process code, I really want to make sure the conversion is well supported in "theory". So my question would be are the above conversions valid? Or just kind of hacky and might result in some bug in some situations? Which conversion is better, in terms of both performance (if any) and robustness?</p>