pub struct KdTree;
Expand description
Implementation of K-D tree, a fast space-partitioning data structure. For each parent node,
the indexed points are split with a hyperplane into two child nodes. Due to its tree-like
structure, the K-D tree performs spatial queries in O(k * logN)
time, where k
is the number
of points returned by the query. Calling from_batch
returns a KdTree
.
More details can be found here.
Unlike other NearestNeighbour
implementations, KdTree
requires that points be laid out
contiguously in memory and will panic otherwise.
Implementations§
Trait Implementations§
Source§impl NearestNeighbour for KdTree
impl NearestNeighbour for KdTree
Source§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 Send + Sync + NearestNeighbourIndex<F> + 'a>, BuildError>
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 Send + Sync + NearestNeighbourIndex<F> + 'a>, BuildError>
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. Read moreSource§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 Send + Sync + 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 Send + Sync + NearestNeighbourIndex<F> + 'a>, BuildError>
Builds a spatial index using a default leaf size. See
from_batch_with_leaf_size
for more
information.impl Eq for KdTree
impl StructuralPartialEq for KdTree
Auto Trait Implementations§
impl Freeze for KdTree
impl RefUnwindSafe for KdTree
impl Send for KdTree
impl Sync for KdTree
impl Unpin for KdTree
impl UnwindSafe for KdTree
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more