Skip to main content

MinMaxMeta

Struct MinMaxMeta 

Source
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>,

Source

pub fn new(nrows: usize, intrinsic_dim: usize) -> Self

Creates new MinMax metadata with the given number of rows and intrinsic dimension.

Source

pub fn intrinsic_dim(&self) -> usize

Returns the intrinsic_dim

Source

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>

Source§

fn clone(&self) -> MinMaxMeta<NBITS>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<const NBITS: usize> Debug for MinMaxMeta<NBITS>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<const NBITS: usize> NewMut<u8> for MinMaxMeta<NBITS>
where Unsigned: Representation<NBITS>,

Source§

type Error = SliceError

Errors that can occur when initializing.
Source§

fn new_mut(self, slice: &mut [u8]) -> Result<MatMut<'_, Self>, Self::Error>

Create a new MatMut over slice.
Source§

impl<const NBITS: usize> NewOwned<Defaulted> for MinMaxMeta<NBITS>
where Unsigned: Representation<NBITS>,

Source§

type Error = Infallible

Errors that can occur when initializing.
Source§

fn new_owned(self, _: Defaulted) -> Result<Mat<Self>, Self::Error>

Create a new Mat initialized with init.
Source§

impl<const NBITS: usize> NewRef<u8> for MinMaxMeta<NBITS>
where Unsigned: Representation<NBITS>,

Source§

type Error = SliceError

Errors that can occur when initializing.
Source§

fn new_ref(self, slice: &[u8]) -> Result<MatRef<'_, Self>, Self::Error>

Create a new MatRef over slice.
Source§

impl<const NBITS: usize> Repr for MinMaxMeta<NBITS>
where Unsigned: Representation<NBITS>,

Source§

fn layout(&self) -> Result<Layout, LayoutError>

Returns Layout for for allocating crate::minmax::Data

§Safety
Source§

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.
  • i must be less than self.nrows.
Source§

type Row<'a> = VectorBase<NBITS, Unsigned, SlicePtr<'a, u8>, Ref<'a, MinMaxCompensation>>

Immutable row reference type.
Source§

fn nrows(&self) -> usize

Returns the number of rows in the matrix. Read more
Source§

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>

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.
  • i must be less than self.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>>

Mutable row reference type.
Source§

impl<const NBITS: usize> ReprOwned for MinMaxMeta<NBITS>
where Unsigned: Representation<NBITS>,

Source§

unsafe fn drop(self, ptr: NonNull<u8>)

Deallocates the memory pointed to by ptr.

§Safety:
  • The caller guarantees that ptr was allocated with the correct layout.
Source§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ByRef<T> for T

Source§

fn by_ref(&self) -> &T

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Generator<T> for T
where T: Clone,

Source§

fn generate(&mut self) -> T

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> AsyncFriendly for T
where T: Send + Sync + 'static,