<p>In <a href="https://github.com/mlpack/mlpack/pull/657#discussion_r65107943">src/mlpack/methods/lsh/lsh_search_impl.hpp</a>:</p>
<pre style='color:#555'>&gt; +  Ao.push_back(0); // initial perturbation holds smallest score (0 if sorted)
&gt; +
&gt; +  std::vector&lt; std::vector&lt;size_t&gt; &gt; perturbationSets;
&gt; +  perturbationSets.push_back(Ao); //storage of perturbation sets
&gt; +
&gt; +  //define a priority queue with CompareGreater as a minheap
&gt; +  std::priority_queue&lt;
&gt; +    std::pair&lt;double, size_t&gt;,        //contents: pairs of (score, index)
&gt; +    std::vector&lt;                      //container: vector of pairs
&gt; +      std::pair&lt;double, size_t&gt;
&gt; +      &gt;,
&gt; +    mlpack::neighbor::CompareGreater  //comparator of pairs (compares scores)
&gt; +  &gt; minHeap; //our minheap
&gt; +
&gt; +  //Start by adding the lowest scoring set to the minheap
&gt; +  std::pair&lt;double, size_t&gt; pair0( perturbationScore(Ao, scores), 0 );
</pre>
<p>priority_queue is a min-heap and the default comparator is defined for pair, so if you just invert your scores here so you want the min instead of the max I think it will allow you to remove a lot of code, including the custom comparator.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">&mdash;<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/657/files/2eb6163c90e8e19566784cf960d38d82691221e1#r65107943">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe/AJ4bFM_9WmeXg1JbOyMDV4g0PL0dJfEpks5qG12fgaJpZM4IpUVp">mute the thread</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AJ4bFJTTMylAFRngKw4TNLZCltX54kURks5qG12fgaJpZM4IpUVp.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/657/files/2eb6163c90e8e19566784cf960d38d82691221e1#r65107943"></link>
  <meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>