This class implements the necessary methods for the SortPolicy template parameter of the NeighborSearch class. More...
Static Public Member Functions | |
static double | BestDistance () |
Return what should represent the best possible distance with this particular sort policy. More... | |
template < typename TreeType > | |
static double | BestNodeToNodeDistance (const TreeType *queryNode, const TreeType *referenceNode) |
Return the best possible distance between two nodes. More... | |
template < typename TreeType > | |
static double | BestNodeToNodeDistance (const TreeType *queryNode, const TreeType *referenceNode, const double centerToCenterDistance) |
Return the best possible distance between two nodes, given that the distance between the centers of the two nodes has already been calculated. More... | |
template < typename TreeType > | |
static double | BestNodeToNodeDistance (const TreeType *queryNode, const TreeType *referenceNode, const TreeType *referenceChildNode, const double centerToCenterDistance) |
Return the best possible distance between the query node and the reference child node given the base case distance between the query node and the reference node. More... | |
template < typename VecType , typename TreeType > | |
static double | BestPointToNodeDistance (const VecType &queryPoint, const TreeType *referenceNode) |
Return the best possible distance between a node and a point. More... | |
template < typename VecType , typename TreeType > | |
static double | BestPointToNodeDistance (const VecType &queryPoint, const TreeType *referenceNode, const double pointToCenterDistance) |
Return the best possible distance between a point and a node, given that the distance between the point and the center of the node has already been calculated. More... | |
static double | CombineBest (const double a, const double b) |
Return the best combination of the two distances. More... | |
static double | CombineWorst (const double a, const double b) |
Return the worst combination of the two distances. More... | |
static double | ConvertToDistance (const double score) |
Convert the given score back to a distance. More... | |
static double | ConvertToScore (const double distance) |
Convert the given distance to a score. More... | |
template < typename VecType , typename TreeType > | |
static size_t | GetBestChild (const VecType &queryPoint, TreeType &referenceNode) |
Return the best child according to this sort policy. More... | |
template < typename TreeType > | |
static size_t | GetBestChild (const TreeType &queryNode, TreeType &referenceNode) |
Return the best child according to this sort policy. More... | |
static bool | IsBetter (const double value, const double ref) |
Return whether or not value is "better" than ref. More... | |
static double | Relax (const double value, const double epsilon) |
Return the given value relaxed. More... | |
static double | WorstDistance () |
Return what should represent the worst possible distance with this particular sort policy. More... | |
This class implements the necessary methods for the SortPolicy template parameter of the NeighborSearch class.
The sorting policy here is that the minimum distance is the best (so, when used with NeighborSearch, the output is furthest neighbors).
Definition at line 27 of file furthest_neighbor_sort.hpp.
|
inlinestatic |
Return what should represent the best possible distance with this particular sort policy.
In our case, this should be the maximum possible distance, DBL_MAX.
Definition at line 138 of file furthest_neighbor_sort.hpp.
|
static |
Return the best possible distance between two nodes.
In our case, this is the maximum distance between the two tree nodes using the given distance function.
Referenced by FurthestNS::IsBetter().
|
static |
Return the best possible distance between two nodes, given that the distance between the centers of the two nodes has already been calculated.
This is used in conjunction with trees that have self-children (like cover trees).
|
static |
Return the best possible distance between the query node and the reference child node given the base case distance between the query node and the reference node.
TreeType::ParentDistance() must be implemented to use this.
queryNode | Query node. |
referenceNode | Reference node. |
referenceChildNode | Child of reference node which is being inspected. |
centerToCenterDistance | Distance between centers of query node and reference node. |
|
static |
Return the best possible distance between a node and a point.
In our case, this is the maximum distance between the tree node and the point using the given distance function.
Referenced by FurthestNS::IsBetter().
|
static |
Return the best possible distance between a point and a node, given that the distance between the point and the center of the node has already been calculated.
This is used in conjunction with trees that have self-children (like cover trees).
|
inlinestatic |
Return the best combination of the two distances.
Definition at line 143 of file furthest_neighbor_sort.hpp.
|
inlinestatic |
Return the worst combination of the two distances.
Definition at line 153 of file furthest_neighbor_sort.hpp.
|
inlinestatic |
Convert the given score back to a distance.
This is the inverse of the operation of converting a distance to a score, and again, for furthest neighbor search, corresponds to inverting the value.
Definition at line 193 of file furthest_neighbor_sort.hpp.
References FurthestNS::ConvertToScore().
|
inlinestatic |
Convert the given distance to a score.
Lower scores are better, but for furthest neighbor search, larger distances are better. Therefore we must invert the given distance.
Definition at line 178 of file furthest_neighbor_sort.hpp.
Referenced by FurthestNS::ConvertToDistance().
|
inlinestatic |
Return the best child according to this sort policy.
In this case it will return the one with the maximum distance.
Definition at line 107 of file furthest_neighbor_sort.hpp.
|
inlinestatic |
Return the best child according to this sort policy.
In this case it will return the one with the maximum distance.
Definition at line 117 of file furthest_neighbor_sort.hpp.
|
inlinestatic |
Return whether or not value is "better" than ref.
In this case, that means that the value is greater than or equal to the reference.
value | Value to compare |
ref | Value to compare with |
Definition at line 39 of file furthest_neighbor_sort.hpp.
References FurthestNS::BestNodeToNodeDistance(), and FurthestNS::BestPointToNodeDistance().
|
inlinestatic |
Return the given value relaxed.
value | Value to relax. |
epsilon | Relative error (non-negative). |
Definition at line 164 of file furthest_neighbor_sort.hpp.
|
inlinestatic |
Return what should represent the worst possible distance with this particular sort policy.
In our case, this should be the minimum possible distance, 0.
Definition at line 129 of file furthest_neighbor_sort.hpp.