[][src]Struct smartcore::algorithm::neighbour::linear_search::LinearKNNSearch

pub struct LinearKNNSearch<T, F: RealNumber, D: Distance<T, F>> { /* fields omitted */ }

Implements Linear Search algorithm, see KNN algorithms

Implementations

impl<T, F: RealNumber, D: Distance<T, F>> LinearKNNSearch<T, F, D>[src]

pub fn new(
    data: Vec<T>,
    distance: D
) -> Result<LinearKNNSearch<T, F, D>, Failed>
[src]

Initializes algorithm.

  • data - vector of data points to search for.
  • distance - distance metric to use for searching. This function should extend Distance interface.

pub fn find(&self, from: &T, k: usize) -> Result<Vec<(usize, F, &T)>, Failed>[src]

Find k nearest neighbors

  • from - look for k nearest points to from
  • k - the number of nearest neighbors to return

pub fn find_radius(
    &self,
    from: &T,
    radius: F
) -> Result<Vec<(usize, F, &T)>, Failed>
[src]

Find all nearest neighbors within radius radius from p

  • p - look for k nearest points to p
  • radius - radius of the search

Trait Implementations

impl<T: Debug, F: Debug + RealNumber, D: Debug + Distance<T, F>> Debug for LinearKNNSearch<T, F, D>[src]

impl<'de, T, F: RealNumber, D: Distance<T, F>> Deserialize<'de> for LinearKNNSearch<T, F, D> where
    T: Deserialize<'de>,
    D: Deserialize<'de>, 
[src]

impl<T, F: RealNumber, D: Distance<T, F>> Serialize for LinearKNNSearch<T, F, D> where
    T: Serialize,
    D: Serialize
[src]

Auto Trait Implementations

impl<T, F, D> RefUnwindSafe for LinearKNNSearch<T, F, D> where
    D: RefUnwindSafe,
    F: RefUnwindSafe,
    T: RefUnwindSafe
[src]

impl<T, F, D> Send for LinearKNNSearch<T, F, D> where
    D: Send,
    F: Send,
    T: Send
[src]

impl<T, F, D> Sync for LinearKNNSearch<T, F, D> where
    D: Sync,
    F: Sync,
    T: Sync
[src]

impl<T, F, D> Unpin for LinearKNNSearch<T, F, D> where
    D: Unpin,
    F: Unpin,
    T: Unpin
[src]

impl<T, F, D> UnwindSafe for LinearKNNSearch<T, F, D> where
    D: UnwindSafe,
    F: UnwindSafe,
    T: UnwindSafe
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,