AllkNN Class Reference

Performs all-nearest-neighbors. More...

Collaboration diagram for AllkNN:
[legend]

List of all members.

Public Member Functions

 AllkNN ()
 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 ComputeDualNeighborsRecursion_ (TreeType *query_node, TreeType *reference_node, double lower_bound_distance)
 The recursive function for dual tree.
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 ComputeSingleNeighborsRecursion_ (index_t point_id, Vector &point, TreeType *reference_node, double *min_dist_so_far)
void Destruct ()
 Initializes the AllNN structure for naive computation.
void Init (const Matrix &references_in, index_t leaf_size, index_t knns, const char *mode="dual")
void Init (const Matrix &queries_in, const Matrix &references_in, index_t leaf_size, index_t knns, const char *mode="dual")
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 knns)
void InitNaive (const Matrix &queries_in, const Matrix &references_in, index_t knns)
double MinNodeDistSq_ (TreeType *query_node, TreeType *reference_node)
 Computes the minimum squared distance between the bounding boxes of two nodes.
double MinPointNodeDistSq_ (const Vector &query_point, TreeType *reference_node)
 Computes the minimum squared distances between a point and a node's bounding box.
 ~AllkNN ()
 The tree is the only member we are responsible for deleting.

Friends

class TestAllkNN

Detailed Description

Performs all-nearest-neighbors.

This class will build the trees and perform the recursive computation.

Definition at line 57 of file allknn.h.


Constructor & Destructor Documentation

AllkNN::AllkNN (  )  [inline]

Constructors are generally very simple in FASTlib; most of the work is done by Init().

This is only responsible for ensuring that the object is ready to be destroyed safely.

Definition at line 169 of file allknn.h.

AllkNN::~AllkNN (  )  [inline]

The tree is the only member we are responsible for deleting.

The others will take care of themselves.

Definition at line 177 of file allknn.h.


Member Function Documentation

void AllkNN::ComputeBaseCase_ ( TreeType query_node,
TreeType reference_node 
) [inline]
void AllkNN::ComputeDualNeighborsRecursion_ ( TreeType query_node,
TreeType reference_node,
double  lower_bound_distance 
) [inline]
void AllkNN::ComputeNaive ( ArrayList< index_t > *  resulting_neighbors,
ArrayList< double > *  distances 
) [inline]

Does the entire computation naively.

Definition at line 782 of file allknn.h.

References ComputeBaseCase_(), ArrayList< TElem >::Init(), GenVector< T >::length(), and ArrayList< TElem >::size().

void AllkNN::ComputeNeighbors ( ArrayList< index_t > *  resulting_neighbors,
ArrayList< double > *  distances 
) [inline]
void AllkNN::Destruct (  )  [inline]

Initializes the AllNN structure for naive computation.

This means that we simply ignore the tree building.

Definition at line 654 of file allknn.h.

References GenVector< T >::Destruct().

void AllkNN::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 524 of file allknn.h.

References fx_param_int(), fx_param_str(), fx_timer_start(), fx_timer_stop(), GenVector< T >::Init(), ArrayList< TElem >::Init(), and GenVector< T >::SetAll().

void AllkNN::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 470 of file allknn.h.

References fx_param_int(), fx_param_str(), fx_timer_start(), fx_timer_stop(), GenVector< T >::Init(), ArrayList< TElem >::Init(), and GenVector< T >::SetAll().

Referenced by NaiveKde< TKernel >::Init().

double AllkNN::MinNodeDistSq_ ( TreeType query_node,
TreeType reference_node 
) [inline]

Computes the minimum squared distance between the bounding boxes of two nodes.

Definition at line 192 of file allknn.h.

Referenced by ComputeDualNeighborsRecursion_(), and ComputeNeighbors().

double AllkNN::MinPointNodeDistSq_ ( const Vector query_point,
TreeType reference_node 
) [inline]

Computes the minimum squared distances between a point and a node's bounding box.

Definition at line 201 of file allknn.h.

Referenced by ComputeBaseCase_().


The documentation for this class was generated from the following file:
Generated on Mon Jan 24 12:04:39 2011 for FASTlib by  doxygen 1.6.3