pub struct PQCode<const M: usize, const NBITS: usize>{
pub codes: [[u8; { _ }]; M],
}Expand description
Encoded representation from Product Quantization.
Stores M centroid indices, each using ceil(NBITS/8) bytes (byte-aligned).
- M: number of subquantizers
- NBITS: bits per centroid index
Examples:
PQCode<8, 8>: 8 subquantizers, 256 centroids each, 8 bytes totalPQCode<16, 10>: 16 subquantizers, 1024 centroids each, 32 bytes total
Fields§
§codes: [[u8; { _ }]; M]Raw byte storage: M * ceil(NBITS/8) bytes, stored as [[u8; B]; M]
Implementations§
Source§impl<const M: usize, const NBITS: usize> PQCode<M, NBITS>
impl<const M: usize, const NBITS: usize> PQCode<M, NBITS>
Sourcepub const BYTES_PER_CODE: usize
pub const BYTES_PER_CODE: usize
Bytes per centroid index
Sourcepub const TOTAL_BYTES: usize
pub const TOTAL_BYTES: usize
Total bytes for all M codes
Sourcepub fn from_indices(indices: &[u32]) -> Self
pub fn from_indices(indices: &[u32]) -> Self
Create from individual centroid indices
Trait Implementations§
Source§impl<const M: usize, const NBITS: usize> From<PQCode<M, NBITS>> for TensorProto
Available on crate feature proto only.
impl<const M: usize, const NBITS: usize> From<PQCode<M, NBITS>> for TensorProto
Available on crate feature
proto only.Source§impl<const M: usize, const NBITS: usize> TryFrom<TensorProto> for PQCode<M, NBITS>
Available on crate feature proto only.
impl<const M: usize, const NBITS: usize> TryFrom<TensorProto> for PQCode<M, NBITS>
Available on crate feature
proto only.Source§type Error = ProtoConversionError
type Error = ProtoConversionError
The type returned in the event of a conversion error.
impl<const M: usize, const NBITS: usize> Eq for PQCode<M, NBITS>
impl<const M: usize, const NBITS: usize> StructuralPartialEq for PQCode<M, NBITS>
Auto Trait Implementations§
impl<const M: usize, const NBITS: usize> Freeze for PQCode<M, NBITS>
impl<const M: usize, const NBITS: usize> RefUnwindSafe for PQCode<M, NBITS>
impl<const M: usize, const NBITS: usize> Send for PQCode<M, NBITS>
impl<const M: usize, const NBITS: usize> Sync for PQCode<M, NBITS>
impl<const M: usize, const NBITS: usize> Unpin for PQCode<M, NBITS>
impl<const M: usize, const NBITS: usize> UnsafeUnpin for PQCode<M, NBITS>
impl<const M: usize, const NBITS: usize> UnwindSafe for PQCode<M, NBITS>
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.