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