Skip to main content

CagraIndex

Struct CagraIndex 

Source
pub struct CagraIndex<'data, T: CagraElement> { /* private fields */ }
Expand description

Query-local CAGRA index with a device-padded dataset. Rows already aligned to 16 bytes use a borrowed padded view; other rows use an owning padded copy. Native search requires a device-padded index (components/cuvs/cuvs/c/src/neighbors/cagra.cpp:1843).

Implementations§

Source§

impl<'data, T: CagraElement> CagraIndex<'data, T>

Source

pub fn build( resources: &CuvsResources, dataset: &ValidatedDeviceTensor<'data, T>, params: CagraIndexParams, ) -> Result<Self>

Source

pub fn search_into( &self, queries: &ValidatedDeviceTensor<'_, T>, k: usize, params: CagraSearchParams, neighbors: &mut DeviceBuffer<i64>, distances: &mut DeviceBuffer<f32>, ) -> Result<KnnSearchOutput>

Search outputs are [queries.rows(), k]. Missing neighbors have ordinal i64::MAX.

Source

pub fn rows(&self) -> usize

Source

pub fn columns(&self) -> usize

Source

pub fn close(self) -> Result<()>

Reports native destruction errors; failed destruction is retried on drop.

Trait Implementations§

Source§

impl<T: CagraElement> Debug for CagraIndex<'_, T>

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: CagraElement> Drop for CagraIndex<'_, T>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

§

impl<'data, T> !RefUnwindSafe for CagraIndex<'data, T>

§

impl<'data, T> !Send for CagraIndex<'data, T>

§

impl<'data, T> !Sync for CagraIndex<'data, T>

§

impl<'data, T> !UnwindSafe for CagraIndex<'data, T>

§

impl<'data, T> Freeze for CagraIndex<'data, T>

§

impl<'data, T> Unpin for CagraIndex<'data, T>

§

impl<'data, T> UnsafeUnpin for CagraIndex<'data, T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.