[mlpack-git] [mlpack/mlpack] Vantage point tree (#708)

Ryan Curtin notifications at github.com
Thu Jul 21 19:36:02 EDT 2016


> +template<typename BoundType, typename MatType>
> +void VantagePointSplit<BoundType, MatType>::
> +SelectVantagePoint(const BoundType& bound, const MatType& data,
> +    const size_t begin, const size_t count, size_t& vantagePoint, ElemType& mu)
> +{
> +  arma::uvec vantagePointCandidates;
> +
> +  // Get no more than max(maxNumSamples, count) vantage point candidates
> +  GetDistinctSamples(vantagePointCandidates, maxNumSamples, begin, count);
> +
> +  ElemType bestSpread = 0;
> +
> +  //  Evaluate eache candidate
> +  for (size_t i = 0; i < vantagePointCandidates.n_rows; i++)
> +  {
> +    arma::uvec samples;

(I am not sure if compiler optimizations will take care of this.)  If you declare this outside the loop, then every time you call `GetDistinctSamples()`, memory won't need to be allocated.

---
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/708/files/300882ac96e7a663e3e303ca0c45c14c6fafe1a6#r71806503
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20160721/c7cf2c6f/attachment.html>


More information about the mlpack-git mailing list