<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'>&gt; +        
&gt; +      }
&gt; +      
&gt; +      newCentroid /= sumWeight;
&gt; +      
&gt; +      completedIterations ++;
&gt; +      
&gt; +      // calc the mean shift vector.
&gt; +      arma::Col&lt;double&gt; mhVector = newCentroid - allCentroids.col(i);
&gt; +      
&gt; +      // update the centroid.
&gt; +      allCentroids.col(i) = newCentroid;
&gt; +      
&gt; +      if (arma::norm(mhVector, 2) &lt; stopThresh ||
&gt; +          completedIterations &gt; maxIterations) {
&gt; +        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;">&mdash;<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>