<p>In <a href="https://github.com/mlpack/mlpack/pull/708#discussion_r71806503">src/mlpack/core/tree/vantage_point_tree/vantage_point_split_impl.hpp</a>:</p>
<pre style='color:#555'>> +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;
</pre>
<p>(I am not sure if compiler optimizations will take care of this.) If you declare this outside the loop, then every time you call <code>GetDistinctSamples()</code>, memory won't need to be allocated.</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/708/files/300882ac96e7a663e3e303ca0c45c14c6fafe1a6#r71806503">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AJ4bFDr78f-yc4zwGo0Wa8k0hiB3iCATks5qYAJigaJpZM4I_COp">mute the thread</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AJ4bFEdGunsOGWmFfg9Ry2T1hNvqDU19ks5qYAJigaJpZM4I_COp.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/708/files/300882ac96e7a663e3e303ca0c45c14c6fafe1a6#r71806503"></link>
<meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>