$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r50349 - in sandbox/cluster/boost/algorithm/cluster: . detail
From: franklin.jonathan_at_[hidden]
Date: 2008-12-21 18:48:19
Author: jfranklin
Date: 2008-12-21 18:48:18 EST (Sun, 21 Dec 2008)
New Revision: 50349
URL: http://svn.boost.org/trac/boost/changeset/50349
Log:
Fixed a bug I introduced my moving the k_means detail function into it's own header, and further tweaked the code prior to rewriting k_means.
Text files modified: 
   sandbox/cluster/boost/algorithm/cluster/detail/k_means.hpp |     6 ++++--                                  
   sandbox/cluster/boost/algorithm/cluster/dist_fun.hpp       |     6 +++---                                  
   sandbox/cluster/boost/algorithm/cluster/k_means.hpp        |     7 +++----                                 
   3 files changed, 10 insertions(+), 9 deletions(-)
Modified: sandbox/cluster/boost/algorithm/cluster/detail/k_means.hpp
==============================================================================
--- sandbox/cluster/boost/algorithm/cluster/detail/k_means.hpp	(original)
+++ sandbox/cluster/boost/algorithm/cluster/detail/k_means.hpp	2008-12-21 18:48:18 EST (Sun, 21 Dec 2008)
@@ -1,5 +1,7 @@
-#if ! defined(BOOST_ALGORITHM_CLUSTER_K_MEANS_HPP)
-#define BOOST_ALGORITHM_CLUSTER_K_MEANS_HPP
+#if ! defined(BOOST_ALGORITHM_CLUSTER_DETAIL_K_MEANS_HPP)
+#define BOOST_ALGORITHM_CLUSTER_DETAIL_K_MEANS_HPP
+
+#include <cfloat>
 
 namespace boost
 {
Modified: sandbox/cluster/boost/algorithm/cluster/dist_fun.hpp
==============================================================================
--- sandbox/cluster/boost/algorithm/cluster/dist_fun.hpp	(original)
+++ sandbox/cluster/boost/algorithm/cluster/dist_fun.hpp	2008-12-21 18:48:18 EST (Sun, 21 Dec 2008)
@@ -40,7 +40,7 @@
         boost::fusion::transform(t1, t2, std::minus<double>()), 
         boost::bind(std::multiplies<double>(), _1, _1)
       ), 
-      0,
+      0.,
       std::plus<double>()
     ) 
   );
@@ -58,7 +58,7 @@
       boost::fusion::fold
       ( 
         boost::fusion::transform(t1, t2, (_1 * _1)(_1 - _2)), 
-        0,
+        0.,
         _1 + _2
       )
     )
@@ -75,7 +75,7 @@
   return boost::fusion::fold
   (
     boost::fusion::transform(t1, t2, detail::abs_diff<double>()), 
-    0,
+    0.,
     _1 + _2
   );
 }
Modified: sandbox/cluster/boost/algorithm/cluster/k_means.hpp
==============================================================================
--- sandbox/cluster/boost/algorithm/cluster/k_means.hpp	(original)
+++ sandbox/cluster/boost/algorithm/cluster/k_means.hpp	2008-12-21 18:48:18 EST (Sun, 21 Dec 2008)
@@ -16,7 +16,6 @@
 
 #include <cassert>
 #include <cmath>
-#include <float.h>
 #include <list>
 #include <vector>
 
@@ -30,7 +29,7 @@
 template<typename PointType>
 struct KMeansCluster {
   PointType centroid;
-  std::vector<int> points; //The indice of points are stored here 
+  std::vector<int> points; // The indices of points are stored here.
 };
 
 template <typename KMeansCluster> 
@@ -71,9 +70,9 @@
   }
 
   int nIndex = 0;
-  for(NTupleIter iter = first; iter != last; iter++, nIndex++)
+  for(NTupleIter iter = first; iter != last; ++iter, ++nIndex)
   {
-    PointType& pt= *iter; //A point TODO: Make this const?
+    PointType const & pt(*iter); // The current point.
     ppData[nIndex] = new AttributeType[knDimension];
     for(unsigned int nAttribute = 0; nAttribute < knDimension; nAttribute++)
     {