[mlpack-svn] r17259 - mlpack/trunk/src/mlpack/methods/kmeans

fastlab-svn at coffeetalk-1.cc.gatech.edu fastlab-svn at coffeetalk-1.cc.gatech.edu
Tue Oct 14 02:03:48 EDT 2014


Author: rcurtin
Date: Tue Oct 14 02:03:48 2014
New Revision: 17259

Log:
Fix a bug that meant that centroidsOther was copied only when it shouldn't have
been, and was never copied when it should have been (note the iteration++ at the
end of the loop).


Modified:
   mlpack/trunk/src/mlpack/methods/kmeans/kmeans_impl.hpp

Modified: mlpack/trunk/src/mlpack/methods/kmeans/kmeans_impl.hpp
==============================================================================
--- mlpack/trunk/src/mlpack/methods/kmeans/kmeans_impl.hpp	(original)
+++ mlpack/trunk/src/mlpack/methods/kmeans/kmeans_impl.hpp	Tue Oct 14 02:03:48 2014
@@ -174,7 +174,7 @@
   // If we ended on an even iteration, then the centroids are in the
   // centroidsOther matrix, and we need to steal its memory (steal_mem() avoids
   // a copy if possible).
-  if (iteration % 2 == 0)
+  if ((iteration - 1) % 2 == 0)
     centroids.steal_mem(centroidsOther);
 
   if (iteration != maxIterations)



More information about the mlpack-svn mailing list