Class NearestNeighbors
Defined in File DimRedTools.hpp
Inheritance Relationships
Derived Types
public dim_red::Bruteforce
(Class Bruteforce)public dim_red::CompressedCoverTree
(Class CompressedCoverTree)public dim_red::CoverTree
(Class CoverTree)
Class Documentation
-
class NearestNeighbors
An abstract class for data structures that implement nearest neighbor search.
Subclassed by dim_red::Bruteforce, dim_red::CompressedCoverTree, dim_red::CoverTree
Public Functions
-
inline virtual ~NearestNeighbors()
-
virtual std::pair<Vector, IntVector> query(const Eigen::Ref<const Vector> &point, int k, bool sort_results = true) const = 0
Retrieves the k-nearest neighbors for the query point.
- Parameters
point – the query point.
k – the number of nearest neighbors to search for.
sort_results – if true, the neighbors will be sorted by distances in ascending order.
- Returns
the k-nearest neighbors: {distances, indices}.
-
virtual std::pair<Vector, IntVector> queryRadius(const Eigen::Ref<const Vector> &point, double radius, bool sort_results = false) const = 0
Retrieves all the neighbors of the query point in the specified radius.
- Parameters
point – the query point.
radius – the search radius.
sort_results – if true, the neighbors will be sorted by distances in ascending order.
- Returns
the nearest neighbors in the specified radius: {distances, indices}.
-
inline virtual ~NearestNeighbors()