title: Error Eigen library on linux
body: <p>I have implemented this code with Eigen library to have Triplet structure. 
  This code works very well in my project on my Mac OS X. However the same code don't work on Linux platform.</p>
  
  <pre><code> Eigen::SparseMatrix&lt;double&gt; spdiags(const MatrixXd&amp; B, const     
        Eigen::Matrix&lt;int, 1,1&gt;&amp; d, size_t m, size_t n)
   {
            Eigen::SparseMatrix&lt;double&gt; A(m,n);
            typedef Eigen::Triplet&lt;double&gt; T;
            std::vector&lt;T&gt; triplets;
            triplets.reserve(std::min(m,n)*d.size());   
            for (int k = 0; k &lt; d.size(); k++) 
            {
              int i_min = std::max(0, -d(k));
              int i_max = std::min(m - 1, n - d(k) - 1);
              int B_idx_start = m &gt;= n ? d(k) : 0;
              for (int i = i_min; i &lt;= i_max; i++) {
              triplets.push_back( T(i, i+k, B(B_idx_start + i, k)) );
            }
         A.setFromTriplets(triplets.begin(), triplets.end());
  
        std::cout &lt;&lt; "Row\tCol\tVal" &lt;&lt;std::endl;
        for (int k=0; k &lt; A.outerSize(); ++k)
        {
            for (SparseMatrix&lt;double&gt;::InnerIterator it(A,k); it; ++it)
            {
                std::cout &lt;&lt; it.row() &lt;&lt; "\t"; // row index
                std::cout &lt;&lt; it.col() &lt;&lt; "\t";  
                std::cout &lt;&lt; it.value() &lt;&lt; std::endl;
            }
        }
  
       return A;
  
      }
  </code></pre>
  
  <p>I have this error only on Linux (there is no error on Mac). The code source of the file <code>DenseCoeffsBase.h</code> is the same:</p>
  
  <pre><code>"/usr/local/include/Eigen/src/Core/DenseCoeffsBase.h:114: 
  Eigen::DenseCoeffsBase&lt;Derived, 0&gt;::CoeffReturnType 
  Eigen::DenseCoeffsBase&lt;Derived, 0&gt;::operator() 
      (Eigen::DenseCoeffsBase&lt;Derived, 0&gt;::Index, 
       Eigen::DenseCoeffsBase&lt;Derived, 0&gt;::Index) const 
  [with Derived = Eigen::Matrix&lt;double, -1, -1&gt;; 
        Eigen::DenseCoeffsBase&lt;Derived, 0&gt;::CoeffReturnType = const double&amp;; 
        Eigen::DenseCoeffsBase&lt;Derived, 0&gt;::Index = long int]:
  Assertion `row &gt;= 0 &amp;&amp; row &lt; rows() &amp;&amp; col &gt;= 0 &amp;&amp; col &lt; cols()' failed."
  </code></pre>
  
  <p>Any ideas?</p>
  
  <p>Here is an MVC as asked : </p>
  
  <pre><code>#include&lt;Eigen/Sparse&gt;
  
  #include &lt;Eigen/Sparse&gt;
  
  #include&lt;Eigen/Dense&gt;
  #include&lt;Eigen/Eigenvalues&gt;
  
      Matrix&lt;int, 1, 1&gt; d1; d1(0)=0;
      MatrixXd d0; d0.resize(1,5);
  
      d0(0)=10;d0(1)=20;d0(2)=30;d0(3)=30;d0(4)=40;d0(5)=50;
  
      Eigen::SparseMatrix&lt;double&gt; Diag_laplacian=test.spdiags(d0,d1,5,5);
  
      //-------------- 
      //the result must be like this : 
      Row Col Val
      0   0   10
      1   1   20
      2   2   30
      3   3   30  
      4   4   40
  </code></pre>