Skip to main content

BlockTransposedRef

Struct BlockTransposedRef 

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

Source

pub fn nrows(&self) -> usize

Returns the number of logical rows.

Source

pub fn ncols(&self) -> usize

Returns the number of logical columns (dimensionality).

Source

pub fn padded_ncols(&self) -> usize

Returns the number of physical (padded) columns.

Source

pub const fn group_size(&self) -> usize

Group size (blocking factor GROUP).

Source

pub const fn const_group_size() -> usize

Group size (blocking factor GROUP) as a const function on the type.

Source

pub const fn pack_size(&self) -> usize

Packing factor PACK.

Source

pub fn full_blocks(&self) -> usize

Number of completely full blocks.

Source

pub fn num_blocks(&self) -> usize

Total number of blocks including any partially-filled tail.

Source

pub fn remainder(&self) -> usize

Number of valid elements in the last partially-full block, or 0 if all blocks are full.

Source

pub fn as_ptr(&self) -> *const T

Return a raw typed pointer to the start of the backing data.

Source

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.

Source

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()).

Source

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().

Source

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.

Source

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().

Source

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.

Trait Implementations§

Source§

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>

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<'a, T: Debug + Copy, const GROUP: usize, const PACK: usize> Debug for BlockTransposedRef<'a, T, GROUP, PACK>

Source§

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

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

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>

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,