public class LinearScanKNNQuery<O,D extends Distance<D>> extends AbstractDistanceKNNQuery<O,D> implements LinearScanQuery
distanceQuery
relation
HINT_BULK, HINT_EXACT, HINT_HEAVY_USE, HINT_NO_CACHE, HINT_OPTIMIZED_ONLY, HINT_SINGLE
Constructor and Description |
---|
LinearScanKNNQuery(DistanceQuery<O,D> distanceQuery)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
List<List<DistanceResultPair<D>>> |
getKNNForBulkDBIDs(ArrayDBIDs ids,
int k)
Bulk query method
|
void |
getKNNForBulkHeaps(Map<DBID,KNNHeap<D>> heaps)
Bulk query method configured by a map.
|
List<DistanceResultPair<D>> |
getKNNForDBID(DBID id,
int k)
Get the k nearest neighbors for a particular id.
|
List<DistanceResultPair<D>> |
getKNNForObject(O obj,
int k)
Get the k nearest neighbors for a particular id.
|
private void |
linearScanBatchKNN(ArrayDBIDs ids,
List<KNNHeap<D>> heaps)
Linear batch knn for arbitrary distance functions.
|
getDistanceFactory, getDistanceQuery
getRelation
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getRelation
public LinearScanKNNQuery(DistanceQuery<O,D> distanceQuery)
distanceQuery
- Distance function to useprivate void linearScanBatchKNN(ArrayDBIDs ids, List<KNNHeap<D>> heaps)
ids
- DBIDs to processheaps
- Heaps to store the results inpublic List<DistanceResultPair<D>> getKNNForDBID(DBID id, int k)
KNNQuery
getKNNForDBID
in interface KNNQuery<O,D extends Distance<D>>
getKNNForDBID
in class AbstractDistanceKNNQuery<O,D extends Distance<D>>
id
- query object IDk
- Number of neighbors requestedpublic List<List<DistanceResultPair<D>>> getKNNForBulkDBIDs(ArrayDBIDs ids, int k)
KNNQuery
public void getKNNForBulkHeaps(Map<DBID,KNNHeap<D>> heaps)
KNNQuery
public List<DistanceResultPair<D>> getKNNForObject(O obj, int k)
KNNQuery
getKNNForObject
in interface KNNQuery<O,D extends Distance<D>>
getKNNForObject
in class AbstractDistanceKNNQuery<O,D extends Distance<D>>
obj
- Query objectk
- Number of neighbors requested