From fe73f866046cfc703c73b292981d1be70ac04a57 Mon Sep 17 00:00:00 2001 From: Jonathan Franklin Date: Thu, 8 May 2008 22:36:19 +0000 Subject: [PATCH] Fixed bug w/ eps data type. Added size() to cluster_data. [SVN r45235] --- include/boost/algorithm/cluster/cluster_data.hpp | 1 + include/boost/algorithm/cluster/dbscan.hpp | 8 ++++++-- include/boost/algorithm/cluster/detail/naive_query.hpp | 4 ++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/include/boost/algorithm/cluster/cluster_data.hpp b/include/boost/algorithm/cluster/cluster_data.hpp index c5186db..6e998fb 100644 --- a/include/boost/algorithm/cluster/cluster_data.hpp +++ b/include/boost/algorithm/cluster/cluster_data.hpp @@ -52,6 +52,7 @@ struct cluster_data 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 m_pClusters; }; diff --git a/include/boost/algorithm/cluster/dbscan.hpp b/include/boost/algorithm/cluster/dbscan.hpp index a7a9480..f0d8dcc 100644 --- a/include/boost/algorithm/cluster/dbscan.hpp +++ b/include/boost/algorithm/cluster/dbscan.hpp @@ -9,6 +9,7 @@ #include #include #include +#include #include namespace boost @@ -45,11 +46,12 @@ struct node * \param[in] d * \return The cluster data (partitioning of the tuples). */ -template +template cluster_data 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 @@ dbscan(NTupleIterT const & begin, function_requires< DistanceComparableConcept >(); //DistanceComparableConcept >(); + function_requires< + DistanceComparableConcept >(); // TODO: Rework the algorithm to NOT make this extra collection? typedef detail::node node; diff --git a/include/boost/algorithm/cluster/detail/naive_query.hpp b/include/boost/algorithm/cluster/detail/naive_query.hpp index 7ba780c..5a05409 100644 --- a/include/boost/algorithm/cluster/detail/naive_query.hpp +++ b/include/boost/algorithm/cluster/detail/naive_query.hpp @@ -21,12 +21,12 @@ namespace detail // TODO: Replace this naive query function w/ R*-tree or fractional cascading. // This query mechanism makes the runtime quadratic. -template +template 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 & v) {