pub struct BinaryCoarseQuantizer {
pub dim_bits: usize,
pub num_clusters: u32,
pub version: u64,
/* private fields */
}Expand description
Global Hamming coarse quantizer shared by every segment of a field.
Fields§
§dim_bits: usize§num_clusters: u32§version: u64Implementations§
Source§impl BinaryCoarseQuantizer
impl BinaryCoarseQuantizer
pub fn train( config: BinaryIvfConfig, codes: &[u8], num_vectors: usize, index_label: &str, ) -> Result<Self>
pub fn byte_len(&self) -> usize
pub fn validate(&self) -> Result<(), String>
pub fn validate_routing(&self, mode: IvfRoutingMode) -> Result<(), String>
pub fn probe( &self, query: &[u8], k: usize, mode: IvfRoutingMode, ) -> IvfProbePlan
Sourcepub fn request_fingerprint(
&self,
query: &[u8],
k: usize,
mode: IvfRoutingMode,
) -> u64
pub fn request_fingerprint( &self, query: &[u8], k: usize, mode: IvfRoutingMode, ) -> u64
Cache key for the default probe policy. This must stay paired with
Self::probe: automatic routing and adaptive parent beams are both
resolved here before hashing.
Sourcepub fn probe_with_parent_beam(
&self,
query: &[u8],
k: usize,
mode: IvfRoutingMode,
parent_beam_oversample: usize,
) -> IvfProbePlan
pub fn probe_with_parent_beam( &self, query: &[u8], k: usize, mode: IvfRoutingMode, parent_beam_oversample: usize, ) -> IvfProbePlan
Probe with an explicit two-level parent coverage multiplier.
The routing layer clamps the multiplier to its hard work bound. Flat and HNSW modes ignore it, so a runtime integration can pass one policy uniformly without changing artifacts or exact leaf scoring.
Sourcepub fn assign(&self, code: &[u8], mode: IvfRoutingMode) -> u32
pub fn assign(&self, code: &[u8], mode: IvfRoutingMode) -> u32
Assign one code to its leaf.
Segment construction routes every vector through here, so this path must stay allocation-free.
Trait Implementations§
Source§impl Clone for BinaryCoarseQuantizer
impl Clone for BinaryCoarseQuantizer
Source§fn clone(&self) -> BinaryCoarseQuantizer
fn clone(&self) -> BinaryCoarseQuantizer
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 BinaryCoarseQuantizer
impl Debug for BinaryCoarseQuantizer
Source§impl<'de> Deserialize<'de> for BinaryCoarseQuantizer
impl<'de> Deserialize<'de> for BinaryCoarseQuantizer
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for BinaryCoarseQuantizer
impl RefUnwindSafe for BinaryCoarseQuantizer
impl Send for BinaryCoarseQuantizer
impl Sync for BinaryCoarseQuantizer
impl Unpin for BinaryCoarseQuantizer
impl UnsafeUnpin for BinaryCoarseQuantizer
impl UnwindSafe for BinaryCoarseQuantizer
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
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> DropFlavorWrapper<T> for T
impl<T> DropFlavorWrapper<T> for T
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
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