title: Expression must have constant value Eigen matrix
body: <p>I have been trying to give the matrix size while runtime via a function, for example</p>
  
  <pre><code>Eigen::MatrixXd FileReader::load_csv(const std::string &amp; path, const int rows_csv, const int columns_csv) {
      std::ifstream indata;
      indata.open(path);
      std::string line;
      std::vector&lt;double&gt; values;
      int rows = 0;
      while (getline(indata, line)) {
          std::stringstream lineStream(line);
          std::string cell;
          while (std::getline(lineStream, cell, ',')) {
              values.push_back(std::stod(cell));
          }
          ++rows;
      }
      std::cout &lt;&lt; "loading";
      return Eigen::Map&lt;const Eigen::Matrix&lt;double, columns_csv, rows_csv, Eigen::RowMajor&gt;&gt;(values.data(), rows, values.size() / rows);
  }
  </code></pre>
  
  <p>(Above code is from <a href="https://stackoverflow.com/a/39146048/3782963">https://stackoverflow.com/a/39146048/3782963</a>), I am not able to send a constant value of the matrix size to the function, I get <code>Expression must have constant value</code> error. Is there any way I could do something like this:</p>
  
  <pre><code>Eigen::MatrixXd mat = load_csv("some_path", 20, 30);
  </code></pre>
  
  <p>Any idea?</p>