Boost logo

Boost-Commit :

From: franklin.jonathan_at_[hidden]
Date: 2008-05-08 18:36:20


Author: jfranklin
Date: 2008-05-08 18:36:19 EDT (Thu, 08 May 2008)
New Revision: 45235
URL: http://svn.boost.org/trac/boost/changeset/45235

Log:
Fixed bug w/ eps data type.
Added size() to cluster_data.

Text files modified:
   sandbox/boost/algorithm/cluster/cluster_data.hpp | 1 +
   sandbox/boost/algorithm/cluster/dbscan.hpp | 8 ++++++--
   sandbox/boost/algorithm/cluster/detail/naive_query.hpp | 4 ++--
   3 files changed, 9 insertions(+), 4 deletions(-)

Modified: sandbox/boost/algorithm/cluster/cluster_data.hpp
==============================================================================
--- sandbox/boost/algorithm/cluster/cluster_data.hpp (original)
+++ sandbox/boost/algorithm/cluster/cluster_data.hpp 2008-05-08 18:36:19 EDT (Thu, 08 May 2008)
@@ -52,6 +52,7 @@
   value_type & back() { return m_pClusters->back(); }
   value_type const & back() const { return m_pClusters->back(); }
 
+ size_t size() const { return m_pClusters->size(); }
 private:
   boost::shared_ptr<clusters> m_pClusters;
 };

Modified: sandbox/boost/algorithm/cluster/dbscan.hpp
==============================================================================
--- sandbox/boost/algorithm/cluster/dbscan.hpp (original)
+++ sandbox/boost/algorithm/cluster/dbscan.hpp 2008-05-08 18:36:19 EDT (Thu, 08 May 2008)
@@ -9,6 +9,7 @@
 #include <boost/algorithm/cluster/cluster_data.hpp>
 #include <boost/algorithm/cluster/concept.hpp>
 #include <boost/algorithm/cluster/detail/naive_query.hpp>
+#include <boost/utility/result_of.hpp>
 #include <vector>
 
 namespace boost
@@ -45,11 +46,12 @@
  * \param[in] d
  * \return The cluster data (partitioning of the tuples).
  */
-template<typename ClusterT, typename NTupleIterT, typename DistFunT>
+template<typename ClusterT, typename NTupleIterT,
+ typename DistanceT, typename DistFunT>
 cluster_data<ClusterT>
 dbscan(NTupleIterT const & begin,
        NTupleIterT const & end,
- typename NTupleIterT::difference_type const & eps,
+ DistanceT const & eps,
        size_t min_points,
        DistFunT const & d)
 {
@@ -57,6 +59,8 @@
   function_requires<
     DistanceComparableConcept<typename NTupleIterT::value_type, DistFunT> >();
     //DistanceComparableConcept<int, DistFunT> >();
+ function_requires<
+ DistanceComparableConcept<DistanceT, DistFunT> >();
 
   // TODO: Rework the algorithm to NOT make this extra collection?
   typedef detail::node<NTupleIterT> node;

Modified: sandbox/boost/algorithm/cluster/detail/naive_query.hpp
==============================================================================
--- sandbox/boost/algorithm/cluster/detail/naive_query.hpp (original)
+++ sandbox/boost/algorithm/cluster/detail/naive_query.hpp 2008-05-08 18:36:19 EDT (Thu, 08 May 2008)
@@ -21,12 +21,12 @@
 
 // TODO: Replace this naive query function w/ R*-tree or fractional cascading.
 // This query mechanism makes the runtime quadratic.
-template<typename NTupleIterT, typename DistFunT>
+template<typename NTupleIterT, typename DistanceT, typename DistFunT>
 static void naive_query(
   NTupleIterT const & query_pt,
   NTupleIterT const & begin,
   NTupleIterT const & end,
- typename NTupleIterT::difference_type eps,
+ DistanceT const & eps,
   DistFunT const & d,
   std::vector<NTupleIterT> & v)
 {


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk