pub struct MinMaxMeta<const NBITS: usize> { /* private fields */ }Expand description
Metadata for MinMax quantized multi-vectors.
Stores the intrinsic dimension (output dimension after transform) which is
needed to interpret each row of the quantized data. The row stride in bytes
is computed as [Data::<NBITS>::canonical_bytes(intrinsic_dim)].
Implementations§
Source§impl<const NBITS: usize> MinMaxMeta<NBITS>where
Unsigned: Representation<NBITS>,
impl<const NBITS: usize> MinMaxMeta<NBITS>where
Unsigned: Representation<NBITS>,
Sourcepub fn new(nrows: usize, intrinsic_dim: usize) -> Self
pub fn new(nrows: usize, intrinsic_dim: usize) -> Self
Creates new MinMax metadata with the given number of rows and intrinsic dimension.
Sourcepub fn intrinsic_dim(&self) -> usize
pub fn intrinsic_dim(&self) -> usize
Returns the intrinsic_dim
Sourcepub fn ncols(&self) -> usize
pub fn ncols(&self) -> usize
Returns the number of bytes from a canonical repr of a minmax quantized vector, see minmax::Data::canonical_bytes
Trait Implementations§
Source§impl<const NBITS: usize> Clone for MinMaxMeta<NBITS>
impl<const NBITS: usize> Clone for MinMaxMeta<NBITS>
Source§fn clone(&self) -> MinMaxMeta<NBITS>
fn clone(&self) -> MinMaxMeta<NBITS>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<const NBITS: usize> Debug for MinMaxMeta<NBITS>
impl<const NBITS: usize> Debug for MinMaxMeta<NBITS>
Source§impl<const NBITS: usize> NewMut<u8> for MinMaxMeta<NBITS>where
Unsigned: Representation<NBITS>,
impl<const NBITS: usize> NewMut<u8> for MinMaxMeta<NBITS>where
Unsigned: Representation<NBITS>,
Source§impl<const NBITS: usize> NewOwned<Defaulted> for MinMaxMeta<NBITS>where
Unsigned: Representation<NBITS>,
impl<const NBITS: usize> NewOwned<Defaulted> for MinMaxMeta<NBITS>where
Unsigned: Representation<NBITS>,
Source§impl<const NBITS: usize> NewRef<u8> for MinMaxMeta<NBITS>where
Unsigned: Representation<NBITS>,
impl<const NBITS: usize> NewRef<u8> for MinMaxMeta<NBITS>where
Unsigned: Representation<NBITS>,
Source§impl<const NBITS: usize> Repr for MinMaxMeta<NBITS>where
Unsigned: Representation<NBITS>,
impl<const NBITS: usize> Repr for MinMaxMeta<NBITS>where
Unsigned: Representation<NBITS>,
Source§fn layout(&self) -> Result<Layout, LayoutError>
fn layout(&self) -> Result<Layout, LayoutError>
Returns Layout for for allocating crate::minmax::Data
§Safety
crate::minmax::MinMaxCompensationdoes not require alignment since it is always accessed by copying bytes first before casting.
Source§unsafe fn get_row<'a>(self, ptr: NonNull<u8>, i: usize) -> Self::Row<'a>
unsafe fn get_row<'a>(self, ptr: NonNull<u8>, i: usize) -> Self::Row<'a>
Returns an immutable reference to the i-th row.
§Safety
- The original pointer must point to a valid allocation of at least
std::mem::size_of::<u8>() * self.nrows() * self.ncols()bytes for lifetime'a. imust be less thanself.nrows.
Source§type Row<'a> = VectorBase<NBITS, Unsigned, SlicePtr<'a, u8>, Ref<'a, MinMaxCompensation>>
type Row<'a> = VectorBase<NBITS, Unsigned, SlicePtr<'a, u8>, Ref<'a, MinMaxCompensation>>
Immutable row reference type.
Source§impl<const NBITS: usize> ReprMut for MinMaxMeta<NBITS>where
Unsigned: Representation<NBITS>,
impl<const NBITS: usize> ReprMut for MinMaxMeta<NBITS>where
Unsigned: Representation<NBITS>,
Source§unsafe fn get_row_mut<'a>(self, ptr: NonNull<u8>, i: usize) -> Self::RowMut<'a>
unsafe fn get_row_mut<'a>(self, ptr: NonNull<u8>, i: usize) -> Self::RowMut<'a>
Returns a mutable reference to the i-th row.
§Safety
- The original pointer must point to a valid allocation of at least
std::mem::size_of::<u8>() * self.bytes()bytes for lifetime'a. imust be less thanself.nrows.- Caller must make sure they have exclusive access to the row
Source§type RowMut<'a> = VectorBase<NBITS, Unsigned, MutSlicePtr<'a, u8>, Mut<'a, MinMaxCompensation>>
type RowMut<'a> = VectorBase<NBITS, Unsigned, MutSlicePtr<'a, u8>, Mut<'a, MinMaxCompensation>>
Mutable row reference type.
Source§impl<const NBITS: usize> ReprOwned for MinMaxMeta<NBITS>where
Unsigned: Representation<NBITS>,
impl<const NBITS: usize> ReprOwned for MinMaxMeta<NBITS>where
Unsigned: Representation<NBITS>,
impl<const NBITS: usize> Copy for MinMaxMeta<NBITS>
Auto Trait Implementations§
impl<const NBITS: usize> Freeze for MinMaxMeta<NBITS>
impl<const NBITS: usize> RefUnwindSafe for MinMaxMeta<NBITS>
impl<const NBITS: usize> Send for MinMaxMeta<NBITS>
impl<const NBITS: usize> Sync for MinMaxMeta<NBITS>
impl<const NBITS: usize> Unpin for MinMaxMeta<NBITS>
impl<const NBITS: usize> UnsafeUnpin for MinMaxMeta<NBITS>
impl<const NBITS: usize> UnwindSafe for MinMaxMeta<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<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