[mlpack-git] [mlpack/mlpack] Binarize Function + Test (#666)

Ryan Curtin notifications at github.com
Fri Jun 3 09:51:16 EDT 2016


> + * 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);

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().

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/mlpack/mlpack/pull/666/files/095842f1517c0200eaffa51ccdf05cbf28cff2dc#r65709908
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20160603/69c85a1d/attachment.html>


More information about the mlpack-git mailing list