#[repr(C)]pub struct DataMeta {
pub inner_product_correction: f16,
pub metric_specific: f16,
pub bit_sum: u16,
}Expand description
Metadata for correcting quantization for computing distances among quant vectors.
Fields§
§inner_product_correction: f16This is the whole term
|X| * a / <x', x>and represents the entires correction factor for computing inner products on the representation
bx + bwhere bx is unsigned binary encoding of the vector and b (obtained from
Self::offset_term) is the compression offset.
metric_specific: f16A metric-specific correction term. Refer to the module level documentation to understand the implication of the terms outlined here.
| Squared L2 | |X|^2 |
| Inner Product | <X', C> |
bit_sum: u16Two times the sum of the ones in the binary representation of the transformed unit vector.
This is the term sum(bx) in the module level documentation.
Implementations§
Source§impl DataMeta
impl DataMeta
Sourcepub fn new(
inner_product_correction: f32,
metric_specific: f32,
bit_sum: u32,
) -> Result<Self, DataMetaError>
pub fn new( inner_product_correction: f32, metric_specific: f32, bit_sum: u32, ) -> Result<Self, DataMetaError>
Construct a new metadata from components.
This will internally convert the f32 values to f16.
Sourcepub fn to_full<A>(self, arch: A) -> DataMetaF32where
A: Architecture,
pub fn to_full<A>(self, arch: A) -> DataMetaF32where
A: Architecture,
Convert the values in self to their full precision representation for computation.
Trait Implementations§
impl Copy for DataMeta
impl Pod for DataMeta
impl StructuralPartialEq for DataMeta
Auto Trait Implementations§
impl Freeze for DataMeta
impl RefUnwindSafe for DataMeta
impl Send for DataMeta
impl Sync for DataMeta
impl Unpin for DataMeta
impl UnwindSafe for DataMeta
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
Source§impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
Source§type Bits = T
type Bits = T
Self must have the same layout as the specified Bits except for
the possible invalid bit patterns being checked during
is_valid_bit_pattern.Source§fn is_valid_bit_pattern(_bits: &T) -> bool
fn is_valid_bit_pattern(_bits: &T) -> bool
bits
as &Self.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>
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>
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