pub struct BlockTransposed<T: Copy, const GROUP: usize, const PACK: usize = 1> { /* private fields */ }Expand description
An owning block-transposed matrix.
Wraps an owned allocation of T elements laid out in block-transposed order.
See the module-level documentation for layout details.
For shared and mutable views, see BlockTransposedRef and BlockTransposedMut.
§Row Types
Because rows are not contiguous in memory, the row types are view structs:
Implementations§
Source§impl<T: Copy, const GROUP: usize, const PACK: usize> BlockTransposed<T, GROUP, PACK>
impl<T: Copy, const GROUP: usize, const PACK: usize> BlockTransposed<T, GROUP, PACK>
Sourcepub fn as_view(&self) -> BlockTransposedRef<'_, T, GROUP, PACK>
pub fn as_view(&self) -> BlockTransposedRef<'_, T, GROUP, PACK>
Borrow as an immutable BlockTransposedRef.
Sourcepub fn as_view_mut(&mut self) -> BlockTransposedMut<'_, T, GROUP, PACK>
pub fn as_view_mut(&mut self) -> BlockTransposedMut<'_, T, GROUP, PACK>
Borrow as a mutable BlockTransposedMut.
Sourcepub fn padded_ncols(&self) -> usize
pub fn padded_ncols(&self) -> usize
Sourcepub fn full_blocks(&self) -> usize
pub fn full_blocks(&self) -> usize
Sourcepub fn num_blocks(&self) -> usize
pub fn num_blocks(&self) -> usize
Sourcepub unsafe fn block_ptr_unchecked(&self, block: usize) -> *const T
pub unsafe fn block_ptr_unchecked(&self, block: usize) -> *const T
Sourcepub fn block(&self, block: usize) -> MatrixView<'_, T>
pub fn block(&self, block: usize) -> MatrixView<'_, T>
Sourcepub fn remainder_block(&self) -> Option<MatrixView<'_, T>>
pub fn remainder_block(&self) -> Option<MatrixView<'_, T>>
Sourcepub fn get_element(&self, row: usize, col: usize) -> T
pub fn get_element(&self, row: usize, col: usize) -> T
Sourcepub const fn group_size(&self) -> usize
pub const fn group_size(&self) -> usize
Group size (blocking factor GROUP).
Sourcepub const fn const_group_size() -> usize
pub const fn const_group_size() -> usize
Group size (blocking factor GROUP) as a const function on the type.
Sourcepub fn get_row(&self, i: usize) -> Option<Row<'_, T, GROUP, PACK>>
pub fn get_row(&self, i: usize) -> Option<Row<'_, T, GROUP, PACK>>
Get an immutable row view, or None if i is out of bounds.
Sourcepub fn as_mut_slice(&mut self) -> &mut [T]
pub fn as_mut_slice(&mut self) -> &mut [T]
Sourcepub fn block_mut(&mut self, block: usize) -> MutMatrixView<'_, T>
pub fn block_mut(&mut self, block: usize) -> MutMatrixView<'_, T>
Sourcepub fn remainder_block_mut(&mut self) -> Option<MutMatrixView<'_, T>>
pub fn remainder_block_mut(&mut self) -> Option<MutMatrixView<'_, T>>
Sourcepub fn get_row_mut(&mut self, i: usize) -> Option<RowMut<'_, T, GROUP, PACK>>
pub fn get_row_mut(&mut self, i: usize) -> Option<RowMut<'_, T, GROUP, PACK>>
Get a mutable row view, or None if i is out of bounds.
Source§impl<T: Copy + Default, const GROUP: usize, const PACK: usize> BlockTransposed<T, GROUP, PACK>
impl<T: Copy + Default, const GROUP: usize, const PACK: usize> BlockTransposed<T, GROUP, PACK>
Sourcepub fn new(nrows: usize, ncols: usize) -> Self
pub fn new(nrows: usize, ncols: usize) -> Self
Construct a default-initialized block-transposed matrix from dimensions.
§Panics
Panics if the dimensions overflow the allocation budget.
Sourcepub fn from_strided(v: StridedView<'_, T>) -> Self
pub fn from_strided(v: StridedView<'_, T>) -> Self
Construct a block-transposed matrix by copying data from a StridedView.
Each source element at (row, col) is placed at the correct offset in the
block-transposed layout. Padding positions (both partial-block rows and
column-group padding when ncols % PACK != 0) are filled with
T::default().
The loop iterates in physical (block-transposed) order — block, column-group,
row-within-block, pack-lane — so that writes to the backing allocation are
sequential. Source reads stride across rows of the StridedView, which is
acceptable because read-side prefetch is more effective than write-side.
Sourcepub fn from_matrix_view(v: MatrixView<'_, T>) -> Self
pub fn from_matrix_view(v: MatrixView<'_, T>) -> Self
Construct a block-transposed matrix by copying data from a MatrixView.
Trait Implementations§
Source§impl<T: Debug + Copy, const GROUP: usize, const PACK: usize> Debug for BlockTransposed<T, GROUP, PACK>
impl<T: Debug + Copy, const GROUP: usize, const PACK: usize> Debug for BlockTransposed<T, GROUP, PACK>
Auto Trait Implementations§
impl<T, const GROUP: usize, const PACK: usize> Freeze for BlockTransposed<T, GROUP, PACK>
impl<T, const GROUP: usize, const PACK: usize> RefUnwindSafe for BlockTransposed<T, GROUP, PACK>where
T: RefUnwindSafe,
impl<T, const GROUP: usize, const PACK: usize> Send for BlockTransposed<T, GROUP, PACK>where
T: Send,
impl<T, const GROUP: usize, const PACK: usize> Sync for BlockTransposed<T, GROUP, PACK>where
T: Sync,
impl<T, const GROUP: usize, const PACK: usize> Unpin for BlockTransposed<T, GROUP, PACK>where
T: Unpin,
impl<T, const GROUP: usize, const PACK: usize> UnsafeUnpin for BlockTransposed<T, GROUP, PACK>
impl<T, const GROUP: usize, const PACK: usize> UnwindSafe for BlockTransposed<T, GROUP, PACK>where
T: UnwindSafe,
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