[mlpack] 51/149: 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).

Barak A. Pearlmutter barak+git at pearlmutter.net
Sat May 2 09:11:08 UTC 2015


This is an automated email from the git hooks/post-receive script.

bap pushed a commit to branch svn-trunk
in repository mlpack.

commit c1c5bd5887e6e5654d05498b52b295028b22d1d6
Author: rcurtin <rcurtin at 9d5b8971-822b-0410-80eb-d18c1038ef23>
Date:   Tue Oct 14 06:03:48 2014 +0000

    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).
    
    
    git-svn-id: http://svn.cc.gatech.edu/fastlab/mlpack/trunk@17259 9d5b8971-822b-0410-80eb-d18c1038ef23
---
 src/mlpack/methods/kmeans/kmeans_impl.hpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mlpack/methods/kmeans/kmeans_impl.hpp b/src/mlpack/methods/kmeans/kmeans_impl.hpp
index 7b8d9a3..317d0c4 100644
--- a/src/mlpack/methods/kmeans/kmeans_impl.hpp
+++ b/src/mlpack/methods/kmeans/kmeans_impl.hpp
@@ -174,7 +174,7 @@ Cluster(const MatType& data,
   // 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)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/mlpack.git



More information about the debian-science-commits mailing list