<p>In <a href="https://github.com/mlpack/mlpack/pull/696#discussion_r67148615">src/mlpack/methods/edge_boxes/feature_extraction_impl.hpp</a>:</p>
<pre style='color:#555'>&gt; +
&gt; +template&lt;typename MatType, typename CubeType&gt;
&gt; +arma::vec StructuredForests&lt;MatType, CubeType&gt;::
&gt; +DistanceTransform1D(arma::vec const &amp;f, const size_t n, const double inf)
&gt; +{
&gt; +  arma::vec d(n), v(n), z(n + 1);
&gt; +  size_t k = 0;
&gt; +  v[0] = 0.0;
&gt; +  z[0] = -inf;
&gt; +  z[1] = inf;
&gt; +  for (size_t q = 1; q &lt;= n - 1; ++q)
&gt; +  {
&gt; +    float s  = ( (f[q] + q * q)-( f[v[k]] + v[k] * v[k]) ) / (2 * q - 2 * v[k]);
&gt; +    while (s &lt;= z[k])
&gt; +    {
&gt; +      --k;
</pre>
<p>I'm not sure, but if we set k = 0 at the beginning, how can we decrease k, and still get the right index?</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/696/files/b38b688edfc4c2ee8bf461240f8384a70575d3a4#r67148615">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe/AJ4bFDI7B9foVU45XP---vrpIWACqOsoks5qL-pegaJpZM4I1lnr">mute the thread</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AJ4bFB4eKut-njUnzCkvqF50iwAT-Ws_ks5qL-pegaJpZM4I1lnr.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/696/files/b38b688edfc4c2ee8bf461240f8384a70575d3a4#r67148615"></link>
  <meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>