title: Porting inversion of 1000x1000 matrix of complex numbers from Matlab to C++
body: <p>Matlab code: </p>
  
  <pre><code>invD = inv(D);
  Dew=2*invD-E;
  </code></pre>
  
  <p>D is 1000x1000 matrix of complex numbers. It inverts in 0,5 sec or less.</p>
  
  <p>I tried several ways of porting this code to C++, using different approaches, but it is always slower than 10 seconds. What am I doing wrong? How possibly Matlab optimizes that code?</p>
  
  <p>I did't write this matlab code, I just have to port it. Sorry, I'm much better in coding that in math.</p>