pub struct PqCodebook {
pub centroids: Vec<Vec<Vec<f32>>>,
pub num_subvectors: usize,
pub subvector_dim: usize,
}Expand description
A simple product quantization codebook.
Each subvector has 256 centroids. During encoding, each subvector is mapped to its nearest centroid. During decoding, the centroid values are concatenated to reconstruct the approximation.
Fields§
§centroids: Vec<Vec<Vec<f32>>>Centroids indexed by [subvector_index][centroid_index]. Each centroid is a flat vector of subvector_dim floats.
num_subvectors: usizeNumber of subvectors.
subvector_dim: usizeDimension per subvector.
Implementations§
Source§impl PqCodebook
impl PqCodebook
Trait Implementations§
Source§impl Clone for PqCodebook
impl Clone for PqCodebook
Source§fn clone(&self) -> PqCodebook
fn clone(&self) -> PqCodebook
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 PqCodebook
impl Debug for PqCodebook
Source§impl<'de> Deserialize<'de> for PqCodebook
impl<'de> Deserialize<'de> for PqCodebook
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 PqCodebook
impl RefUnwindSafe for PqCodebook
impl Send for PqCodebook
impl Sync for PqCodebook
impl Unpin for PqCodebook
impl UnsafeUnpin for PqCodebook
impl UnwindSafe for PqCodebook
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> 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