mlpack  master
Public Member Functions | Private Attributes | List of all members
mlpack::tree::TraversalInfo< TreeType > Class Template Reference

The TraversalInfo class holds traversal information which is used in dual-tree (and single-tree) traversals. More...

Public Member Functions

 TraversalInfo ()
 Create the TraversalInfo object and initialize the pointers to NULL. More...
 
double LastBaseCase () const
 Get the base case associated with the last node combination. More...
 
double & LastBaseCase ()
 Modify the base case associated with the last node combination. More...
 
TreeType * LastQueryNode () const
 Get the last query node. More...
 
TreeType *& LastQueryNode ()
 Modify the last query node. More...
 
TreeType * LastReferenceNode () const
 Get the last reference node. More...
 
TreeType *& LastReferenceNode ()
 Modify the last reference node. More...
 
double LastScore () const
 Get the score associated with the last query and reference nodes. More...
 
double & LastScore ()
 Modify the score associated with the last query and reference nodes. More...
 

Private Attributes

double lastBaseCase
 The last base case. More...
 
TreeType * lastQueryNode
 The last query node. More...
 
TreeType * lastReferenceNode
 The last reference node. More...
 
double lastScore
 The last score. More...
 

Detailed Description

template<typename TreeType>
class mlpack::tree::TraversalInfo< TreeType >

The TraversalInfo class holds traversal information which is used in dual-tree (and single-tree) traversals.

A traversal should be updating the members of this class before Score() is called. This class should be held as a member of the RuleType class and the interface to it should be through a TraversalInfo() method.

The information held by this class is the last node combination visited before the current node combination was recursed into, and the score resulting from when Score() was called on that combination. However, this information is identical for a query node and a reference node in a particular node combination, so traversals only need to update the TraversalInfo object in a query node (and the algorithms should only use the TraversalInfo object from a query node).

In general, this auxiliary traversal information is used to try and make a prune without needing to call BaseCase() or calculate the distance between nodes. Using this information you can place bounds on the distance between the two nodes quickly.

If the traversal is not updating the members of this class correctly, a likely result is a null pointer dereference. Dual-tree algorithms should assume that the members are set properly and should not need to check for null pointers.

There is one exception, which is the root node combination; the score can be set to 0 and the query and reference nodes can just be set to the root nodes; no algorithm should be able to prune the root combination anyway.

Definition at line 50 of file traversal_info.hpp.

Constructor & Destructor Documentation

template<typename TreeType >
mlpack::tree::TraversalInfo< TreeType >::TraversalInfo ( )
inline

Create the TraversalInfo object and initialize the pointers to NULL.

Definition at line 56 of file traversal_info.hpp.

Member Function Documentation

template<typename TreeType >
double mlpack::tree::TraversalInfo< TreeType >::LastBaseCase ( ) const
inline

Get the base case associated with the last node combination.

Definition at line 78 of file traversal_info.hpp.

References mlpack::tree::TraversalInfo< TreeType >::lastBaseCase.

template<typename TreeType >
double& mlpack::tree::TraversalInfo< TreeType >::LastBaseCase ( )
inline

Modify the base case associated with the last node combination.

Definition at line 80 of file traversal_info.hpp.

References mlpack::tree::TraversalInfo< TreeType >::lastBaseCase.

template<typename TreeType >
TreeType* mlpack::tree::TraversalInfo< TreeType >::LastQueryNode ( ) const
inline

Get the last query node.

Definition at line 63 of file traversal_info.hpp.

References mlpack::tree::TraversalInfo< TreeType >::lastQueryNode.

template<typename TreeType >
TreeType*& mlpack::tree::TraversalInfo< TreeType >::LastQueryNode ( )
inline

Modify the last query node.

Definition at line 65 of file traversal_info.hpp.

References mlpack::tree::TraversalInfo< TreeType >::lastQueryNode.

template<typename TreeType >
TreeType* mlpack::tree::TraversalInfo< TreeType >::LastReferenceNode ( ) const
inline

Get the last reference node.

Definition at line 68 of file traversal_info.hpp.

References mlpack::tree::TraversalInfo< TreeType >::lastReferenceNode.

template<typename TreeType >
TreeType*& mlpack::tree::TraversalInfo< TreeType >::LastReferenceNode ( )
inline

Modify the last reference node.

Definition at line 70 of file traversal_info.hpp.

References mlpack::tree::TraversalInfo< TreeType >::lastReferenceNode.

template<typename TreeType >
double mlpack::tree::TraversalInfo< TreeType >::LastScore ( ) const
inline

Get the score associated with the last query and reference nodes.

Definition at line 73 of file traversal_info.hpp.

References mlpack::tree::TraversalInfo< TreeType >::lastScore.

template<typename TreeType >
double& mlpack::tree::TraversalInfo< TreeType >::LastScore ( )
inline

Modify the score associated with the last query and reference nodes.

Definition at line 75 of file traversal_info.hpp.

References mlpack::tree::TraversalInfo< TreeType >::lastScore.

Member Data Documentation

template<typename TreeType >
double mlpack::tree::TraversalInfo< TreeType >::lastBaseCase
private

The last base case.

Definition at line 90 of file traversal_info.hpp.

Referenced by mlpack::tree::TraversalInfo< TreeType >::LastBaseCase().

template<typename TreeType >
TreeType* mlpack::tree::TraversalInfo< TreeType >::lastQueryNode
private

The last query node.

Definition at line 84 of file traversal_info.hpp.

Referenced by mlpack::tree::TraversalInfo< TreeType >::LastQueryNode().

template<typename TreeType >
TreeType* mlpack::tree::TraversalInfo< TreeType >::lastReferenceNode
private

The last reference node.

Definition at line 86 of file traversal_info.hpp.

Referenced by mlpack::tree::TraversalInfo< TreeType >::LastReferenceNode().

template<typename TreeType >
double mlpack::tree::TraversalInfo< TreeType >::lastScore
private

The last score.

Definition at line 88 of file traversal_info.hpp.

Referenced by mlpack::tree::TraversalInfo< TreeType >::LastScore().


The documentation for this class was generated from the following file: