Fixed bug w/ eps data type.

Added size() to cluster_data.



[SVN r45235]
This commit is contained in:
Jonathan Franklin
2008-05-08 22:36:19 +00:00
parent 64d219039e
commit fe73f86604
3 changed files with 9 additions and 4 deletions

View File

@ -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<clusters> m_pClusters;
};

View File

@ -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 @@ struct node
* \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 @@ dbscan(NTupleIterT const & begin,
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;

View File

@ -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<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)
{