14 #ifndef MLPACK_CORE_TREE_HRECTBOUND_HPP
15 #define MLPACK_CORE_TREE_HRECTBOUND_HPP
29 template<
typename MetricType>
32 static const bool Value =
false;
36 template<
int Power,
bool TakeRoot>
52 template<
typename MetricType = metric::LMetric<2, true>,
53 typename ElemType =
double>
58 "HRectBound can only be used with the LMetric<> metric type.");
90 size_t Dim()
const {
return dim; }
109 void Center(arma::Col<ElemType>& center)
const;
123 template<
typename VecType>
139 template<
typename VecType>
164 template<
typename VecType>
166 const VecType& point,
176 template<
typename MatType>
187 template<
typename VecType>
188 bool Contains(
const VecType& point)
const;
218 template<
typename Archive>
219 void Serialize(Archive& ar,
const unsigned int version);
231 template<
typename MetricType,
typename ElemType>
241 #include "hrectbound_impl.hpp"
243 #endif // MLPACK_CORE_TREE_HRECTBOUND_HPP
size_t Dim() const
Gets the dimensionality.
A class to obtain compile-time traits about BoundType classes.
ElemType MinWidth() const
Get the minimum width of the bound.
The core includes that mlpack expects; standard C++ includes and Armadillo.
ElemType Diameter() const
Returns the diameter of the hyperrectangle (that is, the longest diagonal).
bool Contains(const VecType &point) const
Determines if a point is within this bound.
HRectBound & operator|=(const MatType &data)
Expands this region to include new points.
ElemType Overlap(const HRectBound &bound) const
Returns the volume of overlap of this bound and another.
HRectBound operator&(const HRectBound &bound) const
Returns the intersection of this bound and another.
math::RangeType< ElemType > & operator[](const size_t i)
Get the range for a particular dimension.
void Center(arma::Col< ElemType > ¢er) const
Calculates the center of the range, placing it into the given vector.
Hyper-rectangle bound for an L-metric.
HRectBound & operator=(const HRectBound &other)
Same as copy constructor; necessary to prevent memory leaks.
ElemType MaxDistance(const VecType &point, typename boost::enable_if< IsVector< VecType >> *=0) const
Calculates maximum bound-to-point squared distance.
const math::RangeType< ElemType > & operator[](const size_t i) const
Modify the range for a particular dimension. No bounds checking.
Definition of the Range class, which represents a simple range with a lower and upper bound...
ElemType Volume() const
Calculate the volume of the hyperrectangle.
HRectBound & operator&=(const HRectBound &bound)
Intersects this bound with another.
~HRectBound()
Destructor: clean up memory.
static const bool HasTightBounds
If true, then the bounds for each dimension are tight.
void Serialize(Archive &ar, const unsigned int version)
Serialize the bound object.
ElemType MinDistance(const VecType &point, typename boost::enable_if< IsVector< VecType >> *=0) const
Calculates minimum bound-to-point distance.
ElemType & MinWidth()
Modify the minimum width of the bound.
void Clear()
Resets all dimensions to the empty set (so that this bound contains nothing).
math::RangeType< ElemType > RangeDistance(const HRectBound &other) const
Calculates minimum and maximum bound-to-bound distance.
HRectBound()
Empty constructor; creates a bound of dimensionality 0.
If value == true, then VecType is some sort of Armadillo vector or subview.