<p>Hey Evan,</p>

<p>Sorry for the slow response.  Things have been busy and I haven't had a chance to look further into this until now.</p>

<p>I wonder, should we even be including an <code>Evaluate()</code> and a <code>Gradient()</code> function in these constraint types?  Or instead should we simply be allowing access to the A matrix (however it should be represented) and the b vector, and allow the optimizers to do what they need with those?  (This is closer to how the current code works, but the current code has a lot of template specializations that I'd love to do away with, favoring just one non-specialized implementation instead.)</p>

<p>This is simple for the sparse and dense constraints, which can just return A as types <code>arma::sp_mat</code> and <code>arma::mat</code>, respectively, but the linear constraint is a bit harder because we want to represent A as (aa').  We could possibly use the Armadillo type that represents two vectors to be multiplied for this... it'd look something like <code>arma::glue&lt;arma::Col&lt;eT&gt;, arma::Col&lt;eT&gt;, arma::op_multiply&gt;</code>.  If we return that type for the A matrix and then use that in a larger Armadillo expression, I think we can reasonably expect that the template metaprogramming that evaluates Armadillo expressions will do a decent job.</p>

<p>Is what I'm saying making any sense?  Please let me know if not.  It has been a while since I have thought about SDPs.  My concern though is that ideally we don't want to include to much optimizer-specific logic in the constraints, and it seems like in this case that's what's happening with <code>EvaluateLR()</code> and <code>GradientLR()</code>; if we were to come up with another technique for solving SDPs, like for instance with block diagonal representations instead of low-rank, we would probably need an <code>EvaluateBlockDiagonal()</code> and <code>GradientBlockDiagonal()</code> in each constraint, which I'd like to avoid.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">&mdash;<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly or <a href="https://github.com/mlpack/mlpack/pull/580#issuecomment-200369662">view it on GitHub</a><img alt="" height="1" src="https://github.com/notifications/beacon/AJ4bFFGyknD1SDT_cTsWJYFMbIBzlK9iks5pwU8wgaJpZM4Hyp0C.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/mlpack/mlpack/pull/580#issuecomment-200369662"></link>
  <meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>