pub struct MatrixBlockSliceMut<'a> {
limbs: *mut u64,
stride: NonZeroUsize,
_marker: PhantomData<&'a mut ()>,
}Expand description
A mutable non-contiguous view of a 64 x 64 block within a larger matrix.
§Safety
The limbs pointer must remain valid and exclusively accessible for the lifetime 'a, and must
point to at least 64 valid rows spaced stride limbs apart.
Fields§
§limbs: *mut u64§stride: NonZeroUsizeNumber of limbs between consecutive rows
_marker: PhantomData<&'a mut ()>Implementations§
Source§impl<'a> MatrixBlockSliceMut<'a>
impl<'a> MatrixBlockSliceMut<'a>
pub(super) fn new(limbs: *mut u64, stride: NonZeroUsize) -> Self
Sourcepub fn get_mut(&mut self, row: usize) -> &mut u64
pub fn get_mut(&mut self, row: usize) -> &mut u64
Returns a mutable reference to the limb at the given row.
§Safety
The pointer arithmetic self.limbs.add(row * self.stride) is safe because the constructor
guarantees 64 valid rows, and this method will panic in debug mode if row >= 64 (via debug
assertions in the caller).
Sourcepub fn iter_mut<'b>(
&'b mut self,
) -> impl Iterator<Item = &'b mut u64> + use<'a, 'b>
pub fn iter_mut<'b>( &'b mut self, ) -> impl Iterator<Item = &'b mut u64> + use<'a, 'b>
Returns a mutable iterator over the 64 rows of this block.
Sourcepub fn copy(&mut self) -> MatrixBlockSliceMut<'_>
pub fn copy(&mut self) -> MatrixBlockSliceMut<'_>
Creates a copy of this mutable slice with a shorter lifetime.
This is useful for splitting the lifetime when you need to pass the slice to a function that
doesn’t need to hold it for the full 'a lifetime.
Sourcepub fn as_slice(&self) -> MatrixBlockSlice<'_>
pub fn as_slice(&self) -> MatrixBlockSlice<'_>
Converts this mutable slice into an immutable slice.
Sourcepub fn assign(&mut self, block: MatrixBlock)
pub fn assign(&mut self, block: MatrixBlock)
Scatters a contiguous block into this non-contiguous slice.
This is the inverse of gather and is used to write GEMM results back into the parent
matrix.
pub fn zero_out(&mut self)
Trait Implementations§
impl Send for MatrixBlockSliceMut<'_>
Auto Trait Implementations§
impl<'a> Freeze for MatrixBlockSliceMut<'a>
impl<'a> RefUnwindSafe for MatrixBlockSliceMut<'a>
impl<'a> !Sync for MatrixBlockSliceMut<'a>
impl<'a> Unpin for MatrixBlockSliceMut<'a>
impl<'a> !UnwindSafe for MatrixBlockSliceMut<'a>
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