Package elki.index.tree.spatial.kd
Class MemoryKDTree.KDTreeKNNSearcher
- java.lang.Object
-
- elki.index.tree.spatial.kd.MemoryKDTree.KDTreeKNNSearcher
-
- All Implemented Interfaces:
KNNSearcher<O>
- Enclosing class:
- MemoryKDTree<O extends NumberVector>
@Reference(authors="S. Arya and D. M. Mount", title="Algorithms for fast vector quantization", booktitle="Proc. DCC \'93: Data Compression Conference", url="https://doi.org/10.1109/DCC.1993.253111", bibkey="doi:10.1109/DCC.1993.253111") public class MemoryKDTree.KDTreeKNNSearcher extends java.lang.Object implements KNNSearcher<O>
kNN query for the k-d-tree.Reference:
S. Arya and D. M. Mount
Algorithms for fast vector quantization
Proc. DCC '93: Data Compression Conference- Author:
- Erich Schubert
-
-
Field Summary
Fields Modifier and Type Field Description private PartialDistance<? super O>
distance
Distance to use.
-
Constructor Summary
Constructors Constructor Description KDTreeKNNSearcher(PartialDistance<? super O> distance)
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.private double
kdKNNSearch(java.lang.Object cur, O query, KNNHeap knns, DBIDArrayIter iter, double[] bounds, double rawdist, double maxdist)
Perform a kNN search on the k-d-tree.
-
-
-
Field Detail
-
distance
private PartialDistance<? super O extends NumberVector> distance
Distance to use.
-
-
Constructor Detail
-
KDTreeKNNSearcher
public KDTreeKNNSearcher(PartialDistance<? super O> distance)
Constructor.- Parameters:
distance
- Distance 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 extends NumberVector>
- Parameters:
obj
- query objectk
- Number of neighbors requested- Returns:
- neighbors
-
kdKNNSearch
private double kdKNNSearch(java.lang.Object cur, O query, KNNHeap knns, DBIDArrayIter iter, double[] bounds, double rawdist, double maxdist)
Perform a kNN search on the k-d-tree.- Parameters:
cur
- Current nodequery
- Query objectknns
- kNN heapiter
- Iterator variable (reduces memory footprint!)bounds
- current boundsrawdist
- Raw distance to current rectangle (usually squared)maxdist
- Current upper bound of kNN distance.- Returns:
- New upper bound of kNN distance.
-
-