public class MinimalisticMemoryKDTree.KDTreeKNNQuery extends AbstractDistanceKNNQuery<O,DoubleDistance>
Modifier and Type | Field and Description |
---|---|
private DoubleNorm<? super O> |
norm
Norm to use.
|
distanceQuery
relation
HINT_BULK, HINT_EXACT, HINT_HEAVY_USE, HINT_NO_CACHE, HINT_OPTIMIZED_ONLY, HINT_SINGLE
Constructor and Description |
---|
MinimalisticMemoryKDTree.KDTreeKNNQuery(DistanceQuery<O,DoubleDistance> distanceQuery,
DoubleNorm<? super O> norm)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
KNNList<DoubleDistance> |
getKNNForObject(O obj,
int k)
Get the k nearest neighbors for a particular id.
|
private double |
kdKNNSearch(int left,
int right,
int axis,
O query,
DoubleDistanceKNNHeap knns,
DBIDArrayIter iter,
double maxdist)
Perform a kNN search on the kd-tree.
|
getKNNForBulkDBIDs, getKNNForDBID
getRelation
private DoubleNorm<? super O extends NumberVector<?>> norm
public MinimalisticMemoryKDTree.KDTreeKNNQuery(DistanceQuery<O,DoubleDistance> distanceQuery, DoubleNorm<? super O> norm)
distanceQuery
- Distance querynorm
- Norm to usepublic KNNList<DoubleDistance> getKNNForObject(O obj, int k)
KNNQuery
getKNNForObject
in interface KNNQuery<O extends NumberVector<?>,DoubleDistance>
getKNNForObject
in class AbstractDistanceKNNQuery<O extends NumberVector<?>,DoubleDistance>
obj
- Query objectk
- Number of neighbors requestedprivate double kdKNNSearch(int left, int right, int axis, O query, DoubleDistanceKNNHeap knns, DBIDArrayIter iter, double maxdist)
left
- Subtree beginright
- Subtree end (exclusive)axis
- Current splitting axisquery
- Query objectknns
- kNN heapiter
- Iterator variable (reduces memory footprint!)maxdist
- Current upper bound of kNN distance.