pub struct Fp16Codec { /* private fields */ }Expand description
IEEE 754 binary16: 2 bytes/dim. Hot-tier codec (~1e-3 relative error).
Conversion is implemented in-crate (no half dependency) with
round-to-nearest-even, matching hardware semantics.
Implementations§
Trait Implementations§
Source§impl VectorCodec for Fp16Codec
impl VectorCodec for Fp16Codec
Source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Bytes per encoded vector.
Source§fn encode(&self, v: &[f32]) -> Result<Vec<u8>>
fn encode(&self, v: &[f32]) -> Result<Vec<u8>>
Encode a vector. The blob is self-sufficient for scoring.
Source§fn decode(&self, blob: &[u8]) -> Result<Vec<f32>>
fn decode(&self, blob: &[u8]) -> Result<Vec<f32>>
Reconstruct an approximation (exact only for
Fp32).Source§fn distance(&self, a: &[u8], b: &[u8]) -> Result<f32>
fn distance(&self, a: &[u8], b: &[u8]) -> Result<f32>
Symmetric blob×blob distance under this codec’s metric.
Source§fn make_query(&self, q: &[f32]) -> Result<Box<dyn EncodedQuery>>
fn make_query(&self, q: &[f32]) -> Result<Box<dyn EncodedQuery>>
Prepare a query for repeated asymmetric scoring against blobs.
Auto Trait Implementations§
impl Freeze for Fp16Codec
impl RefUnwindSafe for Fp16Codec
impl Send for Fp16Codec
impl Sync for Fp16Codec
impl Unpin for Fp16Codec
impl UnsafeUnpin for Fp16Codec
impl UnwindSafe for Fp16Codec
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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