pub struct QuantizedVector {
pub binary_code_packed: Vec<u8>,
pub ex_code_packed: Vec<u8>,
pub ex_bits: u8,
pub dim: usize,
pub delta: f32,
pub vl: f32,
pub f_add: f32,
pub f_rescale: f32,
pub f_error: f32,
pub residual_norm: f32,
pub f_add_ex: f32,
pub f_rescale_ex: f32,
}Expand description
Quantised representation of a vector using packed format (aligned with C++ implementation).
Binary codes and extended codes are stored in bit-packed format for memory efficiency.
binary_code_packed: 1 bit per dimensionex_code_packed: ex_bits per dimension
For performance-critical search operations, unpacked codes are cached to avoid repeated unpacking overhead.
Fields§
§binary_code_packed: Vec<u8>Packed binary code (1 bit per element)
ex_code_packed: Vec<u8>Packed extended code (ex_bits per element)
ex_bits: u8Number of extended bits per element
dim: usizeOriginal dimension (before padding)
delta: f32§vl: f32§f_add: f32§f_rescale: f32§f_error: f32§residual_norm: f32§f_add_ex: f32§f_rescale_ex: f32Implementations§
Source§impl QuantizedVector
impl QuantizedVector
Sourcepub fn unpack_binary_code(&self) -> Vec<u8> ⓘ
pub fn unpack_binary_code(&self) -> Vec<u8> ⓘ
Unpack binary code for computation
Sourcepub fn unpack_ex_code(&self) -> Vec<u16>
pub fn unpack_ex_code(&self) -> Vec<u16>
Unpack extended code for computation
Sourcepub fn ensure_unpacked_cache(&mut self)
pub fn ensure_unpacked_cache(&mut self)
Ensure unpacked caches are populated (No-op in memory-optimized version)
Trait Implementations§
Source§impl Clone for QuantizedVector
impl Clone for QuantizedVector
Source§fn clone(&self) -> QuantizedVector
fn clone(&self) -> QuantizedVector
Returns a duplicate of the value. Read more
1.0.0 · 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 QuantizedVector
impl Debug for QuantizedVector
Source§impl<'de> Deserialize<'de> for QuantizedVector
impl<'de> Deserialize<'de> for QuantizedVector
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 QuantizedVector
impl RefUnwindSafe for QuantizedVector
impl Send for QuantizedVector
impl Sync for QuantizedVector
impl Unpin for QuantizedVector
impl UnsafeUnpin for QuantizedVector
impl UnwindSafe for QuantizedVector
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> 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