24 #ifndef __MLPACK_CORE_TREE_HRECTBOUND_HPP
25 #define __MLPACK_CORE_TREE_HRECTBOUND_HPP
43 template<
int Power = 2,
bool TakeRoot = true>
88 void Centroid(arma::vec& centroid)
const;
95 template<
typename VecType>
110 template<
typename VecType>
134 template<
typename VecType>
144 template<
typename MatType>
155 template<
typename VecType>
156 bool Contains(
const VecType& point)
const;
185 #include "hrectbound_impl.hpp"
187 #endif // __MLPACK_CORE_TREE_HRECTBOUND_HPP
HRectBound & operator=(const HRectBound &other)
Same as copy constructor; necessary to prevent memory leaks.
std::string ToString() const
Returns a string representation of this object.
const math::Range & operator[](const size_t i) const
Modify the range for a particular dimension. No bounds checking.
Hyper-rectangle bound for an L-metric.
metric::LMetric< Power, TakeRoot > MetricType
This is the metric type that this bound is using.
HRectBound()
Empty constructor; creates a bound of dimensionality 0.
HRectBound & operator|=(const MatType &data)
Expands this region to include new points.
size_t dim
The dimensionality of the bound.
math::Range * bounds
The bounds for each dimension.
The L_p metric for arbitrary integer p, with an option to take the root.
static MetricType Metric()
Return the metric associated with this bound.
math::Range RangeDistance(const HRectBound &other) const
Calculates minimum and maximum bound-to-bound distance.
void Clear()
Resets all dimensions to the empty set (so that this bound contains nothing).
double Diameter() const
Returns the diameter of the hyperrectangle (that is, the longest diagonal).
~HRectBound()
Destructor: clean up memory.
Definition of the Range class, which represents a simple range with a lower and upper bound...
bool Contains(const VecType &point) const
Determines if a point is within this bound.
size_t Dim() const
Gets the dimensionality.
void Centroid(arma::vec ¢roid) const
Calculates the centroid of the range, placing it into the given vector.
double MaxDistance(const VecType &point) const
Calculates maximum bound-to-point squared distance.
math::Range & operator[](const size_t i)
Get the range for a particular dimension. No bounds checking.
double MinDistance(const VecType &point) const
Calculates minimum bound-to-point distance.
Simple real-valued range.