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