Skip to main content

GfMatrix

Struct GfMatrix 

Source
pub struct GfMatrix { /* private fields */ }
Expand description

Row-major GF(2⁸) matrix backed by a 64-byte aligned AlignedBuffer.

Each row occupies stride bytes where stride is cols rounded up to the next multiple of ALIGN (64). Padding bytes at the end of each row are always zero and are never used in arithmetic.

Implementations§

Source§

impl GfMatrix

Source

pub fn padded_stride(cols: usize) -> usize

Compute the padded row stride for cols data columns.

Source

pub fn zeros(rows: usize, cols: usize) -> Self

Allocate a zero matrix of size rows × cols with aligned rows.

Source

pub fn identity(k: usize) -> Self

Allocate a k × k identity matrix with aligned rows.

Source

pub fn rows(&self) -> usize

Number of data columns (not including stride padding).

Source

pub fn cols(&self) -> usize

Number of data rows.

Source

pub fn stride(&self) -> usize

Padded row stride in bytes.

Source

pub fn row(&self, r: usize) -> &[u8]

Raw access to row r as a data slice (length = cols, 64-byte aligned).

Source

pub fn row_mut(&mut self, r: usize) -> &mut [u8]

Mutable access to row r (64-byte aligned).

Source

pub fn row_axpy(&mut self, dst: usize, c: u8, src: usize)

dst_row[i] ^= c * src_row[i] — both rows are 64-byte aligned, so the SIMD kernel always takes the aligned fast path.

§Panics

Panics if dst == src (would create overlapping views).

Source

pub fn row_scale(&mut self, r: usize, c: u8)

Scale row r by scalar c using SIMD kernel::scale_inplace.

Source

pub fn swap_rows(&mut self, a: usize, b: usize)

Swap rows a and b.

Source

pub fn gaussian_elimination(&mut self) -> usize

In-place Gaussian elimination (full RREF). Returns the rank.

Source

pub fn is_full_rank(&self) -> bool

True if no row is all-zero (quick non-full-rank check).

Auto Trait Implementations§

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