title: Eigen LDLT slower than LLT?
body: <p>I'm using the Cholesky module of Eigen 3 for solving a linear equation system. The Eigen documentation states, that using <a href="http://eigen.tuxfamily.org/dox/classEigen_1_1LDLT.html" rel="nofollow"><code>LDLT</code></a> instead of <a href="http://eigen.tuxfamily.org/dox/classEigen_1_1LLT.html" rel="nofollow"><code>LLT</code></a> would be faster for this purpose, but my benchmarks show a different result.</p>
  
  <p>I using the following code for benchmarking:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;chrono&gt;
  #include &lt;Eigen/Core&gt;
  #include &lt;Eigen/Cholesky&gt;
  using namespace std;
  using namespace std::chrono;
  using namespace Eigen;
  
  int main()
  {
      MatrixXf cov = MatrixXf::Random(4200, 4200);
      cov = (cov + cov.transpose()) + 1000 * MatrixXf::Identity(4200, 4200);
      VectorXf b = VectorXf::Random(4200), r1, r2;
  
      r1 = b;
      LLT&lt;MatrixXf&gt; llt;
      auto start = high_resolution_clock::now();
      llt.compute(cov);
      if (llt.info() != Success)
      {
          cout &lt;&lt; "Error on LLT!" &lt;&lt; endl;
          return 1;
      }
      auto middle = high_resolution_clock::now();
      llt.solveInPlace(r1);
      auto stop = high_resolution_clock::now();
      cout &lt;&lt; "LLT decomposition &amp; solving in  " &lt;&lt; duration_cast&lt;milliseconds&gt;(middle - start).count()
           &lt;&lt; " + " &lt;&lt; duration_cast&lt;milliseconds&gt;(stop - middle).count() &lt;&lt; " ms." &lt;&lt; endl;
  
      r2 = b;
      LDLT&lt;MatrixXf&gt; ldlt;
      start = high_resolution_clock::now();
      ldlt.compute(cov);
      if (ldlt.info() != Success)
      {
          cout &lt;&lt; "Error on LDLT!" &lt;&lt; endl;
          return 1;
      }
      middle = high_resolution_clock::now();
      ldlt.solveInPlace(r2);
      stop = high_resolution_clock::now();
      cout &lt;&lt; "LDLT decomposition &amp; solving in " &lt;&lt; duration_cast&lt;milliseconds&gt;(stop - start).count()
           &lt;&lt; " + " &lt;&lt; duration_cast&lt;milliseconds&gt;(stop - middle).count() &lt;&lt; " ms." &lt;&lt; endl;
  
      cout &lt;&lt; "Total result difference: " &lt;&lt; (r2 - r1).cwiseAbs().sum() &lt;&lt; endl;
      return 0;
  }
  </code></pre>
  
  <p>I've compiled it with <code>g++ -std=c++11 -O2 -o llt.exe llt.cc</code> on Windows and this is what I get:</p>
  
  <pre><code>LLT decomposition &amp; solving in  6515 + 15 ms.
  LDLT decomposition &amp; solving in 8562 + 15 ms.
  Total result difference: 1.27354e-006
  </code></pre>
  
  <p>So, why is LDLT slower than LLT? Am I doing something wrong or do I missunderstand the documentation?</p>