knncolle
Collection of KNN methods in C++
Loading...
Searching...
No Matches
knncolle::BruteforceBuilder< Index_, Data_, Distance_, Matrix_, DistanceMetric_ > Class Template Referencefinal

Perform a brute-force nearest neighbor search. More...

#include <Bruteforce.hpp>

Inheritance diagram for knncolle::BruteforceBuilder< Index_, Data_, Distance_, Matrix_, DistanceMetric_ >:
Collaboration diagram for knncolle::BruteforceBuilder< Index_, Data_, Distance_, Matrix_, DistanceMetric_ >:

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
 

Detailed Description

template<typename Index_, typename Data_, typename Distance_, class Matrix_ = Matrix<Index_, Data_>, class DistanceMetric_ = DistanceMetric<Data_, Distance_>>
class knncolle::BruteforceBuilder< Index_, Data_, Distance_, Matrix_, DistanceMetric_ >

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).

Template Parameters
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.

Constructor & Destructor Documentation

◆ BruteforceBuilder()

template<typename Index_ , typename Data_ , typename Distance_ , class Matrix_ = Matrix<Index_, Data_>, class DistanceMetric_ = DistanceMetric<Data_, Distance_>>
knncolle::BruteforceBuilder< Index_, Data_, Distance_, Matrix_, DistanceMetric_ >::BruteforceBuilder ( std::shared_ptr< const DistanceMetric_ > metric)
inline
Parameters
metricPointer to a distance metric instance, e.g., EuclideanDistance.

Member Function Documentation

◆ build_raw()

template<typename Index_ , typename Data_ , typename Distance_ , class Matrix_ = Matrix<Index_, Data_>, class DistanceMetric_ = DistanceMetric<Data_, Distance_>>
Prebuilt< Index_, Data_, Distance_ > * knncolle::BruteforceBuilder< Index_, Data_, Distance_, Matrix_, DistanceMetric_ >::build_raw ( const Matrix_ & data) const
inlinevirtual

The documentation for this class was generated from the following file: