pub enum QuantizedVector {
Full(Vec<f32>),
Int8 {
data: Vec<i8>,
params: ScalarQuantParams,
},
Int3 {
data: Vec<u64>,
params: ScalarQuantParams,
dimensions: usize,
},
Binary {
data: Vec<u64>,
dimensions: usize,
},
Polar {
data: Vec<u64>,
dimensions: usize,
seed: u32,
},
}Expand description
A quantized vector representation
Variants§
Full(Vec<f32>)
Full precision f32 vector
Int8
Scalar quantized to int8
Int3
3-bit quantized (8 levels, packed 21 values per u64)
Binary
Binary quantized (packed bits)
Polar
Polar angle quantized (3-bit angles for pairs of dimensions) Each pair of dimensions → 1 angle quantized to 8 levels
Implementations§
Source§impl QuantizedVector
impl QuantizedVector
Sourcepub fn dimensions(&self) -> usize
pub fn dimensions(&self) -> usize
Get the number of dimensions
Sourcepub fn memory_bytes(&self) -> usize
pub fn memory_bytes(&self) -> usize
Get memory usage in bytes
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