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

MarcosPividori notifications at github.com
Tue Jul 26 15:36:13 EDT 2016


> +  //! Candidate represents a possible candidate point (value, index).
> +  typedef std::pair<double, size_t> Candidate;
> +
> +  //! Compare two candidates based on the value.
> +  struct CandidateCmp {
> +    bool operator()(const Candidate& c1, const Candidate& c2)
> +    {
> +      return c1.first > c2.first;
> +    };
> +  };
> +
> +  //! Use a min heap to represent the list of candidate points.
> +  //! We will use a vector and the std functions: push_heap() pop_heap().
> +  //! We can not use a priority queue because we need to iterate over all the
> +  //! candidates and std::priority_queue doesn't provide that interface.
> +  typedef std::vector<Candidate> CandidateList;

@rcurtin Yes, I agree!  When updating fastmks's code, I searched in the documentation for a iterable priority queue and I didn't realize boost::heap::priority_queue provides that interface. I have updated the code in https://github.com/mlpack/mlpack/pull/732/commits/8e1fbf0f413d9cae3a9d88b275afe6d20def2fca
Thanks!

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


More information about the mlpack-git mailing list