title: How to solve complex linear systems?
body: <p>I have a complex matrix A and a complex vector b. I would like to solve the linear system Ax=b.
  I tried to use the example on this page, and adapt it to my complex problem. <a href="http://eigen.tuxfamily.org/dox/group__TutorialLinearAlgebra.html" rel="nofollow noreferrer">http://eigen.tuxfamily.org/dox/group__TutorialLinearAlgebra.html</a></p>
  
  <p>Here is a simplified example of what I'm trying to do:</p>
  
  <p>My objects are defined this way:</p>
  
  <pre><code>typedef Eigen::Matrix&lt;complexd, Eigen::Dynamic, Eigen::Dynamic&gt; DoubleComplexMatrix;
  typedef Eigen::Array&lt;complexd, Eigen::Dynamic, 1&gt; DoubleComplexArray;
  </code></pre>
  
  <p>And in my code I want to solve this</p>
  
  <pre><code>   DoubleComplexMatrix A(3,3);
     DoubleComplexArray b(3);
     DoubleComplexArray x(3);
  
     A &lt;&lt; 1,2,3,  4,5,6,  7,8,10;
     b &lt;&lt; 3, 3, 4;
     cout &lt;&lt; "Here is the matrix A:\n" &lt;&lt; A &lt;&lt; endl;
     cout &lt;&lt; "Here is the vector b:\n" &lt;&lt; b &lt;&lt; endl;
  
     ColPivHouseholderQR&lt;DoubleComplexMatrix&gt; dec(A);
     x = dec.solve(b);
     cout &lt;&lt; "The solution is:\n" &lt;&lt; x &lt;&lt; endl;
  </code></pre>
  
  <p>The error appears at the line: <code>DoubleComplexArray x = dec.solve(b);</code> because when I comment it, there is no more error.</p>
  
  <p>I get this error:</p>
  
  <pre><code>TideSolve.cpp:98:38: error: no matching function for call to ‘Eigen::ColPivHouseholderQR&lt;Eigen::Matrix&lt;std::complex&lt;double&gt;, -1, -1&gt; &gt;::solve(DoubleComplexArray&amp;)’
  DoubleComplexArray x = dec.solve(b);
  </code></pre>
  
  <p>Does that mean that eigen solvers does not work with complex? (I'm sure they do, and I'm just bad!)
  Do I need another solver than <code>ColPivHouseholderQR</code> that work with complex? If so, which one?</p>
  
  <p>I have found <a href="https://stackoverflow.com/q/13747290">an old question</a> where someone used another solver.</p>