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

MarcosPividori notifications at github.com
Mon Jul 25 10:18:01 EDT 2016


> +  {
> +    //! Value of this recommendation.
> +    double value;
> +    //! Item of this recommendation.
> +    size_t item;
> +    //! Trivial constructor.
> +    Candidate(double value, size_t item) :
> +        value(value),
> +        item(item)
> +    {};
> +    //! Compare the value of two candidates.
> +    friend bool operator>(const Candidate& l, const Candidate& r)
> +    {
> +      return l.value > r.value;
> +    };
> +  };

@rcurtin I think you see a difference in runtime between std::pair and SortStruct in: #712  , because you use a pointer to function comparison parameter instead of a functor or an operator, as I can see in: https://github.com/mlpack/mlpack/pull/721/commits/640f3a7859ea8d400bc6fed6b4395c2291ba0259#diff-3a0c62f44f497b9857aed01fe81dc391L54
I have read some documentation that says that functors can be inlined while pointer to function generally are not.
For Candidate struct, I define an operator, that probably will be inlined by the compiler.

---
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/57dd61f1d823f209c8d0f67fa69f8a8ae0669d18#r72071029
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20160725/6cf9c6d7/attachment.html>


More information about the mlpack-git mailing list