pub struct Index(/* private fields */);Expand description
Brute Force KNN Index
Implementations§
Source§impl Index
impl Index
Sourcepub fn build<T: Into<ManagedTensor>>(
res: &Resources,
metric: DistanceType,
metric_arg: Option<f32>,
dataset: T,
) -> Result<Index>
pub fn build<T: Into<ManagedTensor>>( res: &Resources, metric: DistanceType, metric_arg: Option<f32>, dataset: T, ) -> Result<Index>
Builds a new Brute Force KNN Index from the dataset for efficient search.
§Arguments
res- Resources to usemetric- DistanceType to use for building the indexmetric_arg- Optional value ofpfor Minkowski distancesdataset- A row-major matrix on either the host or device to index
Sourcepub fn search(
self,
res: &Resources,
queries: &ManagedTensor,
neighbors: &ManagedTensor,
distances: &ManagedTensor,
) -> Result<()>
pub fn search( self, res: &Resources, queries: &ManagedTensor, neighbors: &ManagedTensor, distances: &ManagedTensor, ) -> Result<()>
Perform a Nearest Neighbors search on the Index
§Arguments
res- Resources to usequeries- A matrix in device memory to query forneighbors- Matrix in device memory that receives the indices of the nearest neighborsdistances- Matrix in device memory that receives the distances of the nearest neighbors
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Index
impl RefUnwindSafe for Index
impl !Send for Index
impl !Sync for Index
impl Unpin for Index
impl UnwindSafe for Index
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