Struct faiss::index::scalar_quantizer::IVFScalarQuantizerIndexImpl
source · pub struct IVFScalarQuantizerIndexImpl<Q> { /* private fields */ }
Expand description
Native implementation of a scalar quantizer index.
Implementations§
source§impl<Q> IVFScalarQuantizerIndexImpl<Q>where
Q: NativeIndex,
impl<Q> IVFScalarQuantizerIndexImpl<Q>where Q: NativeIndex,
sourcepub fn new_with_metric(
quantizer: Q,
d: u32,
qt: QuantizerType,
nlist: u32,
metric: MetricType,
encode_residual: Option<bool>
) -> Result<Self>
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.
sourcepub fn new_l2(
quantizer: Q,
d: u32,
qt: QuantizerType,
nlist: u32
) -> Result<Self>
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.
sourcepub fn new_ip(
quantizer: Q,
d: u32,
qt: QuantizerType,
nlist: u32
) -> Result<Self>
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.
sourcepub fn set_nprobe(&mut self, value: u32)
pub fn set_nprobe(&mut self, value: u32)
Set number of probes at query time
pub fn train_residual(&mut self, x: &[f32]) -> Result<()>
source§impl<Q> IVFScalarQuantizerIndexImpl<Q>where
Q: NativeIndex + CpuIndex,
impl<Q> IVFScalarQuantizerIndexImpl<Q>where Q: NativeIndex + CpuIndex,
sourcepub fn to_gpu<'gpu, G>(
&self,
gpu_res: &'gpu G,
device: i32
) -> Result<GpuIndexImpl<'gpu, IVFScalarQuantizerIndexImpl<Q>>>where
G: GpuResourcesProvider,
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.
sourcepub fn into_gpu<'gpu, G>(
self,
gpu_res: &'gpu G,
device: i32
) -> Result<GpuIndexImpl<'gpu, IVFScalarQuantizerIndexImpl<Q>>>where
G: GpuResourcesProvider,
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.
sourcepub fn to_gpu_multiple<'gpu, G>(
&self,
gpu_res: &'gpu [G],
devices: &[i32]
) -> Result<GpuIndexImpl<'gpu, IVFScalarQuantizerIndexImpl<Q>>>where
G: GpuResourcesProvider + 'gpu,
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.
sourcepub fn into_gpu_multiple<'gpu, G>(
self,
gpu_res: &'gpu [G],
devices: &[i32]
) -> Result<GpuIndexImpl<'gpu, IVFScalarQuantizerIndexImpl<Q>>>where
G: GpuResourcesProvider + 'gpu,
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,
impl<Q> ConcurrentIndex for IVFScalarQuantizerIndexImpl<Q>where Q: ConcurrentIndex,
source§fn assign(&self, query: &[f32], k: usize) -> Result<AssignSearchResult>
fn assign(&self, query: &[f32], k: usize) -> Result<AssignSearchResult>
search
, but only provides the labels.source§fn search(&self, query: &[f32], k: usize) -> Result<SearchResult>
fn search(&self, query: &[f32], k: usize) -> Result<SearchResult>
k
closest vectors to the given query vectors.source§fn range_search(&self, query: &[f32], radius: f32) -> Result<RangeSearchResult>
fn range_search(&self, query: &[f32], radius: f32) -> Result<RangeSearchResult>
source§impl<Q: Debug> Debug for IVFScalarQuantizerIndexImpl<Q>
impl<Q: Debug> Debug for IVFScalarQuantizerIndexImpl<Q>
source§impl<Q> Drop for IVFScalarQuantizerIndexImpl<Q>
impl<Q> Drop for IVFScalarQuantizerIndexImpl<Q>
source§impl FromInnerPtr for IVFScalarQuantizerIndexImpl<IndexImpl>
impl FromInnerPtr for IVFScalarQuantizerIndexImpl<IndexImpl>
source§unsafe fn from_inner_ptr(inner_ptr: *mut FaissIndex) -> Self
unsafe fn from_inner_ptr(inner_ptr: *mut FaissIndex) -> Self
source§impl<Q> Index for IVFScalarQuantizerIndexImpl<Q>
impl<Q> Index for IVFScalarQuantizerIndexImpl<Q>
source§fn is_trained(&self) -> bool
fn is_trained(&self) -> bool
source§fn metric_type(&self) -> MetricType
fn metric_type(&self) -> MetricType
source§fn add(&mut self, x: &[f32]) -> Result<()>
fn add(&mut self, x: &[f32]) -> Result<()>
x.len() / d
.source§fn add_with_ids(&mut self, x: &[f32], xids: &[Idx]) -> Result<()>
fn add_with_ids(&mut self, x: &[f32], xids: &[Idx]) -> Result<()>
x.len() / d
.
Not all index types may support this operation.source§fn assign(&mut self, query: &[f32], k: usize) -> Result<AssignSearchResult>
fn assign(&mut self, query: &[f32], k: usize) -> Result<AssignSearchResult>
search
, but only provides the labels.source§fn search(&mut self, query: &[f32], k: usize) -> Result<SearchResult>
fn search(&mut self, query: &[f32], k: usize) -> Result<SearchResult>
k
closest vectors to the given query vectors.