title: Eigenvalue decomposition fails with armadillo eigs_sym() for too large matrices
body: <p>I have recently installed armadillo and tried eigenvalue problem for sparse matrices. Unfortunately, decomposition fails is the parameter 'N' (code below) is too large e.q. 1000. I wonder what is going on here. Matrix is not very complicated - it has diagonal structure. </p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Mathematica also have problems with this matrix. It tells me that Arnoldi algorithm does not converge. Maybe I need to manually specify some parameters in arnoldi arpack routines to ensure convergence?</p>
  
  <p>Here is my code:</p>
  
  <pre><code>#include &lt;armadillo&gt;
  
  int main ()
  {
      double N = 1000.0;
  
      // create matrix
      int kmin = 0;
      int kmax = static_cast&lt;int&gt;( std::floor( N/2.0 ) );
      int dim = (kmax - kmin) + 1;
  
      // locations and values in sparse matrices
      arma::umat hc_locations (2, 3*dim-2);
      arma::vec hc_values (3*dim-2);
  
      // diagonal part
      for (int k=0; k&lt;dim; k++)
      {
          hc_locations (0,k) = k;
          hc_locations (1,k) = k;
          hc_values (k) = 2.0/N*static_cast&lt;double&gt;(kmin + k)*( 2.0*( N-2.0*static_cast&lt;double&gt;(k + kmin) ) - 1.0 );
  
      }
      // upper and lower diagonal
      for (int k=0; k&lt;dim-1; k++)
      {
          hc_locations (0,k+dim) = k;
          hc_locations (1,k+dim) = k+1;
          hc_values (k+dim) = 2.0/N*std::sqrt( ( static_cast&lt;double&gt;(k+1+kmin) ) *
                                               ( static_cast&lt;double&gt;(k+1+kmin) ) *
                                               ( N - static_cast&lt;double&gt;(2*(k+1+kmin)) + 1.0 ) * 
                                               ( N - static_cast&lt;double&gt;(2*(k+1+kmin)) + 2.0 ) );
  
          hc_locations (0, k+2*dim-1) = k+1;
          hc_locations (1, k+2*dim-1) = k;
          hc_values (k+2*dim-1) = 2.0/N*std::sqrt ( ( static_cast&lt;double&gt;(k+1+kmin) ) * 
                                                     ( static_cast&lt;double&gt;(k+1+kmin) ) *
                                                     ( N - static_cast&lt;double&gt;(2*(k+kmin)) ) *
                                                     ( N - static_cast&lt;double&gt;(2*(k+kmin)) - 1.0 ) );
      }
  
      arma::sp_mat Ham(hc_locations, hc_values);
  
      // eigenvalue problem
      arma::vec eigval;
      arma::mat eigvec;
  
      arma::eigs_sym( eigval, eigvec, Ham, 3, "sa"); 
  </code></pre>
  
  <p>}</p>