pub struct MatMut<'a, T: ReprMut> { /* private fields */ }Expand description
Implementations§
Source§impl<'a, T: ReprMut> MatMut<'a, T>
impl<'a, T: ReprMut> MatMut<'a, T>
Sourcepub fn new<U>(repr: T, data: &'a mut [U]) -> Result<Self, T::Error>where
T: NewMut<U>,
pub fn new<U>(repr: T, data: &'a mut [U]) -> Result<Self, T::Error>where
T: NewMut<U>,
Construct a new MatMut over data.
Sourcepub fn num_vectors(&self) -> usize
pub fn num_vectors(&self) -> usize
Returns the number of rows (vectors) in the matrix.
Sourcepub fn get_row(&self, i: usize) -> Option<T::Row<'_>>
pub fn get_row(&self, i: usize) -> Option<T::Row<'_>>
Returns an immutable reference to the i-th row, or None if out of bounds.
Sourcepub fn get_row_mut(&mut self, i: usize) -> Option<T::RowMut<'_>>
pub fn get_row_mut(&mut self, i: usize) -> Option<T::RowMut<'_>>
Returns a mutable reference to the i-th row, or None if out of bounds.
Sourcepub fn to_owned(&self) -> Mat<T>where
T: NewCloned,
pub fn to_owned(&self) -> Mat<T>where
T: NewCloned,
Return a Mat with the same contents as self.
Sourcepub unsafe fn from_raw_parts(repr: T, ptr: NonNull<u8>) -> Self
pub unsafe fn from_raw_parts(repr: T, ptr: NonNull<u8>) -> Self
Construct a new MatMut over the raw pointer and representation without performing
any validity checks.
§Safety
Argument ptr must point to memory compatible with Repr::layout.
Sourcepub fn as_raw_ptr(&self) -> *const u8
pub fn as_raw_ptr(&self) -> *const u8
Return the base pointer for the MatMut.
Trait Implementations§
Source§impl<'a, 'b, const NBITS: usize, T> CompressInto<MatRef<'a, Standard<T>>, MatMut<'b, MinMaxMeta<NBITS>>> for MinMaxQuantizer
impl<'a, 'b, const NBITS: usize, T> CompressInto<MatRef<'a, Standard<T>>, MatMut<'b, MinMaxMeta<NBITS>>> for MinMaxQuantizer
Source§fn compress_into(
&self,
from: MatRef<'a, Standard<T>>,
to: MatMut<'b, MinMaxMeta<NBITS>>,
) -> Result<(), Self::Error>
fn compress_into( &self, from: MatRef<'a, Standard<T>>, to: MatMut<'b, MinMaxMeta<NBITS>>, ) -> Result<(), Self::Error>
Compress a multi-vector of full-precision vectors into a multi-vector of MinMax quantized vectors.
This method iterates row by row over the input matrix, quantizing each full-precision vector into the corresponding row of the output MinMax matrix.
§Error
Returns InputContainsNaN error if any input vector contains NaN.
§Panics
Panics if:
from.num_vectors() != to.num_vectors(): The input and output must have the same number of vectors.from.vector_dim() != self.dim(): Each input vector must have the same dimensionality as the quantizer.- The output intrinsic dimension doesn’t match
self.output_dim().
Source§type Error = InputContainsNaN
type Error = InputContainsNaN
Source§impl<'this, 'a, T: ReprMut> ReborrowMut<'this> for MatMut<'a, T>
impl<'this, 'a, T: ReprMut> ReborrowMut<'this> for MatMut<'a, T>
impl<T> Send for MatMut<'_, T>
impl<T> Sync for MatMut<'_, T>
Auto Trait Implementations§
impl<'a, T> Freeze for MatMut<'a, T>where
T: Freeze,
impl<'a, T> RefUnwindSafe for MatMut<'a, T>where
T: RefUnwindSafe,
impl<'a, T> Unpin for MatMut<'a, T>where
T: Unpin,
impl<'a, T> !UnwindSafe for MatMut<'a, T>
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
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