Struct vpsearch::Tree
[−]
[src]
pub struct Tree<Item: MetricSpace<Impl> + Copy, Impl = (), Ownership = Owned<()>> { /* fields omitted */ }
The VP-Tree.
Methods
impl<Item: MetricSpace<Impl, UserData = ()> + Copy, Impl> Tree<Item, Impl, Owned<()>>[src]
pub fn new(items: &[Item]) -> Self[src]
Creates a new tree from items.
@see Tree::new_with_user_data_owned
impl<U, Impl, Item: MetricSpace<Impl, UserData = U> + Copy> Tree<Item, Impl, Owned<U>>[src]
pub fn find_nearest(&self, needle: &Item) -> (usize, Item::Distance)[src]
Finds item closest to given needle (that can be any item) and Output index of the item in items array from new().
@param needle The query. @return Index of the nearest item found and the distance from the nearest item
impl<Item: MetricSpace<Impl> + Copy, Impl> Tree<Item, Impl, Owned<Item::UserData>>[src]
pub fn new_with_user_data_owned(
items: &[Item],
user_data: Item::UserData
) -> Self[src]
items: &[Item],
user_data: Item::UserData
) -> Self
Create a Vantage Point tree for fast nearest neighbor search.
@param items Array of items that will be searched. @param user_data Reference to any object that is passed down to item.distance()
impl<Item: MetricSpace<Impl> + Copy, Impl> Tree<Item, Impl, ()>[src]
pub fn new_with_user_data_ref(
items: &[Item],
user_data: &Item::UserData
) -> Self[src]
items: &[Item],
user_data: &Item::UserData
) -> Self
The tree doesn't have to own the UserData. You can keep passing it to find_nearest().
pub fn find_nearest(
&self,
needle: &Item,
user_data: &Item::UserData
) -> (usize, Item::Distance)[src]
&self,
needle: &Item,
user_data: &Item::UserData
) -> (usize, Item::Distance)
impl<Item: MetricSpace<Impl> + Copy, Ownership, Impl> Tree<Item, Impl, Ownership>[src]
pub fn find_nearest_custom<ReturnBy: BestCandidate<Item, Impl>>(
&self,
needle: &Item,
user_data: &Item::UserData,
best_candidate: ReturnBy
) -> ReturnBy::Output[src]
&self,
needle: &Item,
user_data: &Item::UserData,
best_candidate: ReturnBy
) -> ReturnBy::Output
All the bells and whistles version. For best_candidate implement BestCandidate<Item, Impl> trait.