Classes | |
struct | KDNode |
Public Member Functions | |
kdtree (unsigned int kdim, std::list< float * > *dataset, std::list< VALUE > *userset=NULL) | |
int | size () |
int | dim () |
bool | empty () |
std::list< float * > * | findDataset (float *datavec) |
std::list< float * > * | findDatasetInterval (float *min_datavec, float *max_datavec) |
std::list< VALUE > * | findUserset (float *datavec) |
std::list< VALUE > * | findUsersetInterval (float *min_datavec, float *max_datavec) |
KDNode * | build (unsigned int kdim, unsigned int curlvl, unsigned int equaldims, std::list< float * > *dataset, std::list< VALUE > *userset=NULL) |
Public Attributes | |
int | kdim |
KDNode * | root |
kdtree< VALUE >::kdtree | ( | unsigned int | kdim, | |
std::list< float * > * | dataset, | |||
std::list< VALUE > * | userset = NULL | |||
) | [inline] |
Constructs an immutable kd-tree of the given dimensionality (kdim) for the given dataset (and corresponding userset). Datavectors must be of dimension kdim.
KDNode* kdtree< VALUE >::build | ( | unsigned int | kdim, | |
unsigned int | curlvl, | |||
unsigned int | equaldims, | |||
std::list< float * > * | dataset, | |||
std::list< VALUE > * | userset = NULL | |||
) | [inline] |
Constructs a KD-Tree of the given dimensionality (kdim) for the given dataset. Note that the pointers in the dataset are stored in the tree. The algorithm identifies equal dimensions and delivers optimized branches (throw/catch is used to return leafes upwards to the branch where the last difference in data was).
kdim : Dimensionality of datavectors. curlvl : Current level, should be 0 initialy. equaldims : Equal dimensions, should be 0 initialy. dataset: List of datavectors of dimension kdim to cluster. userset: Associated userdata/objects for each datavector (or userset == NULL <=> no userdata at all).
The function is roughly divided into:
int kdtree< VALUE >::dim | ( | ) | [inline] |
Returns the number of dimensions a stored datavector has/must have.
bool kdtree< VALUE >::empty | ( | ) | [inline] |
Returns true if the tree contains no data (as of now never).
std::list<float*>* kdtree< VALUE >::findDataset | ( | float * | datavec | ) | [inline] |
Returns a list of similar datavectors to the given datavector note that when the list contains more than one datavector then they are all equal (at least within an epsilon). The returned list is freshly allocated (new'ed). To delete is caller responsibility.
std::list<float*>* kdtree< VALUE >::findDatasetInterval | ( | float * | min_datavec, | |
float * | max_datavec | |||
) | [inline] |
Similar to findDataset(..) but finds datavectors near to the given interval. The returned list is freshly allocated (new'ed). To delete is caller responsibility.
std::list<VALUE>* kdtree< VALUE >::findUserset | ( | float * | datavec | ) | [inline] |
Returns a list of associated userdata for similar datavectors to the given datavector note that when the list contains more than one userdata then the found datavectors where all equal (at least within an epsilon). The returned list is freshly allocated (new'ed). To delete is caller responsibility.
std::list<VALUE>* kdtree< VALUE >::findUsersetInterval | ( | float * | min_datavec, | |
float * | max_datavec | |||
) | [inline] |
Similar to findUserset(..) but finds userdata for datavectors near to the given interval. The returned list is freshly allocated (new'ed). To delete is caller responsibility.
int kdtree< VALUE >::size | ( | ) | [inline] |
Returns amount of (not necessarily unique) stored datavectors.