Increase precision in SelfAdjointEigenSolver in Eigen
<p>I am trying to determine the eigenvalues and eigenvectors of a sparse array in Eigen. Since I need to compute all the eigenvectors and eigenvalues, and I could not get this done using the unsupported ArpackSupport module working, I chose to convert the system to a dense matrix and compute the eigensystem using SelfAdjointEigenSolver (I know my matrix is real and has real eigenvalues). This works well until I have matrices of size 1024*1024 but then I start getting deviations from the expected results.</p>

<p>In the documentation of this module (<a href="https://eigen.tuxfamily.org/dox/classEigen_1_1SelfAdjointEigenSolver.html" rel="nofollow">https://eigen.tuxfamily.org/dox/classEigen_1_1SelfAdjointEigenSolver.html</a>) from what I understood it is possible to change the number of max iterations:</p>

<blockquote>
  <p>const int m_maxIterations
  static
  Maximum number of iterations.</p>
  
  <p>The algorithm terminates if it does not converge within m_maxIterations * n iterations, where n denotes the size of the matrix. This value is currently set to 30 (copied from LAPACK).</p>
</blockquote>

<p>However, I do not understand how do you implement this, using their examples:</p>

<pre><code>SelfAdjointEigenSolver&lt;Matrix4f&gt; es;
Matrix4f X = Matrix4f::Random(4,4);
Matrix4f A = X + X.transpose();
es.compute(A);
cout &lt;&lt; "The eigenvalues of A are: " &lt;&lt;   es.eigenvalues().transpose() &lt;&lt; endl;
es.compute(A + Matrix4f::Identity(4,4)); // re-use es to compute eigenvalues of A+I
cout &lt;&lt; "The eigenvalues of A+I are: " &lt;&lt; es.eigenvalues().transpose() &lt;&lt; endl
</code></pre>

<p>How would you modify it in order to change the maximum number of iterations?</p>

<p>Additionally, will this solve my problem or should I try to find an alternative function or algorithm to solve the eigensystem?</p>

<p>My thanks in advance.</p>