<p>In <a href="https://github.com/mlpack/mlpack/pull/699#discussion_r69016507">src/mlpack/core/tree/rectangle_tree/minimal_coverage_sweep_impl.hpp</a>:</p>
<pre style='color:#555'>&gt; +      if (node-&gt;Dataset().col(node-&gt;Point(sorted[i].n))[k] &gt; highBound2[k])
&gt; +        highBound2[k] = node-&gt;Dataset().col(node-&gt;Point(sorted[i].n))[k];
&gt; +    }
&gt; +  }
&gt; +
&gt; +  // Evaluate the cost of the split i.e. calculate the total coverage
&gt; +  // of two resulting nodes.
&gt; +
&gt; +  ElemType area1 = 1.0, area2 = 1.0;
&gt; +  ElemType overlappedArea = 1.0;
&gt; +
&gt; +  for (size_t k = 0; k &lt; node-&gt;Bound().Dim(); k++)
&gt; +  {
&gt; +    area1 *= highBound1[k] - lowerBound1[k];
&gt; +    area2 *= highBound2[k] - lowerBound2[k];
&gt; +  }
</pre>
<p>I think this function could be simplified a lot if you used the native <code>HRectBound</code> functions.  Like instead of creating <code>lowerBound1</code>, <code>lowerBound2</code>, <code>highBound1</code>, and <code>highBound2</code> as <code>std::vector&lt;ElemType&gt;</code>s, you could just create <code>bound1</code> and <code>bound2</code> as <code>HRectBound&lt;MetricType, ElemType&gt;</code> and then use <code>operator|=()</code> to expand the bounds as necessary, then <code>Volume()</code> to calculate the last bit.</p>

<p>Also it seems like <code>overlappedArea</code> is not used here or calculated, so maybe that is wrong, or maybe it just needs to be removed.  I thought that in the R+ and R++ tree, nodes could not overlap, so I am not sure why <code>overlappedArea</code> is not 0 for both leaf nodes and non-leaf nodes.</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/699/files/e165d759f9ae612b9965f70fbbf8abdb19dc8d07#r69016507">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe/AJ4bFIcMiimnAmwnAl8Q8moM71dd1GI-ks5qQs8OgaJpZM4I3ATw">mute the thread</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AJ4bFFSDejGm2cfYIMTpalMyG1WxJz_eks5qQs8OgaJpZM4I3ATw.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/699/files/e165d759f9ae612b9965f70fbbf8abdb19dc8d07#r69016507"></link>
  <meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>