public class ByteKDTree extends Object
ByteKDTree.SplitChooser
. Supports efficient range, radius and
nearest-neighbour search for relatively low dimensional spaces.Modifier and Type | Class and Description |
---|---|
static class |
ByteKDTree.ApproximateBBFMedianSplit
Approximate best-bin-first median splitting.
|
static class |
ByteKDTree.BasicMedianSplit
Basic median split.
|
static class |
ByteKDTree.BBFMedianSplit
Best-bin-first median splitting.
|
static class |
ByteKDTree.KDTreeNode
An internal node of the KDTree
|
static class |
ByteKDTree.RandomisedBBFMeanSplit
Randomised best-bin-first splitting strategy:
Nodes with less than a set number of items become leafs.
|
static interface |
ByteKDTree.SplitChooser
Interface for describing how a branch in the KD-Tree should be created
|
Modifier and Type | Field and Description |
---|---|
byte[][] |
data
The underlying data array
|
ByteKDTree.KDTreeNode |
root
The tree roots
|
Constructor and Description |
---|
ByteKDTree(byte[][] data)
Construct with the given data and default splitting strategy (
ByteKDTree.BBFMedianSplit ) |
ByteKDTree(byte[][] data,
ByteKDTree.SplitChooser split)
Construct with the given data and splitting strategy
|
Modifier and Type | Method and Description |
---|---|
byte[][] |
coordinateRadiusSearch(byte[] centre,
byte radius)
Find all the points within the given radius of the given point.
|
void |
coordinateRadiusSearch(byte[] centre,
byte radius,
gnu.trove.procedure.TObjectFloatProcedure<byte[]> proc)
Find all the points within the given radius of the given point.
|
byte[][] |
coordinateRangeSearch(byte[] lowerExtreme,
byte[] upperExtreme)
Search the tree for all points contained within the hyperrectangle
defined by the given upper and lower extremes.
|
int[] |
indexRadiusSearch(byte[] centre,
byte radius)
Search the tree for the indexes of all points contained within the
hypersphere defined by the given centre and radius.
|
int[] |
indexRangeSearch(byte[] lowerExtreme,
byte[] upperExtreme)
Search the tree for all points contained within the hyperrectangle
defined by the given upper and lower extremes.
|
List<int[]> |
leafIndices()
Find all the indices seperated by leaves
|
IntFloatPair |
nearestNeighbour(byte[] qu)
Nearest-neighbour search
|
List<IntFloatPair> |
nearestNeighbours(byte[] qu,
int n)
Nearest-neighbour search
|
void |
radiusSearch(byte[] centre,
byte radius,
gnu.trove.procedure.TIntObjectProcedure<byte[]> proc)
Find all the points within the given radius of the given point.
|
void |
rangeSearch(byte[] lowerExtreme,
byte[] upperExtreme,
gnu.trove.procedure.TIntObjectProcedure<byte[]> proc)
Search the tree for all points contained within the hyperrectangle
defined by the given upper and lower extremes.
|
public final ByteKDTree.KDTreeNode root
public final byte[][] data
public ByteKDTree(byte[][] data)
ByteKDTree.BBFMedianSplit
)data
- the datapublic ByteKDTree(byte[][] data, ByteKDTree.SplitChooser split)
data
- the datasplit
- the splitting strategypublic byte[][] coordinateRangeSearch(byte[] lowerExtreme, byte[] upperExtreme)
lowerExtreme
- the lower extreme of the hyperrectangleupperExtreme
- the upper extreme of the hyperrectanglepublic int[] indexRangeSearch(byte[] lowerExtreme, byte[] upperExtreme)
lowerExtreme
- the lower extreme of the hyperrectangleupperExtreme
- the upper extreme of the hyperrectanglepublic int[] indexRadiusSearch(byte[] centre, byte radius)
centre
- the centre pointradius
- the radiuspublic void radiusSearch(byte[] centre, byte radius, gnu.trove.procedure.TIntObjectProcedure<byte[]> proc)
The search can be stopped early by returning false from the
TIntObjectProcedure.execute(int, Object)
method.
centre
- the centre pointradius
- the radiusproc
- the processpublic void rangeSearch(byte[] lowerExtreme, byte[] upperExtreme, gnu.trove.procedure.TIntObjectProcedure<byte[]> proc)
The search can be stopped early by returning false from the
TIntObjectProcedure.execute(int, Object)
method.
lowerExtreme
- the lower extreme of the hyperrectangleupperExtreme
- the upper extreme of the hyperrectangleproc
- the processorpublic List<IntFloatPair> nearestNeighbours(byte[] qu, int n)
qu
- the query pointn
- the number of neighbours to findpublic IntFloatPair nearestNeighbour(byte[] qu)
qu
- the query pointpublic byte[][] coordinateRadiusSearch(byte[] centre, byte radius)
centre
- the centre pointradius
- the radiuspublic void coordinateRadiusSearch(byte[] centre, byte radius, gnu.trove.procedure.TObjectFloatProcedure<byte[]> proc)
The search can be stopped early by returning false from the
TIntObjectProcedure.execute(int, Object)
method.
centre
- the centre pointradius
- the radiusproc
- the processpublic List<int[]> leafIndices()