pub struct AdcLut {
pub subspace_count: u16,
pub centroids_per_subspace: u16,
pub table: Vec<f32>,
}Expand description
Asymmetric Distance Computation lookup table — used by codecs that
pre-decompose the query into per-subspace distance tables (PQ, IVF-PQ,
TurboQuant). Consumed by base-layer rerank kernels via AVX2 pshufb
or AVX-512 vpermb.
Layout:
subspace_count: number of independent subspaces (PQ M parameter)centroids_per_subspace: typically 256 (one byte per code)table: row-major[subspace][centroid] -> f32 distance
Fields§
§subspace_count: u16§centroids_per_subspace: u16§table: Vec<f32>Implementations§
Source§impl AdcLut
impl AdcLut
pub fn new(subspace_count: u16, centroids_per_subspace: u16) -> Self
Sourcepub fn lookup(&self, subspace: u16, centroid: u8) -> f32
pub fn lookup(&self, subspace: u16, centroid: u8) -> f32
Return the precomputed distance for the given subspace and centroid.
§Panics
Panics if subspace >= self.subspace_count or
centroid as usize >= self.centroids_per_subspace as usize.
Bounds checking is the caller’s responsibility on this hot-path accessor.
Auto Trait Implementations§
impl Freeze for AdcLut
impl RefUnwindSafe for AdcLut
impl Send for AdcLut
impl Sync for AdcLut
impl Unpin for AdcLut
impl UnsafeUnpin for AdcLut
impl UnwindSafe for AdcLut
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<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.