<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'>> +// also stores the locations of max values in Location
> +template<typename MatType, typename CubeType>
> +void StructuredForests<MatType, CubeType>::
> +MaxAndLoc(CubeType& mag, arma::umat& Location, MatType& MaxVal) const
> +{
> + /*Vectorize this function after prototype works*/
> + MaxVal = MatType(Location.n_rows, Location.n_cols);
> + for(size_t i = 0; i < mag.n_rows; ++i)
> + {
> + for(size_t j = 0; j < mag.n_cols; ++j)
> + {
> + /*can use -infinity here*/
> + double max = std::numeric_limits<double>::min();
> + for(size_t k = 0; k < mag.n_slices; ++k)
> + {
> + if(mag(i, j, k) > max)
</pre>
<p>I figured out why it doesn't work on my machine. The check: </p>
<p><code>if(mag(i, j, k) > max)</code></p>
<p>doesn't work if mag is [0 0 0] because 0 < 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;">—<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>