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

§

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

§

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

This method tests for self and other values to be equal, and is used by ==.
source§

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

This method 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§