|
knncolle
Collection of KNN methods in C++
|
Perform a brute-force nearest neighbor search. More...
#include <Bruteforce.hpp>


Public Member Functions | |
| BruteforceBuilder (std::shared_ptr< const DistanceMetric_ > metric) | |
| Prebuilt< Index_, Data_, Distance_ > * | build_raw (const Matrix_ &data) const |
Public Member Functions inherited from knncolle::Builder< Index_, Data_, Distance_, Matrix_ > | |
| std::shared_ptr< Prebuilt< Index_, Data_, Distance_ > > | build_shared (const Matrix_ &data) const |
| std::unique_ptr< Prebuilt< Index_, Data_, Distance_ > > | build_unique (const Matrix_ &data) const |
Perform a brute-force nearest neighbor search.
The brute-force search computes all pairwise distances between data and query points to identify nearest neighbors of the latter. It has quadratic complexity and is theoretically the worst-performing method; however, it has effectively no overhead from constructing or querying indexing structures, potentially making it faster in cases where indexing provides little benefit (e.g., few data points, high dimensionality).
| Index_ | Integer type for the indices. |
| Data_ | Numeric type for the input and query data. |
| Distance_ | Floating point type for the distances. |
| Matrix_ | Class of the input data matrix. This should satisfy the Matrix interface. |
| DistanceMetric_ | Class implementing the distance metric calculation. This should satisfy the DistanceMetric interface. |
|
inline |
| metric | Pointer to a distance metric instance, e.g., EuclideanDistance. |
|
inlinevirtual |
Creates a BruteforcePrebuilt instance.
Implements knncolle::Builder< Index_, Data_, Distance_, Matrix_ >.