13 #ifndef MLPACK_CORE_TREE_RECTANGLE_TREE_DISCRETE_HILBERT_VALUE_HPP
14 #define MLPACK_CORE_TREE_RECTANGLE_TREE_DISCRETE_HILBERT_VALUE_HPP
28 template<
typename TreeElemType>
34 typedef typename std::conditional<
sizeof(TreeElemType) * CHAR_BIT <= 32,
36 uint64_t>::type HilbertElemType;
47 template<
typename TreeType>
48 DiscreteHilbertValue(
const TreeType* tree);
57 template<
typename TreeType>
58 DiscreteHilbertValue(
const DiscreteHilbertValue& other,
67 DiscreteHilbertValue(DiscreteHilbertValue&& other);
70 ~DiscreteHilbertValue();
81 template<
typename VecType1,
typename VecType2>
82 static int ComparePoints(
const VecType1& pt1,
const VecType2& pt2,
94 static int CompareValues(
const DiscreteHilbertValue& val1,
95 const DiscreteHilbertValue& val2);
105 int CompareWith(
const DiscreteHilbertValue& val)
const;
116 template<
typename VecType>
117 int CompareWith(
const VecType& pt,
130 template<
typename VecType>
131 int CompareWithCachedPoint(
142 template<
typename TreeType,
typename VecType>
143 size_t InsertPoint(TreeType *node,
152 template<
typename TreeType>
153 void InsertNode(TreeType* node);
162 template<
typename TreeType>
163 void DeletePoint(TreeType* node,
const size_t localIndex);
171 template<
typename TreeType>
172 void RemoveNode(TreeType* node,
const size_t nodeIndex);
180 DiscreteHilbertValue& operator=(
const DiscreteHilbertValue& val);
194 template<
typename TreeType>
195 void UpdateLargestValue(TreeType* node);
206 template<
typename TreeType>
207 void RedistributeHilbertValues(TreeType* parent,
208 const size_t firstSibling,
209 const size_t lastSibling);
216 template<
typename VecType>
217 static arma::Col<HilbertElemType> CalculateValue(
229 static int CompareValues(
const arma::Col<HilbertElemType>& value1,
230 const arma::Col<HilbertElemType>& value2);
233 size_t NumValues()
const {
return numValues; }
235 size_t& NumValues() {
return numValues; }
238 const arma::Mat<HilbertElemType>* LocalHilbertValues()
const
239 {
return localHilbertValues; }
241 arma::Mat<HilbertElemType>*& LocalHilbertValues()
242 {
return localHilbertValues; }
245 bool OwnsLocalHilbertValues()
const {
return ownsLocalHilbertValues; }
247 bool& OwnsLocalHilbertValues() {
return ownsLocalHilbertValues; }
250 const arma::Col<HilbertElemType>* ValueToInsert()
const
251 {
return valueToInsert; }
253 arma::Col<HilbertElemType>* ValueToInsert() {
return valueToInsert; }
256 bool OwnsValueToInsert()
const {
return ownsValueToInsert; }
258 bool& OwnsValueToInsert() {
return ownsValueToInsert; }
261 static constexpr
size_t order =
sizeof(HilbertElemType) * CHAR_BIT;
263 arma::Mat<HilbertElemType>* localHilbertValues;
265 bool ownsLocalHilbertValues;
274 arma::Col<HilbertElemType>* valueToInsert;
276 bool ownsValueToInsert;
279 template<
typename Archive>
280 void Serialize(Archive& ar,
const unsigned int );
287 #include "discrete_hilbert_value_impl.hpp"
289 #endif // MLPACK_CORE_TREE_RECTANGLE_TREE_DISCRETE_HILBERT_VALUE_HPP
The DiscreteHilbertValue class stores Hilbert values for all of the points in a RectangleTree node...
The core includes that mlpack expects; standard C++ includes and Armadillo.
If value == true, then VecType is some sort of Armadillo vector or subview.