[mlpack-git] [mlpack/mlpack] Heaps for mlpack! (#732)

Ryan Curtin notifications at github.com
Tue Jul 26 14:10:02 EDT 2016


> +
> +template<typename KernelType, typename TreeType>
> +void FastMKSRules<KernelType, TreeType>::GetResults(
> +    arma::Mat<size_t>& indices,
> +    arma::mat& products)
> +{
> +  indices.set_size(k, querySet.n_cols);
> +  products.set_size(k, querySet.n_cols);
> +
> +  for (size_t i = 0; i < querySet.n_cols; i++)
> +  {
> +    CandidateList& pqueue = candidates[i];
> +    typedef typename CandidateList::iterator Iterator;
> +
> +    for (Iterator end = pqueue.end(); end != pqueue.begin(); --end)
> +      std::pop_heap(pqueue.begin(), end, CandidateCmp());

Would it be better to use `sort_heap()` here, since we don't need the heap properties anymore?

---
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/732/files/b93ee86eafb123e29830edd1876c794dc41c7878#r72305336
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20160726/a3279d99/attachment.html>


More information about the mlpack-git mailing list