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