title: Fill dynamic vector using EIGEN library
body: <p>I have to fill a vector with values within a for loop using EIGEN. Im trying something like that...</p>
  
  <pre><code>#include &lt;iostream&gt; 
  #include &lt;Eigen/Dense&gt;
  using namespace std;
  using namespace Eigen;
  
  int main(){ 
    VectorXd s;
    for (int i=0,i&lt;10;i++){
       s(i) = (double) i;
    }
  return 0;
  }
  </code></pre>
  
  <p>i can compile it, but when i run the program i get this error:</p>
  
  <blockquote>
    <p>dynamic: /usr/include/Eigen/src/Core/DenseCoeffsBase.h:425: Eigen::DenseCoeffsBase::Scalar&amp; Eigen::DenseCoeffsBase::operator()(Eigen::Index) [with Derived = Eigen::Matrix; Eigen::DenseCoeffsBase::Scalar = double; Eigen::Index = int]: Assertion `index >= 0 &amp;&amp; index &lt; size()' failed.
    Abgebrochen</p>
  </blockquote>
  
  <p>I know that i can easily achieve that using the std::vector class, but i want to do it with eigen because i have to do a lot of matrix operations after that.</p>
  
  <p>Thank you!</p>
  
  <p>EDIT: for my application i don't know the size of the vector at compile time. I want to find out whether there is any similar method like <code>vector::push_back</code> in eigen.</p>