[mlpack-git] [mlpack/mlpack] Random projection trees (#726)

lozhnikov notifications at github.com
Fri Aug 5 10:52:16 EDT 2016


> +  ElemType length = metric::EuclideanDistance::Evaluate(origin, direction);
> +
> +  if (length > 0)
> +    direction /= length;
> +  else
> +  {
> +    // If the vector is equal to 0, choose an arbitrary dimension.
> +    size_t k = math::RandInt(direction.n_rows);
> +
> +    direction[k] = 1.0;
> +
> +    length = metric::EuclideanDistance::Evaluate(origin, direction);
> +
> +    direction[k] /= length;
> +  }
> +}

Yes, I agree, we can move that function to the core, but in that case we can not use `arma::norm`.

---
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/726/files/e14a26f3e209af0608cb61ecaa5e30f253e72e9b#r73705052
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20160805/78c4689f/attachment.html>


More information about the mlpack-git mailing list