pub trait NearestNeighbour: Debug + Send + Sync + Unpin {
    fn from_batch_with_leaf_size<'a, F: Float, DT: Data<Elem = F>, D: 'a + Distance<F>>(
        &self,
        batch: &'a ArrayBase<DT, Ix2>,
        leaf_size: usize,
        dist_fn: D
    ) -> Result<Box<dyn NearestNeighbourIndex<F> + 'a>, BuildError>; fn from_batch<'a, F: Float, DT: Data<Elem = F>, D: 'a + Distance<F>>(
        &self,
        batch: &'a ArrayBase<DT, Ix2>,
        dist_fn: D
    ) -> Result<Box<dyn NearestNeighbourIndex<F> + 'a>, BuildError> { ... } }
Expand description

Nearest neighbour algorithm builds a spatial index structure out of a batch of points. The distance between points is calculated using a provided distance function. The index implements the NearestNeighbourIndex trait and allows for efficient computing of nearest neighbour and range queries.

Required Methods

Builds a spatial index using a MxN two-dimensional array representing M points with N dimensions. Also takes leaf_size, which specifies the number of elements in the leaf nodes of tree-like index structures.

Returns an error if the points have dimensionality of 0 or if the leaf size is 0. If any value in the batch is NaN or infinite, the behaviour is unspecified.

Provided Methods

Builds a spatial index using a default leaf size. See from_batch_with_leaf_size for more information.

Implementors