<p>In <a href="https://github.com/mlpack/mlpack/pull/708#discussion_r71899590">src/mlpack/core/tree/vantage_point_tree/dual_tree_traverser_impl.hpp</a>:</p>
<pre style='color:#555'>&gt; +        if (rightScore != DBL_MAX)
&gt; +        {
&gt; +          // Restore the right traversal info.
&gt; +          rule.TraversalInfo() = traversalInfo;
&gt; +          Traverse(queryNode, *referenceNode.Right());
&gt; +        }
&gt; +        else
&gt; +          ++numPrunes;
&gt; +      }
&gt; +    }
&gt; +  }
&gt; +  else
&gt; +  {
&gt; +    // If the reference node contains a point we should calculate all
&gt; +    // base cases with this point.
&gt; +    if (referenceNode.IsFirstPointCentroid())
</pre>
<p>I agree that this is inefficient.  I think that the better solution is to do this: during recursion, for all query points in a node, perform a base case with all parent vantage points.  Something like this:</p>

<pre><code>for (size_t i = 0; i &lt; queryNode.NumPoints(); ++i)
{
  TreeType* p = referenceNode.Parent();
  do
  {
    if (p-&gt;NumPoints() &gt; 0) // We are holding a vantage point.
      BaseCase(queryNode.Point(i), p-&gt;Point(0)); // p-&gt;NumPoints() should never be greater than 1.
  } while ((p = p-&gt;Parent()) != NULL);
}
</code></pre>

<p>That would have to come after the base case section but before any recursions, so I guess up by line 50 or so would be the right place.</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/708/files/300882ac96e7a663e3e303ca0c45c14c6fafe1a6#r71899590">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AJ4bFPqc_O_UP1OW1tfZXRWQMfKSP13yks5qYOSegaJpZM4I_COp">mute the thread</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AJ4bFORFFhTYaSda9-MdeVXsd8WvxZaMks5qYOSegaJpZM4I_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#r71899590"></link>
  <meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>