title: How to reshape a matrix?
body: <p>I am currently trying to convert some Python code into C++.  One 'small' problem is changing the dimensions of a matrix. Is it possible to reshape a matrix in C++ similar to the Python <code>reshape</code> function?</p>
  
  <p>For example, in Python I can easily create an array with <code>numpy</code> and easily reshape the dimensions.</p>
  
  <pre><code>a = np.array([[1,2,3],[4,5,6]])
  &gt;&gt;&gt; a.reshape(3,2)
  array([[1, 2],
         [3, 4],
         [5, 6]])
  </code></pre>
  
  <p>How could I do this in C++? Perhaps this is a simple question but I am completely unable to do this.  I have seen this within OpenCV library with the <code>Mat</code> class <a href="http://docs.opencv.org/modules/core/doc/basic_structures.html#mat-reshape" rel="noreferrer">here</a> however it is proving to be insanely difficult to work properly with MinGW, not to mention a very large addition for a single function. It would be ideal if this was possible with 'base' functions.</p>