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

Ryan Curtin notifications at github.com
Fri Aug 5 10:37:04 EDT 2016


> +  }
> +}
> +
> +template<typename BoundType, typename MatType>
> +bool RPTreeMeanSplit<BoundType, MatType>::GetDotMedian(
> +    const MatType& data,
> +    const arma::uvec& samples,
> +    const arma::Col<ElemType>& direction,
> +    ElemType& splitVal)
> +{
> +  std::vector<ElemType> values(samples.n_elem);
> +
> +  for (size_t k = 0; k < samples.n_elem; k++)
> +    values[k] = arma::dot(data.col(samples[k]), direction);
> +
> +  std::sort(values.begin(), values.end());

It might be better to use Armadillo objects here, since you know how many elements you'll have.  Armadillo does have a `sort` function too.

---
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#r73702548
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20160805/f5d7ce1c/attachment.html>


More information about the mlpack-git mailing list