Skip to main content

BlockTransposed

Struct BlockTransposed 

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

  • Row — a Copy handle supporting Index<usize> and .iter().
  • RowMut — a mutable handle supporting IndexMut<usize>.

Implementations§

Source§

impl<T: Copy, const GROUP: usize, const PACK: usize> BlockTransposed<T, GROUP, PACK>

Source

pub fn as_view(&self) -> BlockTransposedRef<'_, T, GROUP, PACK>

Borrow as an immutable BlockTransposedRef.

Source

pub fn as_view_mut(&mut self) -> BlockTransposedMut<'_, T, GROUP, PACK>

Borrow as a mutable BlockTransposedMut.

Source

pub fn nrows(&self) -> usize

Source

pub fn ncols(&self) -> usize

Source

pub fn padded_ncols(&self) -> usize

Source

pub fn full_blocks(&self) -> usize

Source

pub fn num_blocks(&self) -> usize

Source

pub fn remainder(&self) -> usize

Source

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

Source

pub fn as_slice(&self) -> &[T]

Source

pub unsafe fn block_ptr_unchecked(&self, block: usize) -> *const T

Source

pub fn block(&self, block: usize) -> MatrixView<'_, T>

Source

pub fn remainder_block(&self) -> Option<MatrixView<'_, T>>

Source

pub fn get_element(&self, row: usize, col: usize) -> T

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 get_row(&self, i: usize) -> Option<Row<'_, T, GROUP, PACK>>

Get an immutable row view, or None if i is out of bounds.

Source

pub fn as_mut_slice(&mut self) -> &mut [T]

Source

pub fn block_mut(&mut self, block: usize) -> MutMatrixView<'_, T>

Source

pub fn remainder_block_mut(&mut self) -> Option<MutMatrixView<'_, T>>

Source

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>

Source

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.

Source

pub fn try_new(nrows: usize, ncols: usize) -> Result<Self, Overflow>

Fallible variant of new.

Source

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.

Source

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>

Source§

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

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

impl<T: Copy, const GROUP: usize, const PACK: usize> Index<(usize, usize)> for BlockTransposed<T, GROUP, PACK>

Source§

type Output = T

The returned type after indexing.
Source§

fn index(&self, (row, col): (usize, usize)) -> &Self::Output

Performs the indexing (container[index]) operation. Read more

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> 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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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