public interface KNNHeap
To instantiate, use:
DBIDUtil.newHeap(int)
!
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clear the heap.
|
boolean |
contains(DBIDRef other)
Check if an object is already in the heap.
|
int |
getK()
Get the K parameter ("maxsize" internally).
|
double |
getKNNDistance()
Get the distance to the k nearest neighbor, or maxdist otherwise.
|
void |
insert(DoubleDBIDPair e)
Add a distance-id pair to the heap unless the distance is too large.
|
double |
insert(double distance,
DBIDRef id)
Add a distance-id pair to the heap unless the distance is too large.
|
default boolean |
isEmpty()
Test if the heap is empty.
|
int |
size()
Current size of heap.
|
KNNList |
toKNNList()
Serialize to a
KNNList . |
KNNList |
toKNNListSqrt()
Serialize to a
KNNList , but applying sqrt to every distance. |
DoubleDBIDListIter |
unorderedIterator()
Unordered iterator over the heap.
|
KNNList toKNNList()
KNNList
. This empties the heap!KNNList toKNNListSqrt()
KNNList
, but applying sqrt to every distance.
This empties the heap!int getK()
double getKNNDistance()
double insert(double distance, DBIDRef id)
Compared to the super.add() method, this often saves the pair construction.
distance
- Distance valueid
- ID numbervoid insert(DoubleDBIDPair e)
Use for existing pairs.
e
- Existing distance pairint size()
default boolean isEmpty()
void clear()
DoubleDBIDListIter unorderedIterator()
boolean contains(DBIDRef other)
other
- Other objecttrue
if containedCopyright © 2019 ELKI Development Team. License information.