public class VPTree
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
protected class |
VPTree.HeapItem
Quick aggregation class to be used in the PriorityQueue.
|
Modifier and Type | Field and Description |
---|---|
protected java.util.List<VPPoint> |
points |
protected VPNode |
root |
protected double |
tau |
Modifier and Type | Method and Description |
---|---|
protected VPNode |
buildFromPoints(int lower,
int upper) |
void |
buildTree() |
protected int |
nth_element(int lower,
int median,
int upper,
VPPoint vp)
Primitive implementation of the C++ std::nth_element algorithm.
|
protected void |
search(VPNode node,
VPPoint target,
int k,
java.util.PriorityQueue<VPTree.HeapItem> heap) |
void |
search(VPPoint target,
int k,
java.util.List<VPPoint> results,
java.util.List<java.lang.Integer> distances)
Conducts a nearest neighbor search over the vp-tree with the specified
target . |
protected VPNode root
protected final java.util.List<VPPoint> points
protected double tau
public VPTree(java.util.List<VPPoint> points)
public void buildTree()
protected VPNode buildFromPoints(int lower, int upper)
public void search(VPPoint target, int k, java.util.List<VPPoint> results, java.util.List<java.lang.Integer> distances)
target
. The top k
results will be stored in
results
and their distances in distances
.target
- the query value to search fork
- the number of nearest neighborsresults
- a list the results will be stored indistances
- a list the distances will be stored inprotected void search(VPNode node, VPPoint target, int k, java.util.PriorityQueue<VPTree.HeapItem> heap)
protected int nth_element(int lower, int median, int upper, VPPoint vp)