DiskAllNN Class Reference

A computation class for dual-tree and naive all-nearest-neighbors. More...

Collaboration diagram for DiskAllNN:
[legend]

List of all members.

Public Member Functions

void ComputeNaive (GenVector< index_t > *results, GenVector< double > *distances)
 Computes the nearest neighbors naively.
void ComputeNeighbors (GenVector< index_t > *results, GenVector< double > *distances)
 Computes the nearest neighbors and stores them in results if provided.
void EmitResults (GenVector< index_t > *results, GenVector< double > *distances)
 Initialize and fill an ArrayList of results.
void GNPBaseCase_ (TreeType *query_node, TreeType *reference_node)
 Performs exhaustive computation between two nodes.
void GNPRecursion_ (TreeType *query_node, TreeType *reference_node, double lower_bound_distance)
 Performs one node-node comparison in the GNP algorithm and recurses upon all child combinations if no prune.
void Init (const Matrix &references_in, fx_module *module_in)
void Init (const Matrix &queries_in, const Matrix &references_in, struct datanode *module_in)
 Read parameters, copy data into the class, and build the trees.
void InitNaive (const Matrix &references_in, fx_module *module_in)
 Initializes the AllNN structure for naive computation.
void InitNaive (const Matrix &queries_in, const Matrix &references_in, fx_module *module_in)
 Initializes the AllNN structure for naive computation.
double MinNodeDistSq_ (TreeType *query_node, TreeType *reference_node)
 Computes the minimum squared distance between the bounding boxes of two nodes.

Detailed Description

A computation class for dual-tree and naive all-nearest-neighbors.

This class builds trees for (assumed distinct) input query and reference sets on Init. It can also handle monochromatic cases where the query and the reference trees are the same The all-nearest-neighbors computation is then performed by calling ComputeNeighbors or ComputeNaive.

This class is only intended to compute once per instantiation.

Example use:

   AllNN allnn;
   struct datanode* allnn_module;
   ArrayList<index_t> results;

   allnn_module = fx_submodule(NULL, "allnn", "allnn");
   allnn.Init(query_set, reference_set, allnn_module);
   allnn.ComputeNeighbors(&results);

Definition at line 95 of file disk_allnn.h.


Member Function Documentation

void DiskAllNN::ComputeNaive ( GenVector< index_t > *  results,
GenVector< double > *  distances 
) [inline]

Computes the nearest neighbors naively.

Definition at line 923 of file disk_allnn.h.

References EmitResults(), fx_timer_start(), fx_timer_stop(), and GNPBaseCase_().

void DiskAllNN::ComputeNeighbors ( GenVector< index_t > *  results,
GenVector< double > *  distances 
) [inline]

Computes the nearest neighbors and stores them in results if provided.

Definition at line 893 of file disk_allnn.h.

References EmitResults(), fx_result_int(), fx_timer_start(), fx_timer_stop(), GNPRecursion_(), and MinNodeDistSq_().

void DiskAllNN::EmitResults ( GenVector< index_t > *  results,
GenVector< double > *  distances 
) [inline]

Initialize and fill an ArrayList of results.

Definition at line 945 of file disk_allnn.h.

References GenVector< T >::length(), and GenVector< T >::StaticInit().

Referenced by ComputeNaive(), and ComputeNeighbors().

void DiskAllNN::GNPBaseCase_ ( TreeType *  query_node,
TreeType *  reference_node 
) [inline]

Performs exhaustive computation between two nodes.

Note that naive also makes use of this function.

Definition at line 283 of file disk_allnn.h.

References la::DistanceSqEuclidean().

Referenced by ComputeNaive(), and GNPRecursion_().

void DiskAllNN::GNPRecursion_ ( TreeType *  query_node,
TreeType *  reference_node,
double  lower_bound_distance 
) [inline]

Performs one node-node comparison in the GNP algorithm and recurses upon all child combinations if no prune.

Definition at line 361 of file disk_allnn.h.

References GNPBaseCase_(), and MinNodeDistSq_().

Referenced by ComputeNeighbors().

void DiskAllNN::Init ( const Matrix &  queries_in,
const Matrix &  references_in,
struct datanode module_in 
) [inline]

Read parameters, copy data into the class, and build the trees.

Definition at line 670 of file disk_allnn.h.

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

void DiskAllNN::InitNaive ( const Matrix &  references_in,
fx_module *  module_in 
) [inline]

Initializes the AllNN structure for naive computation.

We have no need to build trees for naive.

Definition at line 851 of file disk_allnn.h.

References GenVector< T >::Alias(), GenVector< T >::SetAll(), and GenVector< T >::StaticInit().

void DiskAllNN::InitNaive ( const Matrix &  queries_in,
const Matrix &  references_in,
fx_module *  module_in 
) [inline]

Initializes the AllNN structure for naive computation.

We have no need to build trees for naive.

Definition at line 808 of file disk_allnn.h.

References GenVector< T >::SetAll(), and GenVector< T >::StaticInit().

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

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

Definition at line 273 of file disk_allnn.h.

Referenced by ComputeNeighbors(), and GNPRecursion_().


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