pub struct FibQuantizer { /* private fields */ }Expand description
FibQuant encoder/decoder bound to one profile and codebook.
Implementations§
Source§impl FibQuantizer
impl FibQuantizer
Sourcepub fn new(profile: FibQuantProfileV1) -> Result<Self>
pub fn new(profile: FibQuantProfileV1) -> Result<Self>
Build a quantizer by constructing the profile codebook.
Sourcepub fn from_codebook(codebook: FibCodebookV1) -> Result<Self>
pub fn from_codebook(codebook: FibCodebookV1) -> Result<Self>
Build a quantizer from a validated codebook.
Sourcepub fn profile(&self) -> &FibQuantProfileV1
pub fn profile(&self) -> &FibQuantProfileV1
Access the profile.
Sourcepub fn codebook(&self) -> &FibCodebookV1
pub fn codebook(&self) -> &FibCodebookV1
Access the codebook.
Sourcepub fn encode(&self, x: &[f32]) -> Result<FibCodeV1>
pub fn encode(&self, x: &[f32]) -> Result<FibCodeV1>
Encode a vector into a fixed-rate artifact.
Sourcepub fn encode_with_receipt(
&self,
x: &[f32],
) -> Result<(FibCodeV1, FibQuantCompressionReceiptV1)>
pub fn encode_with_receipt( &self, x: &[f32], ) -> Result<(FibCodeV1, FibQuantCompressionReceiptV1)>
Encode and emit a receipt.
Sourcepub fn reconstruction_mse(&self, x: &[f32]) -> Result<f64>
pub fn reconstruction_mse(&self, x: &[f32]) -> Result<f64>
Reconstruction MSE for one vector.
Sourcepub fn cosine_similarity(&self, x: &[f32]) -> Result<f64>
pub fn cosine_similarity(&self, x: &[f32]) -> Result<f64>
Reconstruction cosine similarity for one vector.
Trait Implementations§
Source§impl Clone for FibQuantizer
impl Clone for FibQuantizer
Source§fn clone(&self) -> FibQuantizer
fn clone(&self) -> FibQuantizer
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for FibQuantizer
impl RefUnwindSafe for FibQuantizer
impl Send for FibQuantizer
impl Sync for FibQuantizer
impl Unpin for FibQuantizer
impl UnsafeUnpin for FibQuantizer
impl UnwindSafe for FibQuantizer
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<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.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.