<p>Thanks for the <code>lowest()</code> fix, I'm not sure how I misunderstood the documentation for that.</p>

<p>I tried running <code>mlpack_allknn</code> with your branch to test the speed but it segfaulted.  So I recompiled with debugging symbols, and ran it through valgrind, and saw this:</p>

<pre><code>==24731== Invalid read of size 8
==24731==    at 0x989CF8: bool mlpack::tree::XTreeSplit::SplitNonLeafNode&lt;mlpack::tree::RectangleTree&lt;mlpack::metric::LMetric&lt;2, true&gt;, mlpack::neighbor::NeighborSearchStat&lt;mlpack::neighbor::NearestNeighborSort&gt;, arma::Mat&lt;double&gt;, mlpack::tree::XTreeSplit, mlpack::tree::RStarTreeDescentHeuristic&gt; &gt;(mlpack::tree::RectangleTree&lt;mlpack::metric::LMetric&lt;2, true&gt;, mlpack::neighbor::NeighborSearchStat&lt;mlpack::neighbor::NearestNeighborSort&gt;, arma::Mat&lt;double&gt;, mlpack::tree::XTreeSplit, mlpack::tree::RStarTreeDescentHeuristic&gt;*, std::vector&lt;bool, std::allocator&lt;bool&gt; &gt;&amp;) (x_tree_split_impl.hpp:811)
(plus lots more output)
</code></pre>

<p>I haven't had a chance to look into it yet, and probably won't for a little while, unfortunately.</p>

<p>A last thought---adding the support for X trees to NSModel and RSModel and RAModel is great (thanks!) but we should add the X tree after the ball tree in order to preserve reverse compatibility.  Otherwise old models that were built with a ball tree will be loaded as an X tree (and the load will fail) because X_TREE will be equal to what BALL_TREE was in older versions.</p>

<p>I'm excited about merging this functionality in, so thanks for taking the time to look into this!  If you don't want to add your name that's fine, but personally I think your contribution is pretty substantial. Usually the level for inclusion in the credits is just "more than one line of code". :)</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">&mdash;<br>Reply to this email directly or <a href="https://github.com/mlpack/mlpack/pull/556#issuecomment-195091510">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AJ4bFCtcZrT0dHnIyPP-kSflcCh37fGoks5psKQqgaJpZM4HsSai.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/556#issuecomment-195091510"></link>
  <meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>