mlpack
Functions
rectangle_tree_test.cpp File Reference
#include <mlpack/core.hpp>
#include <mlpack/core/tree/tree_traits.hpp>
#include <mlpack/core/tree/rectangle_tree.hpp>
#include <mlpack/methods/neighbor_search/neighbor_search.hpp>
#include "catch.hpp"
#include "test_catch_tools.hpp"
Include dependency graph for rectangle_tree_test.cpp:

Functions

 TEST_CASE ("RectangleTreeTraitsTest", "[RectangleTreeTraitsTest]")
 
 TEST_CASE ("RectangleTreeConstructionCountTest", "[RectangleTreeTraitsTest]")
 
template<typename TreeType >
std::vector< arma::vec * > GetAllPointsInTree (const TreeType &tree)
 A function to return a std::vector containing pointers to each point in the tree. More...
 
 TEST_CASE ("RectangleTreeConstructionRepeatTest", "[RectangleTreeTraitsTest]")
 
template<typename TreeType >
void CheckContainment (const TreeType &tree)
 A function to check that each non-leaf node fully encloses its child nodes and that each leaf node encloses its points. More...
 
template<typename TreeType >
void CheckExactContainment (const TreeType &tree)
 A function to check that containment is as tight as possible.
 
template<typename TreeType >
void CheckHierarchy (const TreeType &tree)
 A function to check that parents and children are set correctly.
 
 TEST_CASE ("RectangleTreeContainmentTest", "[RectangleTreeTraitsTest]")
 
template<typename TreeType >
void CheckFills (const TreeType &tree)
 A function to check that each of the fill requirements is met. More...
 
 TEST_CASE ("CheckMinAndMaxFills", "[RectangleTreeTraitsTest]")
 
template<typename TreeType >
int GetMaxLevel (const TreeType &tree)
 A function to get the height of this tree. More...
 
template<typename TreeType >
int GetMinLevel (const TreeType &tree)
 A function to get the "shortest height" of this tree. More...
 
template<typename TreeType >
size_t CheckNumDescendants (const TreeType &tree)
 A function to check that numDescendants values are set correctly.
 
 TEST_CASE ("TreeBalance", "[RectangleTreeTraitsTest]")
 
 TEST_CASE ("PointDeletion", "[RectangleTreeTraitsTest]")
 
 TEST_CASE ("PointDynamicAdd", "[RectangleTreeTraitsTest]")
 
 TEST_CASE ("SingleTreeTraverserTest", "[RectangleTreeTraitsTest]")
 
 TEST_CASE ("XTreeTraverserTest", "[RectangleTreeTraitsTest]")
 
 TEST_CASE ("HilbertRTreeTraverserTest", "[RectangleTreeTraitsTest]")
 
template<typename TreeType >
void CheckHilbertOrdering (const TreeType &tree)
 
 TEST_CASE ("HilbertRTreeOrderingTest", "[RectangleTreeTraitsTest]")
 
template<typename TreeType >
void CheckDiscreteHilbertValueSync (const TreeType &tree)
 
 TEST_CASE ("DiscreteHilbertValueSyncTest", "[RectangleTreeTraitsTest]")
 
 TEST_CASE ("DiscreteHilbertValueTest", "[RectangleTreeTraitsTest]")
 
template<typename TreeType >
void CheckHilbertValue (const TreeType &tree)
 
 TEST_CASE ("HilbertRTeeCopyConstructorTest", "[RectangleTreeTraitsTest]")
 
 TEST_CASE ("HilbertRTeeMoveConstructorTest", "[RectangleTreeTraitsTest]")
 
template<typename TreeType >
void CheckOverlap (const TreeType &tree)
 
 TEST_CASE ("RPlusTreeOverlapTest", "[RectangleTreeTraitsTest]")
 
 TEST_CASE ("RPlusTreeTraverserTest", "[RectangleTreeTraitsTest]")
 
template<typename TreeType >
void CheckRPlusPlusTreeBound (const TreeType &tree)
 
 TEST_CASE ("RPlusPlusTreeBoundTest", "[RectangleTreeTraitsTest]")
 
 TEST_CASE ("RPlusPlusTreeTraverserTest", "[RectangleTreeTraitsTest]")
 
 TEST_CASE ("RTreeSplitTest", "[RectangleTreeTraitsTest]")
 
 TEST_CASE ("RStarTreeSplitTest", "[RectangleTreeTraitsTest]")
 
 TEST_CASE ("RectangleTreeMoveDatasetTest", "[RectangleTreeTraitsTest]")
 

Detailed Description

Author
Andrew Wells

Tests for the RectangleTree class. This should ensure that the class works correctly and that subsequent changes don't break anything. Because it's only used to test the trees, it is slow.

mlpack is free software; you may redistribute it and/or modify it under the terms of the 3-clause BSD license. You should have received a copy of the 3-clause BSD license along with mlpack. If not, see http://www.opensource.org/licenses/BSD-3-Clause for more information.

Function Documentation

◆ CheckContainment()

template<typename TreeType >
void CheckContainment ( const TreeType &  tree)

A function to check that each non-leaf node fully encloses its child nodes and that each leaf node encloses its points.

It recurses so that it checks each node under (and including) this one.

Parameters
treeThe tree to check.

◆ CheckFills()

template<typename TreeType >
void CheckFills ( const TreeType &  tree)

A function to check that each of the fill requirements is met.

For a non-leaf node:

MinNumChildren() <= NumChildren() <= MaxNumChildren() For a leaf node: MinLeafSize() <= Count() <= MaxLeafSize

It recurses so that it checks each node under (and including) this one.

Parameters
treeThe tree to check.

◆ GetAllPointsInTree()

template<typename TreeType >
std::vector<arma::vec*> GetAllPointsInTree ( const TreeType &  tree)

A function to return a std::vector containing pointers to each point in the tree.

Parameters
treeThe tree that we want to extract all of the points from.
Returns
A vector containing pointers to each point in this tree.

◆ GetMaxLevel()

template<typename TreeType >
int GetMaxLevel ( const TreeType &  tree)

A function to get the height of this tree.

Though it should equal tree.TreeDepth(), we ensure that every leaf node is on the same level by doing it this way.

Parameters
treeThe tree for which we want the height.
Returns
The height of this tree.

◆ GetMinLevel()

template<typename TreeType >
int GetMinLevel ( const TreeType &  tree)

A function to get the "shortest height" of this tree.

Though it should equal tree.TreeDepth(), we ensure that every leaf node is on the same level by doing it this way.

Parameters
treeThe tree for which we want the height.
Returns
The "shortest height" of the tree.