title: Eigen: Divide each row by last row
body: <p>I can't quite figure out the syntax for this when using Eigen's <code>rowwise</code> operations...</p>
  
  <p>I have an Eigen matrix, and I want to divide each row by the last row. So if we started with a matrix </p>
  
  <pre><code>r = [ 0, 1
        2, 3 
        4, 5 ]
  </code></pre>
  
  <p>then after this transform, I want to have </p>
  
  <pre><code>r = [  0, .2
        .5, .6
         1,  1 ]
  </code></pre>
  
  <p>Preferably the operation would happen in place, overwriting <code>r</code>. Furthermore, I will not be using the values in the last row, so it doesn't matter if the last row is actually 1's after the transform. </p>
  
  <p>Here are some syntaxes I have tried that do not compile:</p>
  
  <pre><code>r.rowwise() = (r.array().rowwise() / r.bottomRows(1).array()).eval();
  r.rowwise() = (r.rowwise().array() / r.bottomRows(1).array()).eval();
  r.rowwise() /= r.bottomRows(1).array();
  r = r.rowwise().cwiseQuotient(rrr);
  </code></pre>
  
  <p>This plain old for-loop version works</p>
  
  <pre><code>int last_row = r.rows() - 1;
  for (int row = 0; row &lt; last_row; ++row) {
      r.row(row).array() /= r.row(last_row).array();
  }
  </code></pre>
  
  <p>However, everywhere I turn, people are advocating using the <code>rowwise</code> or <code>colwise</code> operations. I can't get this to work with that syntax. Is there a nice concise form of what I want to do using the <code>rowwise</code> operator? </p>