.TH "mlpack::neighbor::NearestNeighborSort" 3 "Tue Sep 9 2014" "Version 1.0.10" "MLPACK" \" -*- nroff -*- .ad l .nh .SH NAME mlpack::neighbor::NearestNeighborSort \- .PP This class implements the necessary methods for the SortPolicy template parameter of the \fBNeighborSearch\fP class\&. .SH SYNOPSIS .br .PP .SS "Static Public Member Functions" .in +1c .ti -1c .RI "static double \fBBestDistance\fP ()" .br .RI "\fIReturn what should represent the best possible distance with this particular sort policy\&. \fP" .ti -1c .RI "template static double \fBBestNodeToNodeDistance\fP (const TreeType *queryNode, const TreeType *referenceNode)" .br .RI "\fIReturn the best possible distance between two nodes\&. \fP" .ti -1c .RI "template static double \fBBestNodeToNodeDistance\fP (const TreeType *queryNode, const TreeType *referenceNode, const double centerToCenterDistance)" .br .RI "\fIReturn the best possible distance between two nodes, given that the distance between the centers of the two nodes has already been calculated\&. \fP" .ti -1c .RI "template static double \fBBestNodeToNodeDistance\fP (const TreeType *queryNode, const TreeType *referenceNode, const TreeType *referenceChildNode, const double centerToCenterDistance)" .br .RI "\fIReturn 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\&. \fP" .ti -1c .RI "template static double \fBBestPointToNodeDistance\fP (const VecType &queryPoint, const TreeType *referenceNode)" .br .RI "\fIReturn the best possible distance between a node and a point\&. \fP" .ti -1c .RI "template static double \fBBestPointToNodeDistance\fP (const VecType &queryPoint, const TreeType *referenceNode, const double pointToCenterDistance)" .br .RI "\fIReturn 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\&. \fP" .ti -1c .RI "static double \fBCombineBest\fP (const double a, const double b)" .br .RI "\fIReturn the best combination of the two distances\&. \fP" .ti -1c .RI "static double \fBCombineWorst\fP (const double a, const double b)" .br .RI "\fIReturn the worst combination of the two distances\&. \fP" .ti -1c .RI "static bool \fBIsBetter\fP (const double value, const double ref)" .br .RI "\fIReturn whether or not value is 'better' than ref\&. \fP" .ti -1c .RI "static size_t \fBSortDistance\fP (const arma::vec &list, const arma::Col< size_t > &indices, double newDistance)" .br .RI "\fIReturn the index in the vector where the new distance should be inserted, or (size_t() - 1) if it should not be inserted (i\&.e\&. \fP" .ti -1c .RI "static double \fBWorstDistance\fP ()" .br .RI "\fIReturn what should represent the worst possible distance with this particular sort policy\&. \fP" .in -1c .SH "Detailed Description" .PP This class implements the necessary methods for the SortPolicy template parameter of the \fBNeighborSearch\fP class\&. The sorting policy here is that the minimum distance is the best (so, when used with \fBNeighborSearch\fP, the output is nearest neighbors)\&. .PP This class is also meant to serve as a guide to implement a custom SortPolicy\&. All of the methods implemented here must be implemented by any other SortPolicy classes\&. .PP Definition at line 41 of file nearest_neighbor_sort\&.hpp\&. .SH "Member Function Documentation" .PP .SS "static double mlpack::neighbor::NearestNeighborSort::BestDistance ()\fC [inline]\fP, \fC [static]\fP" .PP Return what should represent the best possible distance with this particular sort policy\&. In our case, this should be the minimum possible distance, 0\&.0\&. .PP \fBReturns:\fP .RS 4 0\&.0 .RE .PP .PP Definition at line 149 of file nearest_neighbor_sort\&.hpp\&. .SS "template static double mlpack::neighbor::NearestNeighborSort::BestNodeToNodeDistance (const TreeType *queryNode, const TreeType *referenceNode)\fC [static]\fP" .PP Return the best possible distance between two nodes\&. In our case, this is the minimum distance between the two tree nodes using the given distance function\&. .SS "template static double mlpack::neighbor::NearestNeighborSort::BestNodeToNodeDistance (const TreeType *queryNode, const TreeType *referenceNode, const doublecenterToCenterDistance)\fC [static]\fP" .PP 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)\&. .SS "template static double mlpack::neighbor::NearestNeighborSort::BestNodeToNodeDistance (const TreeType *queryNode, const TreeType *referenceNode, const TreeType *referenceChildNode, const doublecenterToCenterDistance)\fC [static]\fP" .PP 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\&. .PP \fBParameters:\fP .RS 4 \fIqueryNode\fP Query node\&. .br \fIreferenceNode\fP Reference node\&. .br \fIreferenceChildNode\fP Child of reference node which is being inspected\&. .br \fIcenterToCenterDistance\fP Distance between centers of query node and reference node\&. .RE .PP .SS "template static double mlpack::neighbor::NearestNeighborSort::BestPointToNodeDistance (const VecType &queryPoint, const TreeType *referenceNode)\fC [static]\fP" .PP Return the best possible distance between a node and a point\&. In our case, this is the minimum distance between the tree node and the point using the given distance function\&. .SS "template static double mlpack::neighbor::NearestNeighborSort::BestPointToNodeDistance (const VecType &queryPoint, const TreeType *referenceNode, const doublepointToCenterDistance)\fC [static]\fP" .PP 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)\&. .SS "static double mlpack::neighbor::NearestNeighborSort::CombineBest (const doublea, const doubleb)\fC [inline]\fP, \fC [static]\fP" .PP Return the best combination of the two distances\&. .PP Definition at line 154 of file nearest_neighbor_sort\&.hpp\&. .SS "static double mlpack::neighbor::NearestNeighborSort::CombineWorst (const doublea, const doubleb)\fC [inline]\fP, \fC [static]\fP" .PP Return the worst combination of the two distances\&. .PP Definition at line 162 of file nearest_neighbor_sort\&.hpp\&. .SS "static bool mlpack::neighbor::NearestNeighborSort::IsBetter (const doublevalue, const doubleref)\fC [inline]\fP, \fC [static]\fP" .PP Return whether or not value is 'better' than ref\&. In this case, that means that the value is less than the reference\&. .PP \fBParameters:\fP .RS 4 \fIvalue\fP Value to compare .br \fIref\fP Value to compare with .RE .PP \fBReturns:\fP .RS 4 bool indicating whether or not (value < ref)\&. .RE .PP .PP Definition at line 71 of file nearest_neighbor_sort\&.hpp\&. .SS "static size_t mlpack::neighbor::NearestNeighborSort::SortDistance (const arma::vec &list, const arma::Col< size_t > &indices, doublenewDistance)\fC [static]\fP" .PP Return the index in the vector where the new distance should be inserted, or (size_t() - 1) if it should not be inserted (i\&.e\&. if it is not any better than any of the existing points in the list)\&. The list should be sorted such that the best point is the first in the list\&. The actual insertion is not performed\&. .PP \fBParameters:\fP .RS 4 \fIlist\fP Vector of existing distance points, sorted such that the best point is first in the list\&. .br \fInew_distance\fP Distance to try to insert .RE .PP \fBReturns:\fP .RS 4 size_t containing the position to insert into, or (size_t() - 1) if the new distance should not be inserted\&. .RE .PP .SS "static double mlpack::neighbor::NearestNeighborSort::WorstDistance ()\fC [inline]\fP, \fC [static]\fP" .PP Return what should represent the worst possible distance with this particular sort policy\&. In our case, this should be the maximum possible distance, DBL_MAX\&. .PP \fBReturns:\fP .RS 4 DBL_MAX .RE .PP .PP Definition at line 140 of file nearest_neighbor_sort\&.hpp\&. .SH "Author" .PP Generated automatically by Doxygen for MLPACK from the source code\&.