pub struct PaddedTable { /* private fields */ }Expand description
A PQ table that stores pivots grouped by chunk in the following dense, row-major form:
| -- pivot 0 -- | -- pivot 1 -- | .... | -- pivot K-1 -- |
+------------------+------------------+------+--------------------+
chunk 0 | c000 c001 ... 0X | c010 c011 ... 0X | .... | c0K0 c0K1 ... 0X |
chunk 1 | c100 c101 ... 0X | c110 c111 ... 0X | .... | c1K0 c1K1 ... 0X |
... | ... | ... | .... | ... |
chunk N-1 | cN00 cN01 ... 0X | cN10 cN11 ... 0X | .... | cNK0 cNK1 ... 0X |where cCPD is dimension D of pivot P in chunk C, and trailing 0Xs denote
potential zero-padding to the SIMD-aligned pivot width.
The member offsets describes the number of unpadded dimensions of each chunk.
Importantly, though, the storage for each pivot is rounded up to a multiple of the runtime system’s preferred SIMD width and all pivots are padded to the same length. This makes distance computations between pivots very fast when computing distances between two product-quantized vectors.
Implementations§
Source§impl PaddedTable
impl PaddedTable
Sourcepub fn from_basic(basic: BasicTableView<'_>) -> Self
pub fn from_basic(basic: BasicTableView<'_>) -> Self
Construct a PaddedTable with the same contents as basic.
Sourcepub fn vtable(&self, metric: Metric) -> VTable
pub fn vtable(&self, metric: Metric) -> VTable
Return the distance VTable for the requested Metric.
Note that VTables are generally specific to the PaddedTable that generated
them and cannot be reliably shared with different tables.
While this is not a safety issue, incorrect VTables may yield errors due to
mismatched SIMD widths.
Trait Implementations§
Source§impl Clone for PaddedTable
impl Clone for PaddedTable
Auto Trait Implementations§
impl Forget for PaddedTable
impl Freeze for PaddedTable
impl Move for PaddedTable
impl RefUnwindSafe for PaddedTable
impl Send for PaddedTable
impl Sync for PaddedTable
impl Unpin for PaddedTable
impl UnsafeUnpin for PaddedTable
impl UnwindSafe for PaddedTable
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
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> ⓘ
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