pub struct VTable { /* private fields */ }Expand description
A distance VTable for a PaddedTable.
See: PaddedTable::vtable.
Implementations§
Source§impl VTable
impl VTable
Sourcepub fn distance(
&self,
padded: &PaddedTable,
vector: &[f32],
codes: &[u8],
) -> Result<f32, DistanceError>
pub fn distance( &self, padded: &PaddedTable, vector: &[f32], codes: &[u8], ) -> Result<f32, DistanceError>
Compute the distance between vector and the PQ vector encoded by codes.
§Errors
Returns an error if:
vector.len() != padded.dim()codes.len() != padded.nchunks()- Any element in
codesis equal to or greater thanpadded.ncenters().
In addition, an error may be returned if self was created for a different
PaddedTable. Mixing VTables in this way is not a safety issue, but is also
not guaranteed to work.
Sourcepub fn self_distance(
&self,
padded: &PaddedTable,
a: &[u8],
b: &[u8],
) -> Result<f32, SelfDistanceError>
pub fn self_distance( &self, padded: &PaddedTable, a: &[u8], b: &[u8], ) -> Result<f32, SelfDistanceError>
Compute the distance between two compressed vectors.
§Errors
Returns an error if:
a.len() != padded.nchunks()b.len() != padded.nchunks()- Any element in
aorbis equal to or greater thanpadded.ncenters().
In addition, an error may be returned if self was created for a different
PaddedTable. Mixing VTables in this way is not a safety issue, but is also
not guaranteed to work.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for VTable
impl RefUnwindSafe for VTable
impl Send for VTable
impl Sync for VTable
impl Unpin for VTable
impl UnsafeUnpin for VTable
impl UnwindSafe for VTable
Blanket Implementations§
impl<T> AsyncFriendly for T
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> 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