pub struct IVFScalarQuantizerIndexImpl<Q> { /* private fields */ }
Expand description

Native implementation of a scalar quantizer index.

Implementations§

source§

impl<Q> IVFScalarQuantizerIndexImpl<Q>where Q: NativeIndex,

source

pub fn new_with_metric( quantizer: Q, d: u32, qt: QuantizerType, nlist: u32, metric: MetricType, encode_residual: Option<bool> ) -> Result<Self>

Create a new IVF scalar quantizer index with metric. The index owns the quantizer.

source

pub fn new_l2( quantizer: Q, d: u32, qt: QuantizerType, nlist: u32 ) -> Result<Self>

Create a new IVF scalar quantizer index with L2 metric. The index owns the quantizer.

source

pub fn new_ip( quantizer: Q, d: u32, qt: QuantizerType, nlist: u32 ) -> Result<Self>

Create a new IVF scalar quantizer index with IP metric. The index owns the quantizer.

source

pub fn nlist(&self) -> u32

Get number of possible key values

source

pub fn nprobe(&self) -> u32

Get number of probes at query time

source

pub fn set_nprobe(&mut self, value: u32)

Set number of probes at query time

source

pub fn train_residual(&mut self, x: &[f32]) -> Result<()>

source§

impl<Q> IVFScalarQuantizerIndexImpl<Q>where Q: NativeIndex + CpuIndex,

source

pub fn to_gpu<'gpu, G>( &self, gpu_res: &'gpu G, device: i32 ) -> Result<GpuIndexImpl<'gpu, IVFScalarQuantizerIndexImpl<Q>>>where G: GpuResourcesProvider,

Build a GPU in from the given CPU native index, yielding two independent indices. The operation fails if the index does not provide GPU support.

source

pub fn into_gpu<'gpu, G>( self, gpu_res: &'gpu G, device: i32 ) -> Result<GpuIndexImpl<'gpu, IVFScalarQuantizerIndexImpl<Q>>>where G: GpuResourcesProvider,

Build a GPU index from the given CPU native index, discarding the CPU-backed index. The operation fails if the index does not provide GPU support.

source

pub fn to_gpu_multiple<'gpu, G>( &self, gpu_res: &'gpu [G], devices: &[i32] ) -> Result<GpuIndexImpl<'gpu, IVFScalarQuantizerIndexImpl<Q>>>where G: GpuResourcesProvider + 'gpu,

Build a GPU index from the given CPU native index.

Errors

The operation fails if the number of GPU resources and number of devices do not match, or the index does not provide GPU support.

source

pub fn into_gpu_multiple<'gpu, G>( self, gpu_res: &'gpu [G], devices: &[i32] ) -> Result<GpuIndexImpl<'gpu, IVFScalarQuantizerIndexImpl<Q>>>where G: GpuResourcesProvider + 'gpu,

Build a GPU index from the given CPU native index. The index residing in CPU memory is discarded in the process.

Errors

The operation fails if the number of GPU resources and number of devices do not match, or the index does not provide GPU support.

Trait Implementations§

source§

impl<Q> ConcurrentIndex for IVFScalarQuantizerIndexImpl<Q>where Q: ConcurrentIndex,

source§

fn assign(&self, query: &[f32], k: usize) -> Result<AssignSearchResult>

Similar to search, but only provides the labels.
source§

fn search(&self, query: &[f32], k: usize) -> Result<SearchResult>

Perform a search for the k closest vectors to the given query vectors.
source§

fn range_search(&self, query: &[f32], radius: f32) -> Result<RangeSearchResult>

Perform a ranged search for the vectors closest to the given query vectors by the given radius.
source§

impl<Q: Debug> Debug for IVFScalarQuantizerIndexImpl<Q>

source§

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

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

impl<Q> Drop for IVFScalarQuantizerIndexImpl<Q>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl FromInnerPtr for IVFScalarQuantizerIndexImpl<IndexImpl>

source§

unsafe fn from_inner_ptr(inner_ptr: *mut FaissIndex) -> Self

Create an index using the given pointer to a native object. Read more
source§

impl<Q> Index for IVFScalarQuantizerIndexImpl<Q>

source§

fn is_trained(&self) -> bool

Whether the Index does not require training, or if training is done already
source§

fn ntotal(&self) -> u64

The total number of vectors indexed
source§

fn d(&self) -> u32

The dimensionality of the indexed vectors
source§

fn metric_type(&self) -> MetricType

The metric type assumed by the index
source§

fn add(&mut self, x: &[f32]) -> Result<()>

Add new data vectors to the index. This assumes a C-contiguous memory slice of vectors, where the total number of vectors is x.len() / d.
source§

fn add_with_ids(&mut self, x: &[f32], xids: &[Idx]) -> Result<()>

Add new data vectors to the index with IDs. This assumes a C-contiguous memory slice of vectors, where the total number of vectors is x.len() / d. Not all index types may support this operation.
source§

fn train(&mut self, x: &[f32]) -> Result<()>

Train the underlying index with the given data.
source§

fn assign(&mut self, query: &[f32], k: usize) -> Result<AssignSearchResult>

Similar to search, but only provides the labels.
source§

fn search(&mut self, query: &[f32], k: usize) -> Result<SearchResult>

Perform a search for the k closest vectors to the given query vectors.
Perform a ranged search for the vectors closest to the given query vectors by the given radius.
source§

fn reset(&mut self) -> Result<()>

Clear the entire index.
source§

fn remove_ids(&mut self, sel: &IdSelector) -> Result<usize>

Remove data vectors represented by IDs.
source§

fn verbose(&self) -> bool

Index verbosity level
source§

fn set_verbose(&mut self, value: bool)

Set Index verbosity level
source§

impl<Q> NativeIndex for IVFScalarQuantizerIndexImpl<Q>

source§

fn inner_ptr(&self) -> *mut FaissIndex

Retrieve a pointer to the native index object.
source§

impl<Q> TryClone for IVFScalarQuantizerIndexImpl<Q>

source§

fn try_clone(&self) -> Result<Self>where Self: Sized,

Create an independent clone of this index. Read more
source§

impl<Q: CpuIndex> CpuIndex for IVFScalarQuantizerIndexImpl<Q>

source§

impl<Q: Send> Send for IVFScalarQuantizerIndexImpl<Q>

source§

impl<Q: Sync> Sync for IVFScalarQuantizerIndexImpl<Q>

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere U: Into<T>,

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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.
source§

impl<NI> UpcastIndex for NIwhere NI: NativeIndex,

source§

fn upcast(self) -> IndexImpl

Convert an index to the base IndexImpl type