pub struct IvfPqConfig {
pub nlist: usize,
pub nprobe: usize,
pub pq_m: usize,
pub pq_k: usize,
pub max_iter: usize,
}Expand description
Configuration for IVF-PQ index construction and search.
Fields§
§nlist: usizeNumber of coarse Voronoi cells (inverted lists). Rule of thumb: sqrt(n) for balanced recall/speed. Default 256.
nprobe: usizeCells probed per query. Higher = better recall, more compute. nprobe=1 is ANN; nprobe=nlist is exact. Default 8.
pq_m: usizePQ sub-vector count M. Must divide dim. Default 8.
pq_k: usizePQ centroids per sub-space K. Must be ≤ 256 (u8 codes). Default 256.
max_iter: usizek-means max iterations for both coarse and PQ training. Default 25.
Implementations§
Source§impl IvfPqConfig
impl IvfPqConfig
Sourcepub fn for_dim(dim: usize) -> IvfPqConfig
pub fn for_dim(dim: usize) -> IvfPqConfig
Derive sensible defaults from vector dimensionality.
Sourcepub fn for_dataset(dim: usize, n_vectors: usize) -> IvfPqConfig
pub fn for_dataset(dim: usize, n_vectors: usize) -> IvfPqConfig
Derive sensible defaults from both dimensionality and dataset size.
nlist scales with sqrt(n_vectors) so each cluster gets ~4 vectors on average.
Clamped to [16, 1024] to avoid degenerate configs on tiny or huge datasets.
Trait Implementations§
Source§impl Clone for IvfPqConfig
impl Clone for IvfPqConfig
Source§fn clone(&self) -> IvfPqConfig
fn clone(&self) -> IvfPqConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for IvfPqConfig
impl Debug for IvfPqConfig
Source§impl Default for IvfPqConfig
impl Default for IvfPqConfig
Source§fn default() -> IvfPqConfig
fn default() -> IvfPqConfig
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for IvfPqConfig
impl<'de> Deserialize<'de> for IvfPqConfig
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<IvfPqConfig, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<IvfPqConfig, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for IvfPqConfig
impl Serialize for IvfPqConfig
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for IvfPqConfig
impl RefUnwindSafe for IvfPqConfig
impl Send for IvfPqConfig
impl Sync for IvfPqConfig
impl Unpin for IvfPqConfig
impl UnsafeUnpin for IvfPqConfig
impl UnwindSafe for IvfPqConfig
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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 more