de.lmu.ifi.dbs.elki.database.query.knn
Class LinearScanKNNQuery<O,D extends Distance<D>>
java.lang.Object
de.lmu.ifi.dbs.elki.database.query.AbstractDataBasedQuery<O>
de.lmu.ifi.dbs.elki.database.query.knn.AbstractDistanceKNNQuery<O,D>
de.lmu.ifi.dbs.elki.database.query.knn.LinearScanKNNQuery<O,D>
- All Implemented Interfaces:
- DatabaseQuery, KNNQuery<O,D>, LinearScanQuery
- Direct Known Subclasses:
- LinearScanPrimitiveDistanceKNNQuery
public class LinearScanKNNQuery<O,D extends Distance<D>>
- extends AbstractDistanceKNNQuery<O,D>
- implements LinearScanQuery
Instance of this query for a particular database.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LinearScanKNNQuery
public LinearScanKNNQuery(DistanceQuery<O,D> distanceQuery)
- Constructor.
- Parameters:
distanceQuery
- Distance function to use
linearScanBatchKNN
private void linearScanBatchKNN(ArrayDBIDs ids,
List<KNNHeap<D>> heaps)
- Linear batch knn for arbitrary distance functions.
- Parameters:
ids
- DBIDs to processheaps
- Heaps to store the results in
getKNNForDBID
public List<DistanceResultPair<D>> getKNNForDBID(DBID id,
int k)
- Description copied from interface:
KNNQuery
- Get the k nearest neighbors for a particular id.
- Specified by:
getKNNForDBID
in interface KNNQuery<O,D extends Distance<D>>
- Specified by:
getKNNForDBID
in class AbstractDistanceKNNQuery<O,D extends Distance<D>>
- Parameters:
id
- query object IDk
- Number of neighbors requested
- Returns:
- neighbors
getKNNForBulkDBIDs
public List<List<DistanceResultPair<D>>> getKNNForBulkDBIDs(ArrayDBIDs ids,
int k)
- Description copied from interface:
KNNQuery
- Bulk query method
- Specified by:
getKNNForBulkDBIDs
in interface KNNQuery<O,D extends Distance<D>>
- Parameters:
ids
- query object IDsk
- Number of neighbors requested
- Returns:
- neighbors
getKNNForBulkHeaps
public void getKNNForBulkHeaps(Map<DBID,KNNHeap<D>> heaps)
- Description copied from interface:
KNNQuery
- Bulk query method configured by a map.
Warning: this API is not optimal, and might be removed soon (in fact, it is
used in a single place)
- Specified by:
getKNNForBulkHeaps
in interface KNNQuery<O,D extends Distance<D>>
- Parameters:
heaps
- Map of heaps to fill.
getKNNForObject
public List<DistanceResultPair<D>> getKNNForObject(O obj,
int k)
- Description copied from interface:
KNNQuery
- Get the k nearest neighbors for a particular id.
- Specified by:
getKNNForObject
in interface KNNQuery<O,D extends Distance<D>>
- Specified by:
getKNNForObject
in class AbstractDistanceKNNQuery<O,D extends Distance<D>>
- Parameters:
obj
- Query objectk
- Number of neighbors requested
- Returns:
- neighbors