Package elki.database.query.knn
Class LinearScanPrimitiveKNNByObject<O>
- java.lang.Object
-
- elki.database.query.knn.LinearScanPrimitiveKNNByObject<O>
-
- Type Parameters:
O
- relation object type
- All Implemented Interfaces:
KNNSearcher<O>
,LinearScanQuery
- Direct Known Subclasses:
LinearScanEuclideanKNNByObject
public class LinearScanPrimitiveKNNByObject<O> extends java.lang.Object implements KNNSearcher<O>, LinearScanQuery
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!
- Since:
- 0.4.0
- Author:
- Erich Schubert
-
-
Constructor Summary
Constructors Constructor Description LinearScanPrimitiveKNNByObject(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.
-
-
-
Field Detail
-
rawdist
private PrimitiveDistance<? super O> rawdist
Unboxed distance function.
-
-
Constructor Detail
-
LinearScanPrimitiveKNNByObject
public LinearScanPrimitiveKNNByObject(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>
- Parameters:
obj
- query objectk
- Number of neighbors requested- Returns:
- neighbors
-
-