<p>In <a href="https://github.com/mlpack/mlpack/pull/457#discussion_r40664352">src/mlpack/methods/softmax_regression/softmax_regression_function.hpp</a>:</p>
<pre style='color:#555'>&gt; @@ -38,12 +37,25 @@ class SoftmaxRegressionFunction
&gt;    const arma::mat InitializeWeights();
&gt;  
&gt;    /**
&gt; +   * Initialize Softmax Regression weights(trainable parameters) with
&gt; +   * the given parameters.
&gt; +   * @param featureSize The features size of the training set
&gt; +   * @param numClasses Number of classes for classification.
&gt; +   * @param fitIntercept Intercept term flag.
&gt; +   * @return weights after initialize
&gt; +   */
&gt; +  static const arma::mat InitializeWeights(const size_t featureSize,
&gt; +                                           const size_t numClasses,
&gt; +                                           const bool fitIntercept = false);
</pre>
<p>My only suggestion here might be to take the return value as a parameter (i.e. <code>arma::mat&amp; weights</code>).  RVO might successfully optimize out the copy in some cases, but I'm not sure that every compiler will do RVO correctly in this case.</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/457/files#r40664352">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AJ4bFNIjlJHSo14ymYHHkBhhUx5OkW3eks5o2nsrgaJpZM4GFbCy.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/457/files#r40664352"></link>
  <meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>