Performs all-furthest-neighbors. More...
Public Member Functions | |
AllkFN () | |
Constructors are generally very simple in FASTlib; most of the work is done by Init(). | |
void | ComputeBaseCase_ (TreeType *query_node, TreeType *reference_node) |
Performs exhaustive computation between two leaves. | |
void | ComputeNaive (ArrayList< index_t > *resulting_neighbors, ArrayList< double > *distances) |
Does the entire computation naively. | |
void | ComputeNeighbors (ArrayList< index_t > *resulting_neighbors, ArrayList< double > *distances) |
Computes the nearest neighbors and stores them in *results. | |
void | ComputeNeighborsRecursion_ (TreeType *query_node, TreeType *reference_node, double higher_bound_distance) |
The recursive function. | |
void | Destruct () |
void | Init (const Matrix &references_in, index_t leaf_size, index_t kfns) |
void | Init (const Matrix &queries_in, const Matrix &references_in, index_t leaf_size, index_t kfns) |
void | Init (const Matrix &references_in, struct datanode *module_in) |
Use this if you want to run allknn it on a single dataset the query tree and reference tree are the same. | |
void | Init (const Matrix &queries_in, const Matrix &references_in, struct datanode *module_in) |
Setup the class and build the trees. | |
void | InitNaive (const Matrix &references_in, index_t kfns) |
void | InitNaive (const Matrix &queries_in, const Matrix &references_in, index_t kfns) |
Initializes the AllNN structure for naive computation. | |
double | MaxNodeDistSq_ (TreeType *query_node, TreeType *reference_node) |
Computes the maximum squared distance between the bounding boxes of two nodes. | |
~AllkFN () | |
The tree is the only member we are responsible for deleting. | |
Friends | |
class | TestAllkNFN |
Performs all-furthest-neighbors.
This class will build the trees and perform the recursive computation.
Definition at line 57 of file allkfn.h.
AllkFN::AllkFN | ( | ) | [inline] |
AllkFN::~AllkFN | ( | ) | [inline] |
Performs exhaustive computation between two leaves.
Definition at line 198 of file allkfn.h.
References BinarySpaceTree< TBound, TDataset, TStatistic >::begin(), la::DistanceSqEuclidean(), and BinarySpaceTree< TBound, TDataset, TStatistic >::end().
Referenced by ComputeNaive(), and ComputeNeighborsRecursion_().
void AllkFN::ComputeNaive | ( | ArrayList< index_t > * | resulting_neighbors, | |
ArrayList< double > * | distances | |||
) | [inline] |
Does the entire computation naively.
Definition at line 658 of file allkfn.h.
References ComputeBaseCase_(), ArrayList< TElem >::Init(), GenVector< T >::length(), and ArrayList< TElem >::size().
void AllkFN::ComputeNeighbors | ( | ArrayList< index_t > * | resulting_neighbors, | |
ArrayList< double > * | distances | |||
) | [inline] |
Computes the nearest neighbors and stores them in *results.
Definition at line 616 of file allkfn.h.
References ComputeNeighborsRecursion_(), ArrayList< TElem >::Init(), GenVector< T >::length(), MaxNodeDistSq_(), and ArrayList< TElem >::size().
void AllkFN::ComputeNeighborsRecursion_ | ( | TreeType * | query_node, | |
TreeType * | reference_node, | |||
double | higher_bound_distance | |||
) | [inline] |
The recursive function.
Definition at line 268 of file allkfn.h.
References ComputeBaseCase_(), BinarySpaceTree< TBound, TDataset, TStatistic >::left(), MaxNodeDistSq_(), and BinarySpaceTree< TBound, TDataset, TStatistic >::right().
Referenced by ComputeNeighbors().
void AllkFN::Init | ( | const Matrix & | references_in, | |
struct datanode * | module_in | |||
) | [inline] |
Use this if you want to run allknn it on a single dataset the query tree and reference tree are the same.
Definition at line 435 of file allkfn.h.
References fx_param_int(), fx_timer_start(), fx_timer_stop(), GenVector< T >::Init(), ArrayList< TElem >::Init(), and GenVector< T >::SetAll().
void AllkFN::Init | ( | const Matrix & | queries_in, | |
const Matrix & | references_in, | |||
struct datanode * | module_in | |||
) | [inline] |
Setup the class and build the trees.
Note: we are initializing with const references to prevent local copies of the data.
Definition at line 386 of file allkfn.h.
References fx_param_int(), fx_timer_start(), fx_timer_stop(), GenVector< T >::Init(), ArrayList< TElem >::Init(), and GenVector< T >::SetAll().
void AllkFN::InitNaive | ( | const Matrix & | queries_in, | |
const Matrix & | references_in, | |||
index_t | kfns | |||
) | [inline] |
Initializes the AllNN structure for naive computation.
This means that we simply ignore the tree building.
Definition at line 568 of file allkfn.h.
References GenVector< T >::Init(), ArrayList< TElem >::Init(), and GenVector< T >::SetAll().
Computes the maximum squared distance between the bounding boxes of two nodes.
Definition at line 188 of file allkfn.h.
Referenced by ComputeNeighbors(), and ComputeNeighborsRecursion_().