<p>In <a href="https://github.com/mlpack/mlpack/pull/465#discussion_r43119655">src/mlpack/methods/sparse_autoencoder/maximal_inputs.cpp</a>:</p>
<pre style='color:#555'>&gt; +        reshapeMat /= max;
&gt; +      }
&gt; +      output.submat(i*(offset), j*(offset),
&gt; +                    i*(offset) + squareRows - 1,
&gt; +                    j*(offset) + squareRows - 1) = reshapeMat;
&gt; +      ++k;
&gt; +    }
&gt; +  }
&gt; +}
&gt; +
&gt; +}
&gt; +
&gt; +void MaximalInputs(arma::mat const &amp;parameters, arma::mat &amp;output)
&gt; +{
&gt; +  //take the encoder part of the paramters
&gt; +  arma::mat paramTemp = parameters.submat(0, 0, (parameters.n_rows-1)/2-1, parameters.n_cols-2);
</pre>
<p>If you did transpose the parameters, here would be the place to do it (just add <code>.t()</code> to the end of the expression).  I don't think it's reasonable to avoid a copy here, since you're subtracting the mean from <code>paramTemp</code>.</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/465/files#r43119655">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AJ4bFGSapWYdWjyMiubmegTRf1AhuV-vks5o_3JIgaJpZM4GWT_f.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/465/files#r43119655"></link>
  <meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>