<p>In <a href="https://github.com/mlpack/mlpack/pull/703#discussion_r68494923">src/mlpack/methods/edge_boxes/feature_extraction_impl.hpp</a>:</p>
<pre style='color:#555'>&gt; +// also stores the locations of max values in Location
&gt; +template&lt;typename MatType, typename CubeType&gt;
&gt; +void StructuredForests&lt;MatType, CubeType&gt;::
&gt; +MaxAndLoc(CubeType&amp; mag, arma::umat&amp; Location, MatType&amp; MaxVal) const
&gt; +{
&gt; +  /*Vectorize this function after prototype works*/
&gt; +  MaxVal = MatType(Location.n_rows, Location.n_cols);
&gt; +  for(size_t i = 0; i &lt; mag.n_rows; ++i)
&gt; +  {
&gt; +    for(size_t j = 0; j &lt; mag.n_cols; ++j)
&gt; +    {
&gt; +      /*can use -infinity here*/
&gt; +      double max =  std::numeric_limits&lt;double&gt;::min();
&gt; +      for(size_t k = 0; k &lt; mag.n_slices; ++k)
&gt; +      {
&gt; +        if(mag(i, j, k) &gt; max)
</pre>
<p>I figured out why it doesn't work on my machine. The check: </p>

<p><code>if(mag(i, j, k) &gt; max)</code></p>

<p>doesn't work if mag is [0 0 0] because 0 &lt; double max =  std::numeric_limits::min();.  Since the the location is undefined, we could probably run into an index out of bounds error.</p>

<p>As pointed out here: <a href="https://github.com/mlpack/mlpack/pull/696#discussion_r67073948" class="issue-link js-issue-link" data-url="https://github.com/mlpack/mlpack/issues/696" data-id="160243740" data-error-text="Failed to load issue title" data-permission-text="Issue title is private">#696 (comment)</a> we should use -DBL_MAX or just use the first value of mag as starting point.</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/703/files/987f0790f745314a2117a87f28a346b05a8a2a2d#r68494923">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe/AJ4bFK9I6-1Nf1MaIHnPb4oa8jvJ4A8wks5qPa75gaJpZM4I5X__">mute the thread</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AJ4bFCB_g3U7mGxAY1XEirfoyEePlITCks5qPa75gaJpZM4I5X__.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/703/files/987f0790f745314a2117a87f28a346b05a8a2a2d#r68494923"></link>
  <meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>