All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
fcl::GreedyKCenters< _T > Class Template Reference

An instance of this class can be used to greedily select a given number of representatives from a set of data points that are all far apart from each other. More...

#include <hpp/fcl/knn/greedy_kcenters.h>

Collaboration diagram for fcl::GreedyKCenters< _T >:

Public Types

typedef boost::function
< double(const _T &, const _T &)> 
DistanceFunction
 The definition of a distance function. More...
 

Public Member Functions

 GreedyKCenters (void)
 
virtual ~GreedyKCenters (void)
 
void setDistanceFunction (const DistanceFunction &distFun)
 Set the distance function to use. More...
 
const DistanceFunctiongetDistanceFunction (void) const
 Get the distance function used. More...
 
void kcenters (const std::vector< _T > &data, unsigned int k, std::vector< unsigned int > &centers, std::vector< std::vector< double > > &dists)
 Greedy algorithm for selecting k centers. More...
 

Protected Attributes

DistanceFunction distFun_
 The used distance function. More...
 
RNG rng_
 Random number generator used to select first center. More...
 

Detailed Description

template<typename _T>
class fcl::GreedyKCenters< _T >

An instance of this class can be used to greedily select a given number of representatives from a set of data points that are all far apart from each other.

Member Typedef Documentation

template<typename _T>
typedef boost::function<double(const _T&, const _T&)> fcl::GreedyKCenters< _T >::DistanceFunction

The definition of a distance function.

Constructor & Destructor Documentation

template<typename _T>
fcl::GreedyKCenters< _T >::GreedyKCenters ( void  )
inline
template<typename _T>
virtual fcl::GreedyKCenters< _T >::~GreedyKCenters ( void  )
inlinevirtual

Member Function Documentation

template<typename _T>
const DistanceFunction& fcl::GreedyKCenters< _T >::getDistanceFunction ( void  ) const
inline

Get the distance function used.

References fcl::GreedyKCenters< _T >::distFun_.

template<typename _T>
void fcl::GreedyKCenters< _T >::kcenters ( const std::vector< _T > &  data,
unsigned int  k,
std::vector< unsigned int > &  centers,
std::vector< std::vector< double > > &  dists 
)
inline

Greedy algorithm for selecting k centers.

Parameters
dataa vector of data points
kthe desired number of centers
centersa vector of length k containing the indices into data of the k centers
distsa 2-dimensional array such that dists[i][j] is the distance between data[i] and data[center[j]]

References fcl::GreedyKCenters< _T >::distFun_, fcl::GreedyKCenters< _T >::rng_, and fcl::RNG::uniformInt().

template<typename _T>
void fcl::GreedyKCenters< _T >::setDistanceFunction ( const DistanceFunction distFun)
inline

Set the distance function to use.

References fcl::GreedyKCenters< _T >::distFun_.

Member Data Documentation

template<typename _T>
RNG fcl::GreedyKCenters< _T >::rng_
protected

Random number generator used to select first center.

Referenced by fcl::GreedyKCenters< _T >::kcenters().