title: How do I work with complex numbers in Eigen (C++)?
body: <p>I am successfully working with Eigen and I'm trying to understand a few details with complex numbers.</p>
  
  <ol>
  <li>How do I multiply a Matrix or Vector by a complex constant?  Multiplying to complex matrices is easy; likewise with inner products of complex vectors and matrices.</li>
  <li>How do I assign a complex value to a matrix element?  I've tried:</li>
  </ol>
  
  <p>This works fine (Visual Studio)</p>
  
  <pre><code>kx.real()(0, 0) = 1.0;
  </code></pre>
  
  <p>This throws a compiler error</p>
  
  <pre><code>kz_r.imag()(0, ii) =1.0
  </code></pre>
  
  <p>The error I get is:</p>
  
  <blockquote>
    <p>Severity  Code    Description Project File    Line    Suppression State
    Error   C2440   'return': cannot convert from 'double' to 'double &amp;'        \eigen\src\core\mathfunctions.h 919 </p>
  </blockquote>