title: Handling large matrices in C++
body: <p>I am using large matrices of <code>double</code>s in C++. I need to get rows or columns from these matrices and pass them to a function. What is the fastest way I can do this?</p>
  
  <ol>
  <li>One way is to write a function that returns a copy of the desired row or column as an <code>std::vector</code>. </li>
  <li>Another way is to pass the whole thing as a reference and modify the function to be able to read the desired values.</li>
  </ol>
  
  <p>Are there any other options? Which one do you recommend?</p>
  
  <p>BTW, how do you recommend I store the data in the matrix class? I am using <code>std::vector&lt; std::vector&lt; double &gt; &gt;</code> right now.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I mus have mentioned that the matrices might have more that two dimensions. So using boost or <code>arma::mat</code> here is out of the question. Although, I am using armadillo in other parts of the library.</p>