mlpack
r_plus_plus_tree_auxiliary_information_impl.hpp
Go to the documentation of this file.
1 
14 #ifndef MLPACK_CORE_TREE_RECTANGLE_TREE_RPP_TREE_AUXILIARY_INFO_IMPL_HPP
15 #define MLPACK_CORE_TREE_RECTANGLE_TREE_RPP_TREE_AUXILIARY_INFO_IMPL_HPP
16 
18 
19 namespace mlpack {
20 namespace tree {
21 
22 template<typename TreeType>
25  outerBound(0)
26 { /* Nothing to do. */ }
27 
28 template<typename TreeType>
30 RPlusPlusTreeAuxiliaryInformation(const TreeType* tree) :
31  outerBound(tree->Parent() ?
32  tree->Parent()->AuxiliaryInfo().OuterBound() :
33  tree->Bound().Dim())
34 {
35  // Initialize the maximum bounding rectangle if the node is the root
36  if (!tree->Parent())
37  {
38  for (size_t k = 0; k < outerBound.Dim(); ++k)
39  {
40  outerBound[k].Lo() = std::numeric_limits<ElemType>::lowest();
41  outerBound[k].Hi() = std::numeric_limits<ElemType>::max();
42  }
43  }
44 }
45 
46 template<typename TreeType>
50  TreeType* /* tree */,
51  bool /* deepCopy */) :
52  outerBound(other.OuterBound())
53 { /* Nothing to do. */ }
54 
55 template<typename TreeType>
58  outerBound(std::move(other.outerBound))
59 { /* Nothing to do. */ }
60 
61 template<typename TreeType>
63  TreeType* /* node */, const size_t /* point */)
64 {
65  return false;
66 }
67 
68 template<typename TreeType>
70  TreeType* /* node */,
71  TreeType* /* nodeToInsert */,
72  bool /* insertionLevel */)
73 {
74  assert(false);
75  return false;
76 }
77 
78 template<typename TreeType>
80  TreeType* /* node */, const size_t /* localIndex */)
81 {
82  return false;
83 }
84 
85 template<typename TreeType>
87  TreeType* /* node */, const size_t /* nodeIndex */)
88 {
89  return false;
90 }
91 
92 template<typename TreeType>
94  TreeType* /* node */)
95 {
96  return false;
97 }
98 
99 template<typename TreeType>
101  TreeType* treeOne,
102  TreeType* treeTwo,
103  const size_t axis,
104  const typename TreeType::ElemType cut)
105 {
107  Bound& treeOneBound = treeOne->AuxiliaryInfo().OuterBound();
108  Bound& treeTwoBound = treeTwo->AuxiliaryInfo().OuterBound();
109 
110  // Copy the maximum bounding rectangle.
111  treeOneBound = outerBound;
112  treeTwoBound = outerBound;
113 
114  // Set proper limits.
115  treeOneBound[axis].Hi() = cut;
116  treeTwoBound[axis].Lo() = cut;
117 }
118 
119 template<typename TreeType>
121 { /* Nothing to do */ }
122 
126 template<typename TreeType>
127 template<typename Archive>
129  Archive& ar,
130  const uint32_t /* version */)
131 {
132  ar(CEREAL_NVP(outerBound));
133 }
134 
135 } // namespace tree
136 } // namespace mlpack
137 
138 #endif // MLPACK_CORE_TREE_RECTANGLE_TREE_RPP_TREE_AUXILIARY_INFO_IMPL_HPP
bool HandleNodeRemoval(TreeType *, const size_t)
Some tree types require to save some properties at the deletion process.
Definition: r_plus_plus_tree_auxiliary_information_impl.hpp:86
bool HandlePointInsertion(TreeType *, const size_t)
Some tree types require to save some properties at the insertion process.
Definition: r_plus_plus_tree_auxiliary_information_impl.hpp:62
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: cv.hpp:1
bool HandleNodeInsertion(TreeType *, TreeType *, bool)
Some tree types require to save some properties at the insertion process.
Definition: r_plus_plus_tree_auxiliary_information_impl.hpp:69
void NullifyData()
Nullify the auxiliary information in order to prevent an invalid free.
Definition: r_plus_plus_tree_auxiliary_information_impl.hpp:120
void serialize(Archive &, const uint32_t)
Serialize the information.
Definition: r_plus_plus_tree_auxiliary_information_impl.hpp:128
Definition: pointer_wrapper.hpp:23
Definition: r_plus_plus_tree_auxiliary_information.hpp:24
void SplitAuxiliaryInfo(TreeType *treeOne, TreeType *treeTwo, const size_t axis, const ElemType cut)
The R++ tree requires to split the maximum bounding rectangle of a node that is being split...
Definition: r_plus_plus_tree_auxiliary_information_impl.hpp:100
bool UpdateAuxiliaryInfo(TreeType *)
Some tree types require to propagate the information upward.
Definition: r_plus_plus_tree_auxiliary_information_impl.hpp:93
size_t Dim() const
Gets the dimensionality.
Definition: hrectbound.hpp:96
BoundType & OuterBound()
Return the maximum bounding rectangle.
Definition: r_plus_plus_tree_auxiliary_information.hpp:146
RPlusPlusTreeAuxiliaryInformation()
Construct the auxiliary information object.
Definition: r_plus_plus_tree_auxiliary_information_impl.hpp:24
bool HandlePointDeletion(TreeType *, const size_t)
Some tree types require to save some properties at the deletion process.
Definition: r_plus_plus_tree_auxiliary_information_impl.hpp:79