pub struct BlockTransposedRef<'a, T: Copy, const GROUP: usize, const PACK: usize = 1> { /* private fields */ }Expand description
A shared (immutable) view of a block-transposed matrix.
Created by BlockTransposed::as_view.
Implementations§
Source§impl<'a, T: Copy, const GROUP: usize, const PACK: usize> BlockTransposedRef<'a, T, GROUP, PACK>
impl<'a, T: Copy, const GROUP: usize, const PACK: usize> BlockTransposedRef<'a, T, GROUP, PACK>
Sourcepub fn padded_ncols(&self) -> usize
pub fn padded_ncols(&self) -> usize
Returns the number of physical (padded) columns.
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 full_blocks(&self) -> usize
pub fn full_blocks(&self) -> usize
Number of completely full blocks.
Sourcepub fn num_blocks(&self) -> usize
pub fn num_blocks(&self) -> usize
Total number of blocks including any partially-filled tail.
Sourcepub fn remainder(&self) -> usize
pub fn remainder(&self) -> usize
Number of valid elements in the last partially-full block, or 0 if all blocks are full.
Sourcepub fn as_slice(&self) -> &'a [T]
pub fn as_slice(&self) -> &'a [T]
Return the backing data as a shared slice.
The returned slice has storage_len() elements — this includes all padding
for partial blocks and column-group alignment.
Sourcepub unsafe fn block_ptr_unchecked(&self, block: usize) -> *const T
pub unsafe fn block_ptr_unchecked(&self, block: usize) -> *const T
Return a pointer to the start of the given block.
The caller may assume that for the returned pointer ptr,
[ptr, ptr + GROUP * padded_ncols) points to valid memory, even for the
remainder block.
§Safety
block must be less than self.num_blocks(). No bounds check is
performed in release builds; callers must verify the index themselves
(e.g. by iterating 0..self.num_blocks()).
Sourcepub fn block(&self, block: usize) -> MatrixView<'a, T>
pub fn block(&self, block: usize) -> MatrixView<'a, T>
Return a view over a full block as a MatrixView.
The returned view has padded_ncols / PACK rows and GROUP * PACK
columns. For PACK == 1 this simplifies to ncols rows and GROUP
columns (the standard transposed interpretation).
§Panics
Panics if block >= self.full_blocks().
Sourcepub fn remainder_block(&self) -> Option<MatrixView<'a, T>>
pub fn remainder_block(&self) -> Option<MatrixView<'a, T>>
Return a view over the remainder block, or None if there is no
remainder.
The returned view has the same dimensions as block():
padded_ncols / PACK rows and GROUP * PACK columns.
Sourcepub fn get_element(&self, row: usize, col: usize) -> T
pub fn get_element(&self, row: usize, col: usize) -> T
Retrieve the value at the logical (row, col).
§Panics
Panics if row >= self.nrows() or col >= self.ncols().
Trait Implementations§
Source§impl<'a, T: Clone + Copy, const GROUP: usize, const PACK: usize> Clone for BlockTransposedRef<'a, T, GROUP, PACK>
impl<'a, T: Clone + Copy, const GROUP: usize, const PACK: usize> Clone for BlockTransposedRef<'a, T, GROUP, PACK>
Source§fn clone(&self) -> BlockTransposedRef<'a, T, GROUP, PACK>
fn clone(&self) -> BlockTransposedRef<'a, T, GROUP, PACK>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'a, T: Debug + Copy, const GROUP: usize, const PACK: usize> Debug for BlockTransposedRef<'a, T, GROUP, PACK>
impl<'a, T: Debug + Copy, const GROUP: usize, const PACK: usize> Debug for BlockTransposedRef<'a, T, GROUP, PACK>
impl<'a, T: Copy + Copy, const GROUP: usize, const PACK: usize> Copy for BlockTransposedRef<'a, T, GROUP, PACK>
Auto Trait Implementations§
impl<'a, T, const GROUP: usize, const PACK: usize> Freeze for BlockTransposedRef<'a, T, GROUP, PACK>
impl<'a, T, const GROUP: usize, const PACK: usize> RefUnwindSafe for BlockTransposedRef<'a, T, GROUP, PACK>where
T: RefUnwindSafe,
impl<'a, T, const GROUP: usize, const PACK: usize> Send for BlockTransposedRef<'a, T, GROUP, PACK>where
T: Send,
impl<'a, T, const GROUP: usize, const PACK: usize> Sync for BlockTransposedRef<'a, T, GROUP, PACK>where
T: Sync,
impl<'a, T, const GROUP: usize, const PACK: usize> Unpin for BlockTransposedRef<'a, T, GROUP, PACK>where
T: Unpin,
impl<'a, T, const GROUP: usize, const PACK: usize> UnsafeUnpin for BlockTransposedRef<'a, T, GROUP, PACK>
impl<'a, T, const GROUP: usize, const PACK: usize> UnwindSafe for BlockTransposedRef<'a, T, GROUP, PACK>where
T: UnwindSafe + RefUnwindSafe,
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> 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>
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