<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'>> + * double threshold = 0;
> + *
> + * // Binarize the whole Matrix. All positive values in will be set to 1 and
> + * // the values less than or equal to 0 will become 0.
> + * Binarize(input, threshold);
> + * @endcode
> + *
> + * @param input Input matrix to Binarize.
> + * @param threshold Threshold can by any number.
> + */
> +template<typename T>
> +void Binarize(arma::Mat<T>& input,
> + const double threshold)
> +{
> + for (size_t i = 0; i < input.n_rows; ++i)
> + 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;">—<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>