public class LinearScanEuclideanDistanceKNNQuery<O extends NumberVector> extends LinearScanPrimitiveDistanceKNNQuery<O> implements LinearScanQuery
distanceQuery
HINT_BULK, HINT_EXACT, HINT_HEAVY_USE, HINT_NO_CACHE, HINT_OPTIMIZED_ONLY, HINT_SINGLE
Constructor and Description |
---|
LinearScanEuclideanDistanceKNNQuery(PrimitiveDistanceQuery<O> distanceQuery)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
java.util.List<KNNList> |
getKNNForBulkDBIDs(ArrayDBIDs ids,
int k)
Bulk query method
|
KNNList |
getKNNForDBID(DBIDRef id,
int k)
Get the k nearest neighbors for a particular id.
|
KNNList |
getKNNForObject(O obj,
int k)
Get the k nearest neighbors for a particular id.
|
private KNNHeap |
linearScan(Relation<? extends O> relation,
DBIDIter iter,
O obj,
KNNHeap heap)
Main loop of the linear scan.
|
protected void |
linearScanBatchKNN(java.util.List<O> objs,
java.util.List<KNNHeap> heaps)
Perform a linear scan batch kNN for primitive distance functions.
|
getRelation
public LinearScanEuclideanDistanceKNNQuery(PrimitiveDistanceQuery<O> distanceQuery)
distanceQuery
- Distance function to usepublic KNNList getKNNForDBID(DBIDRef id, int k)
KNNQuery
getKNNForDBID
in interface KNNQuery<O extends NumberVector>
getKNNForDBID
in class LinearScanPrimitiveDistanceKNNQuery<O extends NumberVector>
id
- query object IDk
- Number of neighbors requestedpublic KNNList getKNNForObject(O obj, int k)
KNNQuery
getKNNForObject
in interface KNNQuery<O extends NumberVector>
getKNNForObject
in class LinearScanPrimitiveDistanceKNNQuery<O extends NumberVector>
obj
- Query objectk
- Number of neighbors requestedprivate KNNHeap linearScan(Relation<? extends O> relation, DBIDIter iter, O obj, KNNHeap heap)
relation
- Data relationiter
- ID iteratorobj
- Query objectheap
- Output heappublic java.util.List<KNNList> getKNNForBulkDBIDs(ArrayDBIDs ids, int k)
KNNQuery
getKNNForBulkDBIDs
in interface KNNQuery<O extends NumberVector>
getKNNForBulkDBIDs
in class LinearScanPrimitiveDistanceKNNQuery<O extends NumberVector>
ids
- query object IDsk
- Number of neighbors requestedprotected void linearScanBatchKNN(java.util.List<O> objs, java.util.List<KNNHeap> heaps)
linearScanBatchKNN
in class LinearScanPrimitiveDistanceKNNQuery<O extends NumberVector>
objs
- Objects listheaps
- Heaps arrayCopyright © 2019 ELKI Development Team. License information.