Package elki.database.query.knn
Class LinearScanEuclideanKNNByObject<O extends NumberVector>
- java.lang.Object
-
- elki.database.query.knn.LinearScanPrimitiveKNNByObject<O>
-
- elki.database.query.knn.LinearScanEuclideanKNNByObject<O>
-
- Type Parameters:
O
- relation object type
- All Implemented Interfaces:
KNNSearcher<O>
,LinearScanQuery
public class LinearScanEuclideanKNNByObject<O extends NumberVector> extends LinearScanPrimitiveKNNByObject<O>
Instance of this query for a particular database.This is a subtle optimization: for primitive queries, it is clearly faster to retrieve the query object from the relation only once, and to first find the nearest neighbors with squared Euclidean distances, then only compute the square root for the results.
- Since:
- 0.7.0
- Author:
- Erich Schubert
-
-
Field Summary
-
Fields inherited from class elki.database.query.knn.LinearScanPrimitiveKNNByObject
relation
-
-
Constructor Summary
Constructors Constructor Description LinearScanEuclideanKNNByObject(PrimitiveDistanceQuery<O> distanceQuery)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description KNNList
getKNN(O obj, int k)
Get the k nearest neighbors for a particular object.
-
-
-
Constructor Detail
-
LinearScanEuclideanKNNByObject
public LinearScanEuclideanKNNByObject(PrimitiveDistanceQuery<O> distanceQuery)
Constructor.- Parameters:
distanceQuery
- Distance function to use
-
-
Method Detail
-
getKNN
public KNNList getKNN(O obj, int k)
Description copied from interface:KNNSearcher
Get the k nearest neighbors for a particular object.- Specified by:
getKNN
in interfaceKNNSearcher<O extends NumberVector>
- Overrides:
getKNN
in classLinearScanPrimitiveKNNByObject<O extends NumberVector>
- Parameters:
obj
- query objectk
- Number of neighbors requested- Returns:
- neighbors
-
-