GClasses
|
Finds the k-nearest neighbors of any vector in a dataset.
#include <GNeighborFinder.h>
Public Member Functions | |
GNeighborFinder (const GMatrix *pData) | |
virtual | ~GNeighborFinder () |
virtual bool | canGeneralize () |
Returns true if this neighbor finder can operate on points that are not in the dataset passed to the constructor. More... | |
const GMatrix * | data () |
Returns the data passed to the constructor of this object. More... | |
virtual double | distance (size_t i)=0 |
Returns the distance to the ith neighbor of the last point passed to "findNearest". (Behavior is undefined if findNearest has not yet been called.) More... | |
virtual size_t | findNearest (size_t k, size_t pointIndex)=0 |
Finds the k-nearest neighbors of the specified point index. Returns the number of neighbors found. Call "neighbor" or "distance" to obtain the neighbors and distances that were found. More... | |
virtual size_t | findWithinRadius (double squaredRadius, size_t pointIndex)=0 |
Finds all neighbors of the specified point index within a specified radius. Returns the number of neighbors found. Call "neighbor" or "distance" to obtain the neighbors and distances that were found. More... | |
virtual bool | isCached () |
Returns true iff the neighbors and distances are pre-computed. More... | |
virtual size_t | neighbor (size_t i)=0 |
Returns the point index of the ith neighbor of the last point passed to "findNearest". (Behavior is undefined if findNearest has not yet been called.) More... | |
Protected Attributes | |
const GMatrix * | m_pData |
|
inline |
|
inlinevirtual |
|
inlinevirtual |
Returns true if this neighbor finder can operate on points that are not in the dataset passed to the constructor.
Reimplemented in GClasses::GNeighborFinderGeneralizing.
|
inline |
Returns the data passed to the constructor of this object.
|
pure virtual |
Returns the distance to the ith neighbor of the last point passed to "findNearest". (Behavior is undefined if findNearest has not yet been called.)
Implemented in GClasses::GNeighborFinderGeneralizing, and GClasses::GNeighborGraph.
|
pure virtual |
Finds the k-nearest neighbors of the specified point index. Returns the number of neighbors found. Call "neighbor" or "distance" to obtain the neighbors and distances that were found.
Implemented in GClasses::GBallTree, GClasses::GKdTree, GClasses::GSparseNeighborFinder, GClasses::GBruteForceNeighborFinder, and GClasses::GNeighborGraph.
|
pure virtual |
Finds all neighbors of the specified point index within a specified radius. Returns the number of neighbors found. Call "neighbor" or "distance" to obtain the neighbors and distances that were found.
Implemented in GClasses::GBallTree, GClasses::GKdTree, GClasses::GSparseNeighborFinder, GClasses::GBruteForceNeighborFinder, and GClasses::GNeighborGraph.
|
inlinevirtual |
Returns true iff the neighbors and distances are pre-computed.
Reimplemented in GClasses::GNeighborGraph.
|
pure virtual |
Returns the point index of the ith neighbor of the last point passed to "findNearest". (Behavior is undefined if findNearest has not yet been called.)
Implemented in GClasses::GNeighborFinderGeneralizing, and GClasses::GNeighborGraph.
|
protected |