<p>In <a href="https://github.com/mlpack/mlpack/pull/388#discussion_r23583975">src/mlpack/methods/mean_shift/mean_shift_impl.hpp</a>:</p>
<pre style='color:#555'>> +
> + }
> +
> + newCentroid /= sumWeight;
> +
> + completedIterations ++;
> +
> + // calc the mean shift vector.
> + arma::Col<double> mhVector = newCentroid - allCentroids.col(i);
> +
> + // update the centroid.
> + allCentroids.col(i) = newCentroid;
> +
> + if (arma::norm(mhVector, 2) < stopThresh ||
> + completedIterations > maxIterations) {
> + break;
</pre>
<p>This loop can be cleaner as a for loop instead of a <code>while(true)</code> where you manage <code>completedIterations</code> by hand.</p>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br>Reply to this email directly or <a href="https://github.com/mlpack/mlpack/pull/388/files#r23583975">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AJ4bFOVzImdUW7K5TPZjSKU5mOAzz-rDks5nlvOpgaJpZM4DTzb1.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/388/files#r23583975"></link>
<meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>