org.ddogleg.nn.wrap
Class KdForestBbfSearch<D>
- java.lang.Object
-
- org.ddogleg.nn.wrap.KdForestBbfSearch<D>
-
- All Implemented Interfaces:
- NearestNeighbor<D>
public class KdForestBbfSearch<D> extends java.lang.Object implements NearestNeighbor<D>
K-D tree search which searches through multiple trees. The search is performed using a Best-Bin-First approach
-
-
Constructor Summary
Constructors Constructor and Description KdForestBbfSearch(int numberOfTrees, int maxNodesSearched, AxisSplitter<D> splitter)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidfindNearest(double[] point, double maxDistance, int numNeighbors, FastQueue<NnData<D>> result)Searches for the N nearest neighbor to the specified point.booleanfindNearest(double[] point, double maxDistance, NnData<D> result)Searches for the nearest neighbor to the specified point.voidinit(int pointDimension)Initializes data structures.voidsetPoints(java.util.List<double[]> points, java.util.List<D> data)Specifies the set of points which are to be searched.
-
-
-
Constructor Detail
-
KdForestBbfSearch
public KdForestBbfSearch(int numberOfTrees, int maxNodesSearched, AxisSplitter<D> splitter)
-
-
Method Detail
-
init
public void init(int pointDimension)
Description copied from interface:NearestNeighborInitializes data structures.- Specified by:
initin interfaceNearestNeighbor<D>- Parameters:
pointDimension- Dimension of input data
-
setPoints
public void setPoints(java.util.List<double[]> points, java.util.List<D> data)Description copied from interface:NearestNeighborSpecifies the set of points which are to be searched.- Specified by:
setPointsin interfaceNearestNeighbor<D>- Parameters:
points- Set of points.data- (Optional) Associated data. Can be null.
-
findNearest
public boolean findNearest(double[] point, double maxDistance, NnData<D> result)Description copied from interface:NearestNeighborSearches for the nearest neighbor to the specified point. The neighbor must be within maxDistance.NOTE: How distance is measured is not specified here. See the implementation's documentation. Euclidean distance squared is common.
- Specified by:
findNearestin interfaceNearestNeighbor<D>- Parameters:
point- A point being searched for.maxDistance- Maximum distance (inclusive, e.g. d ≤ maxDistance) a neighbor can be from point. Values<0 will be set to the maximum distance.result- Storage for the result.- Returns:
- true if a match within the max distance was found.
-
findNearest
public void findNearest(double[] point, double maxDistance, int numNeighbors, FastQueue<NnData<D>> result)Description copied from interface:NearestNeighborSearches for the N nearest neighbor to the specified point. The neighbors must be within maxDistance.NOTE: How distance is measured is not specified here. See the implementation's documentation. Euclidean distance squared is common.
- Specified by:
findNearestin interfaceNearestNeighbor<D>- Parameters:
point- A point being searched for.maxDistance- Maximum distance (inclusive, e.g. d ≤ maxDistance) the neighbor can be from point. Values<0 will be set to the maximum distance.numNeighbors- The number of neighbors it will search for.result- Storage for the result. Must be empty before calling. Must support grow() function.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG