GClasses
GClasses::GBruteForceNeighborFinder Class Reference

Finds neighbors by measuring the distance to all points. This one should work properly even if the distance metric does not support the triangle inequality. More...

#include <GNeighborFinder.h>

Inheritance diagram for GClasses::GBruteForceNeighborFinder:
GClasses::GNeighborFinderGeneralizing GClasses::GNeighborFinder

Public Member Functions

 GBruteForceNeighborFinder (GMatrix *pData, size_t neighborCount, GDistanceMetric *pMetric=NULL, bool ownMetric=false)
 
virtual ~GBruteForceNeighborFinder ()
 
virtual void neighbors (size_t *pOutNeighbors, size_t index)
 See the comment for GNeighborFinder::neighbors. More...
 
virtual void neighbors (size_t *pOutNeighbors, double *pOutDistances, size_t index)
 See the comment for GNeighborFinder::neighbors. More...
 
virtual void neighbors (size_t *pOutNeighbors, double *pOutDistances, const double *pInputVector)
 See the comment for GNeighborFinderGeneralizing::neighbors. More...
 
virtual void reoptimize ()
 This is a no-op method in this class. More...
 
- Public Member Functions inherited from GClasses::GNeighborFinderGeneralizing
 GNeighborFinderGeneralizing (const GMatrix *pData, size_t neighborCount, GDistanceMetric *pMetric=NULL, bool ownMetric=false)
 Create a neighborfinder for finding the neighborCount nearest neighbors under the given metric. If ownMetric is true, then the neighborFinder takes responsibility for deleting the metric, otherwise it is the caller's responsibility. More...
 
virtual ~GNeighborFinderGeneralizing ()
 
virtual bool canGeneralize ()
 Returns true. See the comment for GNeighborFinder::canGeneralize. More...
 
- Public Member Functions inherited from GClasses::GNeighborFinder
 GNeighborFinder (const GMatrix *pData, size_t neighborCount)
 
virtual ~GNeighborFinder ()
 
const GMatrixdata ()
 Returns the data passed to the constructor of this object. More...
 
virtual bool isCached ()
 Returns true iff the neighbors and distances are pre-computed. More...
 
size_t neighborCount ()
 Returns the number of neighbors to find. More...
 
void sortNeighbors (size_t *pNeighbors, double *pDistances)
 Uses Quick Sort to sort the neighbors from least to most dissimilar, followed by any slots for with INVALID_INDEX for the index. (Note: This method is pointless, since the neighors are already guaranteed to come in sorted order. Todo: figure out why it is still here) More...
 

Additional Inherited Members

- Static Public Member Functions inherited from GClasses::GNeighborFinder
static void sortNeighbors (size_t neighborCount, size_t *pNeighbors, double *pDistances)
 Uses Quick Sort to sort the neighbors from least to most dissimilar, followed by any slots for with INVALID_INDEX for the index. (Note: This method is pointless, since the neighors are already guaranteed to come in sorted order. Todo: figure out why it is still here) More...
 
- Protected Attributes inherited from GClasses::GNeighborFinderGeneralizing
bool m_ownMetric
 
GDistanceMetricm_pMetric
 
- Protected Attributes inherited from GClasses::GNeighborFinder
size_t m_neighborCount
 
const GMatrixm_pData
 

Detailed Description

Finds neighbors by measuring the distance to all points. This one should work properly even if the distance metric does not support the triangle inequality.

Constructor & Destructor Documentation

GClasses::GBruteForceNeighborFinder::GBruteForceNeighborFinder ( GMatrix pData,
size_t  neighborCount,
GDistanceMetric pMetric = NULL,
bool  ownMetric = false 
)
virtual GClasses::GBruteForceNeighborFinder::~GBruteForceNeighborFinder ( )
virtual

Member Function Documentation

virtual void GClasses::GBruteForceNeighborFinder::neighbors ( size_t *  pOutNeighbors,
size_t  index 
)
virtual

See the comment for GNeighborFinder::neighbors.

Implements GClasses::GNeighborFinder.

virtual void GClasses::GBruteForceNeighborFinder::neighbors ( size_t *  pOutNeighbors,
double *  pOutDistances,
size_t  index 
)
virtual

See the comment for GNeighborFinder::neighbors.

Implements GClasses::GNeighborFinder.

virtual void GClasses::GBruteForceNeighborFinder::neighbors ( size_t *  pOutNeighbors,
double *  pOutDistances,
const double *  pInputVector 
)
virtual
virtual void GClasses::GBruteForceNeighborFinder::reoptimize ( )
virtual

This is a no-op method in this class.

Implements GClasses::GNeighborFinderGeneralizing.