Ivf Flat Index Module

View as Markdown

Rust module: cuvs::ivf_flat::index

Source: rust/cuvs/src/ivf_flat/index.rs

Index

1#[derive(Debug)]
2pub struct Index(ffi::cuvsIvfFlatIndex_t);

Ivf-Flat ANN Index

Methods

NameSource
buildrust/cuvs/src/ivf_flat/index.rs:25
newrust/cuvs/src/ivf_flat/index.rs:39
searchrust/cuvs/src/ivf_flat/index.rs:56

build

1pub fn build<T: Into<ManagedTensor>>(
2res: &Resources,
3params: &IndexParams,
4dataset: T,
5) -> Result<Index> { ... }

Builds a new Index from the dataset for efficient search.

Arguments

  • res - Resources to use
  • params - Parameters for building the index
  • dataset - A row-major matrix on either the host or device to index

Source: rust/cuvs/src/ivf_flat/index.rs:25

new

1pub fn new() -> Result<Index> { ... }

Creates a new empty index

Source: rust/cuvs/src/ivf_flat/index.rs:39

1pub fn search(
2&self,
3res: &Resources,
4params: &SearchParams,
5queries: &ManagedTensor,
6neighbors: &ManagedTensor,
7distances: &ManagedTensor,
8) -> Result<()> { ... }

Perform a Approximate Nearest Neighbors search on the Index

Arguments

  • res - Resources to use
  • params - Parameters to use in searching the index
  • queries - A matrix in device memory to query for
  • neighbors - Matrix in device memory that receives the indices of the nearest neighbors
  • distances - Matrix in device memory that receives the distances of the nearest neighbors

Source: rust/cuvs/src/ivf_flat/index.rs:56

Source: rust/cuvs/src/ivf_flat/index.rs:15