D
- Distance typepublic class DistanceDBIDPairKNNHeap<D extends Distance<D>> extends AbstractKNNHeap<DistanceDBIDPair<D>,D>
DoubleDistanceDBIDPairKNNHeap
To instantiate, use DBIDUtil.newHeap(D, int)
instead!Modifier and Type | Field and Description |
---|---|
protected D |
knndistance
Cached distance to k nearest neighbor (to avoid going through
AbstractKNNHeap.peek()
each time). |
heap
Constructor and Description |
---|
DistanceDBIDPairKNNHeap(int k)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
D |
getKNNDistance()
Get the distance to the k nearest neighbor, or maxdist otherwise.
|
protected void |
heapModified() |
void |
insert(D distance,
DBIDRef id)
Add a distance-id pair to the heap unless the distance is too large.
|
void |
insert(DistanceDBIDPair<D> pair)
Add a pair to the heap.
|
DistanceDBIDPairKNNList<D> |
toKNNList()
Serialize to a
DistanceDBIDPairKNNList . |
protected D extends Distance<D> knndistance
AbstractKNNHeap.peek()
each time).public DistanceDBIDPairKNNHeap(int k)
DBIDUtil.newHeap(D, int)
instead!k
- Heap sizepublic DistanceDBIDPairKNNList<D> toKNNList()
DistanceDBIDPairKNNList
. This empties the heap!public void insert(D distance, DBIDRef id)
KNNHeap
distance
- Distance valueid
- ID numberpublic void insert(DistanceDBIDPair<D> pair)
AbstractKNNHeap
insert
in class AbstractKNNHeap<DistanceDBIDPair<D extends Distance<D>>,D extends Distance<D>>
pair
- Pair to add.protected void heapModified()