Trait BinaryMatrix

Source
pub trait BinaryMatrix {
Show 16 methods // Required methods fn nrows(&self) -> usize; fn ncols(&self) -> usize; fn expand(&mut self, new_rows: usize, new_cols: usize); fn transpose(&self) -> Box<dyn BinaryMatrix>; fn get(&self, r: usize, c: usize) -> u8; fn set(&mut self, r: usize, c: usize, val: u8); fn copy(&self) -> Box<dyn BinaryMatrix>; fn swap_columns(&mut self, c1: usize, c2: usize); fn xor_col(&mut self, c1: usize, c2: usize); // Provided methods fn left_kernel(&self) -> Option<Vec<BinaryDenseVector>> { ... } fn kernel(&self) -> Option<Vec<BinaryDenseVector>> { ... } fn left_mul(&self, result_vector: &BinaryDenseVector) -> BinaryDenseVector { ... } fn col(&self, c: usize) -> BinaryDenseVector { ... } fn add_col(&mut self, c1: usize, c2: usize) { ... } fn column_part_all_zero(&self, c: usize, maxr: usize) -> bool { ... } fn extract_column_part( &self, c: usize, maxr: usize, size: usize, ) -> BinaryDenseVector { ... }
}
Expand description

Trait for binary (GF(2)) matrices.

Required Methods§

Source

fn nrows(&self) -> usize

Number of rows.

Source

fn ncols(&self) -> usize

Number of columns.

Source

fn expand(&mut self, new_rows: usize, new_cols: usize)

Adds more rows and columns to the matrix.

Source

fn transpose(&self) -> Box<dyn BinaryMatrix>

Returns a new matrix that is the transpose of this matrix.

Source

fn get(&self, r: usize, c: usize) -> u8

Gets the value of the matrix at the row r and column c.

Source

fn set(&mut self, r: usize, c: usize, val: u8)

Sets the value of the matrix at the row r and column c to val.

Source

fn copy(&self) -> Box<dyn BinaryMatrix>

Returns a copy of this matrix.

Source

fn swap_columns(&mut self, c1: usize, c2: usize)

Swaps the columns of the matrix.

Source

fn xor_col(&mut self, c1: usize, c2: usize)

XORs the values of columns c2 into c1.

Provided Methods§

Source

fn left_kernel(&self) -> Option<Vec<BinaryDenseVector>>

Compute the left kernel of the matrix. Uses using basic algorithm, using Gaussian elimination, from https://en.wikipedia.org/wiki/Kernel_(linear_algebra)#Computation_by_Gaussian_elimination

Source

fn kernel(&self) -> Option<Vec<BinaryDenseVector>>

Compute the kernel (right nullspace) of the matrix. Uses the basic algorithm, using Gaussian elimination, from https://en.wikipedia.org/wiki/Kernel_(linear_algebra)#Computation_by_Gaussian_elimination

Source

fn left_mul(&self, result_vector: &BinaryDenseVector) -> BinaryDenseVector

Multiplies the given matrix on the left by the dense vector.

Source

fn col(&self, c: usize) -> BinaryDenseVector

Returns a copy of the column as a BinaryDenseVector.

Source

fn add_col(&mut self, c1: usize, c2: usize)

Alias for xor_col.

Source

fn column_part_all_zero(&self, c: usize, maxr: usize) -> bool

Returns true if the given column is zero between 0 < maxr.

Source

fn extract_column_part( &self, c: usize, maxr: usize, size: usize, ) -> BinaryDenseVector

Returns a vector of the given column from maxr < maxr+size.

Trait Implementations§

Source§

impl Debug for dyn BinaryMatrix

Source§

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

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

impl Index<(usize, usize)> for &dyn BinaryMatrix

Source§

type Output = u8

The returned type after indexing.
Source§

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

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

impl Index<(usize, usize)> for dyn BinaryMatrix

Source§

type Output = u8

The returned type after indexing.
Source§

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

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

impl PartialEq for &dyn BinaryMatrix

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
Source§

fn ne(&self, other: &Self) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for &dyn BinaryMatrix

Implementors§