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(
96 static int CompareValues(
const DiscreteHilbertValue& val1,
97 const DiscreteHilbertValue& val2);
107 int CompareWith(
const DiscreteHilbertValue& val)
const;
118 template<
typename VecType>
133 template<
typename VecType>
134 int CompareWithCachedPoint(
145 template<
typename TreeType,
typename VecType>
146 size_t InsertPoint(TreeType *node,
155 template<
typename TreeType>
156 void InsertNode(TreeType* node);
165 template<
typename TreeType>
166 void DeletePoint(TreeType* node,
const size_t localIndex);
174 template<
typename TreeType>
175 void RemoveNode(TreeType* node,
const size_t nodeIndex);
183 DiscreteHilbertValue& operator=(
const DiscreteHilbertValue& other);
191 DiscreteHilbertValue& operator=(DiscreteHilbertValue&& other);
205 template<
typename TreeType>
206 void UpdateLargestValue(TreeType* node);
217 template<
typename TreeType>
218 void RedistributeHilbertValues(TreeType* parent,
219 const size_t firstSibling,
220 const size_t lastSibling);
227 template<
typename VecType>
228 static arma::Col<HilbertElemType> CalculateValue(
240 static int CompareValues(
const arma::Col<HilbertElemType>& value1,
241 const arma::Col<HilbertElemType>& value2);
244 size_t NumValues()
const {
return numValues; }
246 size_t& NumValues() {
return numValues; }
249 const arma::Mat<HilbertElemType>* LocalHilbertValues()
const 250 {
return localHilbertValues; }
252 arma::Mat<HilbertElemType>*& LocalHilbertValues()
253 {
return localHilbertValues; }
256 bool OwnsLocalHilbertValues()
const {
return ownsLocalHilbertValues; }
258 bool& OwnsLocalHilbertValues() {
return ownsLocalHilbertValues; }
261 const arma::Col<HilbertElemType>* ValueToInsert()
const 262 {
return valueToInsert; }
264 arma::Col<HilbertElemType>* ValueToInsert() {
return valueToInsert; }
267 bool OwnsValueToInsert()
const {
return ownsValueToInsert; }
269 bool& OwnsValueToInsert() {
return ownsValueToInsert; }
272 static constexpr
size_t order =
sizeof(HilbertElemType) * CHAR_BIT;
274 arma::Mat<HilbertElemType>* localHilbertValues;
276 bool ownsLocalHilbertValues;
285 arma::Col<HilbertElemType>* valueToInsert;
287 bool ownsValueToInsert;
290 template<
typename Archive>
291 void serialize(Archive& ar,
const uint32_t );
298 #include "discrete_hilbert_value_impl.hpp" 300 #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...
typename enable_if< B, T >::type enable_if_t
Linear algebra utility functions, generally performed on matrices or vectors.
The core includes that mlpack expects; standard C++ includes and Armadillo.
If value == true, then VecType is some sort of Armadillo vector or subview.