pub struct PQConfig {
pub n_subquantizers: usize,
pub n_centroids: usize,
pub n_bits: usize,
pub max_iterations: usize,
pub convergence_threshold: f32,
pub seed: Option<u64>,
pub enable_residual_quantization: bool,
pub residual_levels: usize,
pub enable_multi_codebook: bool,
pub num_codebooks: usize,
pub enable_symmetric_distance: bool,
}
Expand description
Configuration for Product Quantization
Fields§
§n_subquantizers: usize
Number of subquantizers (vector is split into this many parts)
n_centroids: usize
Number of centroids per subquantizer (typically 256 for 8-bit codes)
n_bits: usize
Number of bits per subquantizer (determines n_centroids: 2^n_bits)
max_iterations: usize
Number of iterations for k-means training
convergence_threshold: f32
Convergence threshold for k-means
seed: Option<u64>
Random seed for reproducibility
enable_residual_quantization: bool
Enable residual quantization for better accuracy
residual_levels: usize
Number of residual quantization levels
enable_multi_codebook: bool
Enable multi-codebook quantization
num_codebooks: usize
Number of codebooks for multi-codebook quantization
enable_symmetric_distance: bool
Enable symmetric distance computation
Implementations§
Source§impl PQConfig
impl PQConfig
Sourcepub fn with_bits(n_subquantizers: usize, n_bits: usize) -> Self
pub fn with_bits(n_subquantizers: usize, n_bits: usize) -> Self
Create a new PQConfig with specified bits per subquantizer
Sourcepub fn with_residual_quantization(
n_subquantizers: usize,
n_bits: usize,
residual_levels: usize,
) -> Self
pub fn with_residual_quantization( n_subquantizers: usize, n_bits: usize, residual_levels: usize, ) -> Self
Create a configuration with residual quantization enabled
Sourcepub fn with_multi_codebook(
n_subquantizers: usize,
n_bits: usize,
num_codebooks: usize,
) -> Self
pub fn with_multi_codebook( n_subquantizers: usize, n_bits: usize, num_codebooks: usize, ) -> Self
Create a configuration with multi-codebook quantization enabled
Trait Implementations§
impl StructuralPartialEq for PQConfig
Auto Trait Implementations§
impl Freeze for PQConfig
impl RefUnwindSafe for PQConfig
impl Send for PQConfig
impl Sync for PQConfig
impl Unpin for PQConfig
impl UnwindSafe for PQConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self
is actually part of its subset T
(and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset
but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.