<p>In <a href="https://github.com/mlpack/mlpack/pull/666#discussion_r65709908">src/mlpack/core/data/binarize.hpp</a>:</p>
<pre style='color:#555'>&gt; + * double threshold = 0;
&gt; + *
&gt; + * // Binarize the whole Matrix. All positive values in will be set to 1 and
&gt; + * // the values less than or equal to 0 will become 0.
&gt; + * Binarize(input, threshold);
&gt; + * @endcode
&gt; + *
&gt; + * @param input Input matrix to Binarize.
&gt; + * @param threshold Threshold can by any number.
&gt; + */
&gt; +template&lt;typename T&gt;
&gt; +void Binarize(arma::Mat&lt;T&gt;&amp; input,
&gt; +              const double threshold)
&gt; +{
&gt; +  for (size_t i = 0; i &lt; input.n_rows; ++i)
&gt; +    Binarize(input, threshold, i);
</pre>
<p>Armadillo matrices are column-major, but this calculation accesses the matrix in a row-major way. So it would be faster to just loop over all elements in the matrix instead of calling the other overload of Binarize().</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, <a href="https://github.com/mlpack/mlpack/pull/666/files/095842f1517c0200eaffa51ccdf05cbf28cff2dc#r65709908">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe/AJ4bFCs4TdQHWVqzfNHv04tSDG6ld-BJks5qIDFUgaJpZM4IsxhK">mute the thread</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AJ4bFBCIv6xkVGO1fcy9wwuTLRBN6MFmks5qIDFUgaJpZM4IsxhK.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/666/files/095842f1517c0200eaffa51ccdf05cbf28cff2dc#r65709908"></link>
  <meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>