math::RangeType<typename CoverTree<MetricType, StatisticType, MatType, RootPointPolicy>::ElemType> CoverTree<MetricType, StatisticType, MatType, RootPointPolicy>:: RangeDistance(const CoverTree& other, const ElemType distance) const { math::RangeType<ElemType> result; result.Lo() = distance - furthestDescendantDistance - other.FurthestDescendantDistance(); result.Hi() = distance + furthestDescendantDistance + other.FurthestDescendantDistance(); return result; }
math::RangeType<typename CoverTree<MetricType, StatisticType, MatType, RootPointPolicy>::ElemType> CoverTree<MetricType, StatisticType, MatType, RootPointPolicy>:: RangeDistance(const CoverTree& other) const { const ElemType distance = metric->Evaluate(dataset->col(point), other.Dataset().col(other.Point())); math::RangeType<ElemType> result; result.Lo() = distance - furthestDescendantDistance - other.FurthestDescendantDistance(); result.Hi() = distance + furthestDescendantDistance + other.FurthestDescendantDistance(); return result; }
typename CoverTree<MetricType, StatisticType, MatType, RootPointPolicy>::ElemType CoverTree<MetricType, StatisticType, MatType, RootPointPolicy>:: MaxDistance(const CoverTree& other) const { return metric->Evaluate(dataset->col(point), other.Dataset().col(other.Point())) + furthestDescendantDistance + other.FurthestDescendantDistance(); }
typename CoverTree<MetricType, StatisticType, MatType, RootPointPolicy>::ElemType CoverTree<MetricType, StatisticType, MatType, RootPointPolicy>:: MaxDistance(const CoverTree& other, const ElemType distance) const { // We already have the distance as evaluated by the metric. return distance + furthestDescendantDistance + other.FurthestDescendantDistance(); }
typename CoverTree<MetricType, StatisticType, MatType, RootPointPolicy>::ElemType CoverTree<MetricType, StatisticType, MatType, RootPointPolicy>:: MinDistance(const CoverTree& other) const { // Every cover tree node will contain points up to base^(scale + 1) away. return std::max(metric->Evaluate(dataset->col(point), other.Dataset().col(other.Point())) - furthestDescendantDistance - other.FurthestDescendantDistance(), 0.0); }