mlpack  master
Classes | Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
mlpack::tree::Octree< MetricType, StatisticType, MatType > Class Template Reference

Classes

class  DualTreeTraverser
 A dual-tree traverser; see dual_tree_traverser.hpp. More...
 
class  SingleTreeTraverser
 A single-tree traverser; see single_tree_traverser.hpp. More...
 
struct  SplitInfo
 This is used for sorting points while splitting. More...
 

Public Types

typedef MatType::elem_type ElemType
 The type of element held in MatType. More...
 
typedef MatType Mat
 So other classes can use TreeType::Mat. More...
 

Public Member Functions

 Octree (const MatType &data, const size_t maxLeafSize=20)
 Construct this as the root node of an octree on the given dataset. More...
 
 Octree (const MatType &data, std::vector< size_t > &oldFromNew, const size_t maxLeafSize=20)
 Construct this as the root node of an octree on the given dataset. More...
 
 Octree (const MatType &data, std::vector< size_t > &oldFromNew, std::vector< size_t > &newFromOld, const size_t maxLeafSize=20)
 Construct this as the root node of an octree on the given dataset. More...
 
 Octree (MatType &&data, const size_t maxLeafSize=20)
 Construct this as the root node of an octree on the given dataset. More...
 
 Octree (MatType &&data, std::vector< size_t > &oldFromNew, const size_t maxLeafSize=20)
 Construct this as the root node of an octree on the given dataset. More...
 
 Octree (MatType &&data, std::vector< size_t > &oldFromNew, std::vector< size_t > &newFromOld, const size_t maxLeafSize=20)
 Construct this as the root node of an octree on the given dataset. More...
 
 Octree (Octree *parent, const size_t begin, const size_t count, const arma::vec &center, const double width, const size_t maxLeafSize=20)
 Construct this node as a child of the given parent, starting at column begin and using count points. More...
 
 Octree (Octree *parent, const size_t begin, const size_t count, std::vector< size_t > &oldFromNew, const arma::vec &center, const double width, const size_t maxLeafSize=20)
 Construct this node as a child of the given parent, starting at column begin and using count points. More...
 
 Octree (const Octree &other)
 Copy the given tree. More...
 
 Octree (Octree &&other)
 Move the given tree. More...
 
template<typename Archive >
 Octree (Archive &ar, const typename std::enable_if_t< Archive::is_loading::value > *=0)
 Initialize the tree from a boost::serialization archive. More...
 
 ~Octree ()
 Destroy the tree. More...
 
const bound::HRectBound< MetricType > & Bound () const
 Return the bound object for this node. More...
 
bound::HRectBound< MetricType > & Bound ()
 Modify the bound object for this node. More...
 
void Center (arma::vec &center) const
 Store the center of the bounding region in the given vector. More...
 
const OctreeChild (const size_t child) const
 Return the specified child. More...
 
OctreeChild (const size_t child)
 Return the specified child. More...
 
Octree *& ChildPtr (const size_t child)
 Return the pointer to the given child. More...
 
const MatType & Dataset () const
 Return the dataset used by this node. More...
 
size_t Descendant (const size_t index) const
 Return the index (with reference to the dataset) of a particular descendant. More...
 
ElemType FurthestDescendantDistance () const
 Return the furthest possible descendant distance. More...
 
ElemType FurthestPointDistance () const
 Return the furthest distance to a point held in this node. More...
 
template<typename VecType >
size_t GetFurthestChild (const VecType &point, typename std::enable_if_t< IsVector< VecType >::value > *=0) const
 Return the index of the furthest child node to the given query point. More...
 
size_t GetFurthestChild (const Octree &queryNode) const
 Return the index of the furthest child node to the given query node. More...
 
template<typename VecType >
size_t GetNearestChild (const VecType &point, typename std::enable_if_t< IsVector< VecType >::value > *=0) const
 Return the index of the nearest child node to the given query point. More...
 
size_t GetNearestChild (const Octree &queryNode) const
 Return the index of the nearest child node to the given query node. More...
 
bool IsLeaf () const
 Return whether or not the node is a leaf. More...
 
ElemType MaxDistance (const Octree &other) const
 Return the maximum distance to another node. More...
 
template<typename VecType >
ElemType MaxDistance (const VecType &point, typename std::enable_if_t< IsVector< VecType >::value > *=0) const
 Return the maximum distance to the given point. More...
 
MetricType Metric () const
 Return the metric that this tree uses. More...
 
ElemType MinDistance (const Octree &other) const
 Return the minimum distance to another node. More...
 
template<typename VecType >
ElemType MinDistance (const VecType &point, typename std::enable_if_t< IsVector< VecType >::value > *=0) const
 Return the minimum distance to the given point. More...
 
ElemType MinimumBoundDistance () const
 Return the minimum distance from the center of the node to any bound edge. More...
 
size_t NumChildren () const
 Return the number of children in this node. More...
 
size_t NumDescendants () const
 Return the number of descendants of this node. More...
 
size_t NumPoints () const
 Return the number of points in this node (0 if not a leaf). More...
 
OctreeParent () const
 Get the pointer to the parent. More...
 
Octree *& Parent ()
 Modify the pointer to the parent (be careful!). More...
 
ElemType ParentDistance () const
 Return the distance from the center of this node to the center of the parent node. More...
 
ElemTypeParentDistance ()
 Modify the distance from the center of this node to the center of the parent node. More...
 
size_t Point (const size_t index) const
 Return the index (with reference to the dataset) of a particular point in this node. More...
 
math::RangeType< ElemTypeRangeDistance (const Octree &other) const
 Return the minimum and maximum distance to another node. More...
 
template<typename VecType >
math::RangeType< ElemTypeRangeDistance (const VecType &point, typename std::enable_if_t< IsVector< VecType >::value > *=0) const
 Return the minimum and maximum distance to another node. More...
 
template<typename Archive >
void Serialize (Archive &ar, const unsigned int)
 Serialize the tree. More...
 
const StatisticType & Stat () const
 Return the statistic object for this node. More...
 
StatisticType & Stat ()
 Modify the statistic object for this node. More...
 

Protected Member Functions

 Octree ()
 A default constructor. More...
 

Private Member Functions

void SplitNode (const arma::vec &center, const double width, const size_t maxLeafSize)
 Split the node, using the given center and the given maximum width of this node. More...
 
void SplitNode (const arma::vec &center, const double width, std::vector< size_t > &oldFromNew, const size_t maxLeafSize)
 Split the node, using the given center and the given maximum width of this node, and fill the mappings vector. More...
 

Private Attributes

size_t begin
 The index of the first point in the dataset contained in this node (and its children). More...
 
bound::HRectBound< MetricType > bound
 The minimum bounding rectangle of the points held in the node (and its children). More...
 
std::vector< Octree * > children
 The children held by this node. More...
 
size_t count
 The number of points of the dataset contained in this node (and its children). More...
 
MatType * dataset
 The dataset. More...
 
ElemType furthestDescendantDistance
 The distance to the furthest descendant, cached to speed things up. More...
 
MetricType metric
 An instantiated metric. More...
 
Octreeparent
 The parent (NULL if this node is the root). More...
 
ElemType parentDistance
 The distance from the center of this node to the center of the parent. More...
 
StatisticType stat
 The statistic. More...
 

Detailed Description

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat>
class mlpack::tree::Octree< MetricType, StatisticType, MatType >

Definition at line 25 of file octree.hpp.

Member Typedef Documentation

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat>
typedef MatType::elem_type mlpack::tree::Octree< MetricType, StatisticType, MatType >::ElemType

The type of element held in MatType.

Definition at line 31 of file octree.hpp.

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat>
typedef MatType mlpack::tree::Octree< MetricType, StatisticType, MatType >::Mat

So other classes can use TreeType::Mat.

Definition at line 29 of file octree.hpp.

Constructor & Destructor Documentation

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat>
mlpack::tree::Octree< MetricType, StatisticType, MatType >::Octree ( const MatType &  data,
const size_t  maxLeafSize = 20 
)

Construct this as the root node of an octree on the given dataset.

This copies the dataset. If you don't want to copy the input dataset, consider using the constructor that takes an rvalue reference and use std::move().

Parameters
dataDataset to create tree from. This will be copied!
maxLeafSizeMaximum number of points in a leaf node.
template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat>
mlpack::tree::Octree< MetricType, StatisticType, MatType >::Octree ( const MatType &  data,
std::vector< size_t > &  oldFromNew,
const size_t  maxLeafSize = 20 
)

Construct this as the root node of an octree on the given dataset.

This copies the dataset and modifies its ordering; a mapping of the old point indices to the new point indices is filled. If you don't want the matrix to be copied, consider using the constructor that takes an rvalue reference and use std::move().

Parameters
dataDataset to create tree from. This will be copied!
oldFromNewVector which will be filled with the old positions for each new point.
maxLeafSizeMaximum number of points in a leaf node.
template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat>
mlpack::tree::Octree< MetricType, StatisticType, MatType >::Octree ( const MatType &  data,
std::vector< size_t > &  oldFromNew,
std::vector< size_t > &  newFromOld,
const size_t  maxLeafSize = 20 
)

Construct this as the root node of an octree on the given dataset.

This copies the dataset and modifies its ordering; a mapping of the old point indices to the new point indices is filled, and a mapping of the new point indices to the old point indices is filled. If you don't want the matrix to be copied, consider using the constructor that takes an rvalue reference and use std::move().

Parameters
dataDataset to create tree from. This will be copied!
oldFromNewVector which will be filled with the old positions for each new point.
newFromOldVector which will be filled with the new positions for each old point.
maxLeafSizeMaximum number of points in a leaf node.
template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat>
mlpack::tree::Octree< MetricType, StatisticType, MatType >::Octree ( MatType &&  data,
const size_t  maxLeafSize = 20 
)

Construct this as the root node of an octree on the given dataset.

This will take ownership of the dataset; if you don't want this, consider using the constructor that takes a const reference to the dataset.

Parameters
dataDataset to create tree from. This will be copied!
maxLeafSizeMaximum number of points in a leaf node.
template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat>
mlpack::tree::Octree< MetricType, StatisticType, MatType >::Octree ( MatType &&  data,
std::vector< size_t > &  oldFromNew,
const size_t  maxLeafSize = 20 
)

Construct this as the root node of an octree on the given dataset.

This will take ownership of the dataset; if you don't want this, consider using the constructor that takes a const reference to the dataset. This modifies the ordering of the dataset; a mapping of the old point indices to the new point indices is filled.

Parameters
dataDataset to create tree from. This will be copied!
oldFromNewVector which will be filled with the old positions for each new point.
maxLeafSizeMaximum number of points in a leaf node.
template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat>
mlpack::tree::Octree< MetricType, StatisticType, MatType >::Octree ( MatType &&  data,
std::vector< size_t > &  oldFromNew,
std::vector< size_t > &  newFromOld,
const size_t  maxLeafSize = 20 
)

Construct this as the root node of an octree on the given dataset.

This will take ownership of the dataset; if you don't want this, consider using the constructor that takes a const reference to the dataset. This modifies the ordering of the dataset; a mapping of the old point indices to the new point indices is filled, and a mapping of the new point indices to the old point indices is filled.

Parameters
dataDataset to create tree from. This will be copied!
oldFromNewVector which will be filled with the old positions for each new point.
newFromOldVector which will be filled with the new positions for each old point.
maxLeafSizeMaximum number of points in a leaf node.
template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat>
mlpack::tree::Octree< MetricType, StatisticType, MatType >::Octree ( Octree< MetricType, StatisticType, MatType > *  parent,
const size_t  begin,
const size_t  count,
const arma::vec &  center,
const double  width,
const size_t  maxLeafSize = 20 
)

Construct this node as a child of the given parent, starting at column begin and using count points.

The ordering of that subset of points in the parent's data matrix will be modified! This is used for recursive tree-building by the other constructors that don't specify point indices.

Parameters
parentParent of this node. Its dataset will be modified!
beginIndex of point to start tree construction with.
countNumber of points to use to construct tree.
centerCenter of the node (for splitting).
widthWidth of the node in each dimension.
maxLeafSizeMaximum number of points in a leaf node.
template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat>
mlpack::tree::Octree< MetricType, StatisticType, MatType >::Octree ( Octree< MetricType, StatisticType, MatType > *  parent,
const size_t  begin,
const size_t  count,
std::vector< size_t > &  oldFromNew,
const arma::vec &  center,
const double  width,
const size_t  maxLeafSize = 20 
)

Construct this node as a child of the given parent, starting at column begin and using count points.

The ordering of that subset of points in the parent's data matrix will be modified! This is used for recursive tree-building by the other constructors that don't specify point indices.

A mapping of the old point indices to the new point indices is filled, but it is expected that the vector is already allocated with size greater than or equal to (begin + count), and if that is not true, invalid memory reads (and writes) will occur.

Parameters
parentParent of this node. Its dataset will be modified!
beginIndex of point to start tree construction with.
countNumber of points to use to construct tree.
oldFromNewVector which will be filled with the old positions for each new point.
centerCenter of the node (for splitting).
widthWidth of the node in each dimension.
maxLeafSizeMaximum number of points in a leaf node.
template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat>
mlpack::tree::Octree< MetricType, StatisticType, MatType >::Octree ( const Octree< MetricType, StatisticType, MatType > &  other)

Copy the given tree.

Be careful! This may use a lot of memory.

Parameters
otherTree to copy from.
template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat>
mlpack::tree::Octree< MetricType, StatisticType, MatType >::Octree ( Octree< MetricType, StatisticType, MatType > &&  other)

Move the given tree.

The tree passed as a parameter will be emptied and will not be usable after this call.

Parameters
otherTree to move.
template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat>
template<typename Archive >
mlpack::tree::Octree< MetricType, StatisticType, MatType >::Octree ( Archive &  ar,
const typename std::enable_if_t< Archive::is_loading::value > *  = 0 
)

Initialize the tree from a boost::serialization archive.

Parameters
arArchive to load tree from. Must be an iarchive, not an oarchive.
template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat>
mlpack::tree::Octree< MetricType, StatisticType, MatType >::~Octree ( )

Destroy the tree.

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat>
mlpack::tree::Octree< MetricType, StatisticType, MatType >::Octree ( )
protected

A default constructor.

This is meant to only be used with boost::serialization, which is allowed with the friend declaration below. This does not return a valid treee! The method must be protected, so that the serialization shim can work with the default constructor.

Referenced by mlpack::tree::Octree< MetricType, StatisticType, MatType >::Center().

Member Function Documentation

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat>
const bound::HRectBound<MetricType>& mlpack::tree::Octree< MetricType, StatisticType, MatType >::Bound ( ) const
inline

Return the bound object for this node.

Definition at line 247 of file octree.hpp.

References mlpack::tree::Octree< MetricType, StatisticType, MatType >::bound.

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat>
bound::HRectBound<MetricType>& mlpack::tree::Octree< MetricType, StatisticType, MatType >::Bound ( )
inline

Modify the bound object for this node.

Definition at line 249 of file octree.hpp.

References mlpack::tree::Octree< MetricType, StatisticType, MatType >::bound.

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat>
void mlpack::tree::Octree< MetricType, StatisticType, MatType >::Center ( arma::vec &  center) const
inline
template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat>
const Octree& mlpack::tree::Octree< MetricType, StatisticType, MatType >::Child ( const size_t  child) const
inline

Return the specified child.

If the index is out of bounds, unspecified behavior will occur.

Definition at line 326 of file octree.hpp.

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat>
Octree& mlpack::tree::Octree< MetricType, StatisticType, MatType >::Child ( const size_t  child)
inline

Return the specified child.

If the index is out of bounds, unspecified behavior will occur.

Definition at line 332 of file octree.hpp.

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat>
Octree*& mlpack::tree::Octree< MetricType, StatisticType, MatType >::ChildPtr ( const size_t  child)
inline
template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat>
const MatType& mlpack::tree::Octree< MetricType, StatisticType, MatType >::Dataset ( ) const
inline

Return the dataset used by this node.

Definition at line 239 of file octree.hpp.

References mlpack::tree::Octree< MetricType, StatisticType, MatType >::dataset.

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat>
size_t mlpack::tree::Octree< MetricType, StatisticType, MatType >::Descendant ( const size_t  index) const

Return the index (with reference to the dataset) of a particular descendant.

Referenced by mlpack::tree::Octree< MetricType, StatisticType, MatType >::ChildPtr().

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat>
ElemType mlpack::tree::Octree< MetricType, StatisticType, MatType >::FurthestDescendantDistance ( ) const

Return the furthest possible descendant distance.

This returns the maximum distance from the centroid to the edge of the bound and not the empirical quantity which is the actual furthest descendant distance. So the actual furthest descendant distance may be less than what this method returns (but it will never be greater than this).

Referenced by mlpack::tree::Octree< MetricType, StatisticType, MatType >::IsLeaf().

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat>
ElemType mlpack::tree::Octree< MetricType, StatisticType, MatType >::FurthestPointDistance ( ) const

Return the furthest distance to a point held in this node.

If this is not a leaf node, then the distance is 0 because the node holds no points.

Referenced by mlpack::tree::Octree< MetricType, StatisticType, MatType >::IsLeaf().

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat>
template<typename VecType >
size_t mlpack::tree::Octree< MetricType, StatisticType, MatType >::GetFurthestChild ( const VecType &  point,
typename std::enable_if_t< IsVector< VecType >::value > *  = 0 
) const

Return the index of the furthest child node to the given query point.

If this is a leaf node, it will return NumChildren() (invalid index).

Referenced by mlpack::tree::Octree< MetricType, StatisticType, MatType >::IsLeaf(), and mlpack::tree::Octree< MetricType, StatisticType, MatType >::Metric().

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat>
size_t mlpack::tree::Octree< MetricType, StatisticType, MatType >::GetFurthestChild ( const Octree< MetricType, StatisticType, MatType > &  queryNode) const

Return the index of the furthest child node to the given query node.

If it can't decide, it will return NumChildren() (invalid index).

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat>
template<typename VecType >
size_t mlpack::tree::Octree< MetricType, StatisticType, MatType >::GetNearestChild ( const VecType &  point,
typename std::enable_if_t< IsVector< VecType >::value > *  = 0 
) const

Return the index of the nearest child node to the given query point.

If this is a leaf node, it will return NumChildren() (invalid index).

Referenced by mlpack::tree::Octree< MetricType, StatisticType, MatType >::IsLeaf(), and mlpack::tree::Octree< MetricType, StatisticType, MatType >::Metric().

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat>
size_t mlpack::tree::Octree< MetricType, StatisticType, MatType >::GetNearestChild ( const Octree< MetricType, StatisticType, MatType > &  queryNode) const

Return the index of the nearest child node to the given query node.

If it can't decide, it will return NumChildren() (invalid index).

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat>
bool mlpack::tree::Octree< MetricType, StatisticType, MatType >::IsLeaf ( ) const
inline
template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat>
ElemType mlpack::tree::Octree< MetricType, StatisticType, MatType >::MaxDistance ( const Octree< MetricType, StatisticType, MatType > &  other) const

Return the maximum distance to another node.

Referenced by mlpack::tree::Octree< MetricType, StatisticType, MatType >::ChildPtr().

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat>
template<typename VecType >
ElemType mlpack::tree::Octree< MetricType, StatisticType, MatType >::MaxDistance ( const VecType &  point,
typename std::enable_if_t< IsVector< VecType >::value > *  = 0 
) const

Return the maximum distance to the given point.

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat>
MetricType mlpack::tree::Octree< MetricType, StatisticType, MatType >::Metric ( ) const
inline
template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat>
ElemType mlpack::tree::Octree< MetricType, StatisticType, MatType >::MinDistance ( const Octree< MetricType, StatisticType, MatType > &  other) const

Return the minimum distance to another node.

Referenced by mlpack::tree::Octree< MetricType, StatisticType, MatType >::ChildPtr().

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat>
template<typename VecType >
ElemType mlpack::tree::Octree< MetricType, StatisticType, MatType >::MinDistance ( const VecType &  point,
typename std::enable_if_t< IsVector< VecType >::value > *  = 0 
) const

Return the minimum distance to the given point.

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat>
ElemType mlpack::tree::Octree< MetricType, StatisticType, MatType >::MinimumBoundDistance ( ) const

Return the minimum distance from the center of the node to any bound edge.

Referenced by mlpack::tree::Octree< MetricType, StatisticType, MatType >::IsLeaf().

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat>
size_t mlpack::tree::Octree< MetricType, StatisticType, MatType >::NumChildren ( ) const
template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat>
size_t mlpack::tree::Octree< MetricType, StatisticType, MatType >::NumDescendants ( ) const

Return the number of descendants of this node.

Referenced by mlpack::tree::Octree< MetricType, StatisticType, MatType >::ChildPtr().

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat>
size_t mlpack::tree::Octree< MetricType, StatisticType, MatType >::NumPoints ( ) const

Return the number of points in this node (0 if not a leaf).

Referenced by mlpack::tree::Octree< MetricType, StatisticType, MatType >::ChildPtr().

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat>
Octree* mlpack::tree::Octree< MetricType, StatisticType, MatType >::Parent ( ) const
inline

Get the pointer to the parent.

Definition at line 242 of file octree.hpp.

References mlpack::tree::Octree< MetricType, StatisticType, MatType >::parent.

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat>
Octree*& mlpack::tree::Octree< MetricType, StatisticType, MatType >::Parent ( )
inline

Modify the pointer to the parent (be careful!).

Definition at line 244 of file octree.hpp.

References mlpack::tree::Octree< MetricType, StatisticType, MatType >::parent.

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat>
ElemType mlpack::tree::Octree< MetricType, StatisticType, MatType >::ParentDistance ( ) const
inline

Return the distance from the center of this node to the center of the parent node.

Definition at line 317 of file octree.hpp.

References mlpack::tree::Octree< MetricType, StatisticType, MatType >::parentDistance.

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat>
ElemType& mlpack::tree::Octree< MetricType, StatisticType, MatType >::ParentDistance ( )
inline

Modify the distance from the center of this node to the center of the parent node.

Definition at line 320 of file octree.hpp.

References mlpack::tree::Octree< MetricType, StatisticType, MatType >::parentDistance.

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat>
size_t mlpack::tree::Octree< MetricType, StatisticType, MatType >::Point ( const size_t  index) const

Return the index (with reference to the dataset) of a particular point in this node.

If the given index is invalid (i.e. if it is greater than NumPoints()), the indices returned will be invalid.

Referenced by mlpack::tree::Octree< MetricType, StatisticType, MatType >::ChildPtr().

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat>
math::RangeType<ElemType> mlpack::tree::Octree< MetricType, StatisticType, MatType >::RangeDistance ( const Octree< MetricType, StatisticType, MatType > &  other) const

Return the minimum and maximum distance to another node.

Referenced by mlpack::tree::Octree< MetricType, StatisticType, MatType >::ChildPtr().

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat>
template<typename VecType >
math::RangeType<ElemType> mlpack::tree::Octree< MetricType, StatisticType, MatType >::RangeDistance ( const VecType &  point,
typename std::enable_if_t< IsVector< VecType >::value > *  = 0 
) const

Return the minimum and maximum distance to another node.

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat>
template<typename Archive >
void mlpack::tree::Octree< MetricType, StatisticType, MatType >::Serialize ( Archive &  ar,
const unsigned  int 
)
template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat>
void mlpack::tree::Octree< MetricType, StatisticType, MatType >::SplitNode ( const arma::vec &  center,
const double  width,
const size_t  maxLeafSize 
)
private

Split the node, using the given center and the given maximum width of this node.

Parameters
centerCenter of the node.
widthWidth of the current node.
maxLeafSizeMaximum number of points allowed in a leaf.
template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat>
void mlpack::tree::Octree< MetricType, StatisticType, MatType >::SplitNode ( const arma::vec &  center,
const double  width,
std::vector< size_t > &  oldFromNew,
const size_t  maxLeafSize 
)
private

Split the node, using the given center and the given maximum width of this node, and fill the mappings vector.

Parameters
centerCenter of the node.
widthWidth of the current node.
oldFromNewMappings from old to new.
maxLeafSizeMaximum number of points allowed in a leaf.
template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat>
const StatisticType& mlpack::tree::Octree< MetricType, StatisticType, MatType >::Stat ( ) const
inline

Return the statistic object for this node.

Definition at line 252 of file octree.hpp.

References mlpack::tree::Octree< MetricType, StatisticType, MatType >::stat.

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat>
StatisticType& mlpack::tree::Octree< MetricType, StatisticType, MatType >::Stat ( )
inline

Member Data Documentation

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat>
size_t mlpack::tree::Octree< MetricType, StatisticType, MatType >::begin
private

The index of the first point in the dataset contained in this node (and its children).

Definition at line 47 of file octree.hpp.

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat>
bound::HRectBound<MetricType> mlpack::tree::Octree< MetricType, StatisticType, MatType >::bound
private

The minimum bounding rectangle of the points held in the node (and its children).

Definition at line 53 of file octree.hpp.

Referenced by mlpack::tree::Octree< MetricType, StatisticType, MatType >::Bound().

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat>
std::vector<Octree*> mlpack::tree::Octree< MetricType, StatisticType, MatType >::children
private

The children held by this node.

Definition at line 39 of file octree.hpp.

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat>
size_t mlpack::tree::Octree< MetricType, StatisticType, MatType >::count
private

The number of points of the dataset contained in this node (and its children).

Definition at line 50 of file octree.hpp.

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat>
MatType* mlpack::tree::Octree< MetricType, StatisticType, MatType >::dataset
private

The dataset.

Definition at line 55 of file octree.hpp.

Referenced by mlpack::tree::Octree< MetricType, StatisticType, MatType >::Dataset().

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat>
ElemType mlpack::tree::Octree< MetricType, StatisticType, MatType >::furthestDescendantDistance
private

The distance to the furthest descendant, cached to speed things up.

Definition at line 63 of file octree.hpp.

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat>
MetricType mlpack::tree::Octree< MetricType, StatisticType, MatType >::metric
private

An instantiated metric.

Definition at line 65 of file octree.hpp.

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat>
Octree* mlpack::tree::Octree< MetricType, StatisticType, MatType >::parent
private

The parent (NULL if this node is the root).

Definition at line 57 of file octree.hpp.

Referenced by mlpack::tree::Octree< MetricType, StatisticType, MatType >::Parent().

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat>
ElemType mlpack::tree::Octree< MetricType, StatisticType, MatType >::parentDistance
private

The distance from the center of this node to the center of the parent.

Definition at line 61 of file octree.hpp.

Referenced by mlpack::tree::Octree< MetricType, StatisticType, MatType >::ParentDistance().

template<typename MetricType = metric::EuclideanDistance, typename StatisticType = EmptyStatistic, typename MatType = arma::mat>
StatisticType mlpack::tree::Octree< MetricType, StatisticType, MatType >::stat
private

The statistic.

Definition at line 59 of file octree.hpp.

Referenced by mlpack::tree::Octree< MetricType, StatisticType, MatType >::Stat().


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