[−][src]Struct smartcore::algorithm::neighbour::linear_search::LinearKNNSearch
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]
data: Vec<T>,
distance: D
) -> Result<LinearKNNSearch<T, F, D>, Failed>
Initializes algorithm.
data
- vector of data points to search for.distance
- distance metric to use for searching. This function should extendDistance
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 tofrom
k
- the number of nearest neighbors to return
pub fn find_radius(
&self,
from: &T,
radius: F
) -> Result<Vec<(usize, F, &T)>, Failed>
[src]
&self,
from: &T,
radius: F
) -> Result<Vec<(usize, F, &T)>, Failed>
Find all nearest neighbors within radius radius
from p
p
- look for k nearest points top
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]
T: Deserialize<'de>,
D: Deserialize<'de>,
pub fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl<T, F: RealNumber, D: Distance<T, F>> Serialize for LinearKNNSearch<T, F, D> where
T: Serialize,
D: Serialize,
[src]
T: Serialize,
D: Serialize,
Auto Trait Implementations
impl<T, F, D> RefUnwindSafe for LinearKNNSearch<T, F, D> where
D: RefUnwindSafe,
F: RefUnwindSafe,
T: RefUnwindSafe,
[src]
D: RefUnwindSafe,
F: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, F, D> Send for LinearKNNSearch<T, F, D> where
D: Send,
F: Send,
T: Send,
[src]
D: Send,
F: Send,
T: Send,
impl<T, F, D> Sync for LinearKNNSearch<T, F, D> where
D: Sync,
F: Sync,
T: Sync,
[src]
D: Sync,
F: Sync,
T: Sync,
impl<T, F, D> Unpin for LinearKNNSearch<T, F, D> where
D: Unpin,
F: Unpin,
T: Unpin,
[src]
D: Unpin,
F: Unpin,
T: Unpin,
impl<T, F, D> UnwindSafe for LinearKNNSearch<T, F, D> where
D: UnwindSafe,
F: UnwindSafe,
T: UnwindSafe,
[src]
D: UnwindSafe,
F: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,