title: Implementing MATLAB's "/" operator aka. mrdivide in C++ Eigen Library
body: <p>I'm looking for a way to use the MATALB syntax <code>x = B / A;</code> in Eigen.</p>
  
  <p>I know that one can extend the Matrix class in Eigen by defining the <code>EIGEN_MATRIXBASE_PLUGIN</code> variable (see <a href="http://eigen.tuxfamily.org/dox/TopicCustomizingEigen.html" rel="nofollow">Eigen::Documentation</a>).</p>
  
  <p>And now my question is: How do I do this? And more important, how do I do this <strong>efficiently</strong>?</p>
  
  <p>Edit:
  As mentioned in the comments, I got this piece of code now:</p>
  
  <pre><code>const Matrix operator/ (const Matrix&amp; other) const
  {
      return ((other.transpose()).fullPivHouseholderQr().solve(this-&gt;transpose())).transpose();
  }
  </code></pre>
  
  <p>This works for <code>x = B / A;</code> if both varaibles are of the type <code>Eigen::Matrix</code>, but if I got something like <code>Eigen::Matrix / double</code> there is no matching operator anymore. Since this is not that easy to implement correctly in Eigen, I will put that on hold for now. </p>
  
  <p>Maybe someone with experience in extending Eigen classes can help with that...</p>