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, ) -> Result<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,
) -> Result<IvfProbePlan>
pub fn probe_with_parent_beam( &self, query: &[u8], k: usize, mode: IvfRoutingMode, parent_beam_oversample: usize, ) -> Result<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) -> Result<u32>
pub fn assign(&self, code: &[u8], mode: IvfRoutingMode) -> Result<u32>
Assign one code to its leaf.
Segment construction routes every vector through here, so this path must stay allocation-free. A code of the wrong width, or a router that cannot produce a leaf, is an error: silently assigning cluster 0 would build a payload that scores as valid but never finds those vectors.
Trait Implementations§
Source§impl Clone for BinaryCoarseQuantizer
impl Clone for BinaryCoarseQuantizer
Source§fn clone(&self) -> BinaryCoarseQuantizer
fn clone(&self) -> BinaryCoarseQuantizer
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
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>,
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
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
impl<T> ErasedDestructor for Twhere
T: 'static,
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> ⓘ
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> ⓘ
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