D
- Distance typeclass GenericKNNHeap<D extends Distance<D>> extends AbstractKNNHeap<DistanceDBIDPair<D>,D>
DoubleDistanceKNNHeap
To instantiate, use KNNUtil.newHeap(de.lmu.ifi.dbs.elki.distance.distancefunction.DistanceFunction<?, D>, int)
instead!AbstractKNNHeap.Comp
Modifier and Type | Field and Description |
---|---|
protected D |
knndistance
Cached distance to k nearest neighbor (to avoid going through
AbstractKNNHeap.peek()
each time). |
COMPARATOR, heap
Modifier | Constructor and Description |
---|---|
protected |
GenericKNNHeap(int k)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
add(D distance,
DBIDRef id)
Add a distance-id pair to the heap unless the distance is too large.
|
void |
add(DistanceDBIDPair<D> pair)
Add a pair to the heap.
|
D |
getKNNDistance()
Get the distance to the k nearest neighbor, or maxdist otherwise.
|
protected void |
heapModified() |
GenericKNNList<D> |
toKNNList()
Serialize to a
GenericKNNList . |
protected D extends Distance<D> knndistance
AbstractKNNHeap.peek()
each time).protected GenericKNNHeap(int k)
KNNUtil.newHeap(de.lmu.ifi.dbs.elki.distance.distancefunction.DistanceFunction<?, D>, int)
instead!k
- Heap sizepublic GenericKNNList<D> toKNNList()
GenericKNNList
. This empties the heap!public void add(D distance, DBIDRef id)
KNNHeap
distance
- Distance valueid
- ID numberpublic void add(DistanceDBIDPair<D> pair)
AbstractKNNHeap
add
in class AbstractKNNHeap<DistanceDBIDPair<D extends Distance<D>>,D extends Distance<D>>
pair
- Pair to add.protected void heapModified()