<p>In <a href="https://github.com/mlpack/mlpack/pull/391#discussion_r23540093">src/mlpack/core/optimizers/sdp/lrsdp_function_impl.hpp</a>:</p>
<pre style='color:#555'>&gt; @@ -189,5 +187,40 @@ void AugLagrangianFunction&lt;LRSDPFunction&gt;::Gradient(
&gt;    gradient = 2 * s * coordinates;
&gt;  }
&gt;  
&gt; +// Template specializations for function and gradient evaluation.
&gt; +// Note that C++ does not allow partial specialization of class members,
&gt; +// so we have to go about this in a somewhat round-about way.
&gt; +template &lt;&gt;
&gt; +inline double AugLagrangianFunction&lt;LRSDPFunction&lt;SDP&lt;arma::sp_mat&gt;&gt;&gt;::Evaluate(
&gt; +    const arma::mat&amp; coordinates) const
&gt; +{
&gt; +  return EvaluateImpl(function, coordinates, lambda, sigma);
&gt; +}
</pre>
<p>I'm thinking SFINAE may be a better approach here... (I haven't tested the code below.  I think it will look something like this.)</p>

<pre><code>template&lt;typename MatType&gt;
inline double AugLagrangianFunction&lt;LRSDPFunction&lt;SDP&lt;MatType&gt;&gt;&gt;::Evaluate(
    const arma::mat&amp; coordinates,
    const boost::enable_if&lt;IsMatType&lt;MatType&gt;::result&gt;::result* = 0)
{
  // no more need for EvaluateImpl().
}
</code></pre>

<p><code>IsMatType&lt;T&gt;</code> can be defined to be some struct where <code>result</code> is true if <code>T = mat</code> or <code>T = sp_mat</code>.  Take a look at Armadillo's <code>traits.hpp</code> file.  What do you think?</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">&mdash;<br>Reply to this email directly or <a href="https://github.com/mlpack/mlpack/pull/391/files#r23540093">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AJ4bFByv00tNWtNvBe35r7MVDKVpudMKks5nllvagaJpZM4DVljE.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/391/files#r23540093"></link>
    <meta itemprop="name" content="View Pull Request"></meta>
  </div>
  <meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>