Trait binary_matrix::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§
sourcefn expand(&mut self, new_rows: usize, new_cols: usize)
fn expand(&mut self, new_rows: usize, new_cols: usize)
Adds more rows and columns to the matrix.
sourcefn transpose(&self) -> Box<dyn BinaryMatrix>
fn transpose(&self) -> Box<dyn BinaryMatrix>
Returns a new matrix that is the transpose of this matrix.
sourcefn get(&self, r: usize, c: usize) -> u8
fn get(&self, r: usize, c: usize) -> u8
Gets the value of the matrix at the row r and column c.
sourcefn set(&mut self, r: usize, c: usize, val: u8)
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.
sourcefn copy(&self) -> Box<dyn BinaryMatrix>
fn copy(&self) -> Box<dyn BinaryMatrix>
Returns a copy of this matrix.
sourcefn swap_columns(&mut self, c1: usize, c2: usize)
fn swap_columns(&mut self, c1: usize, c2: usize)
Swaps the columns of the matrix.
Provided Methods§
sourcefn left_kernel(&self) -> Option<Vec<BinaryDenseVector>>
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
sourcefn kernel(&self) -> Option<Vec<BinaryDenseVector>>
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
sourcefn left_mul(&self, result_vector: &BinaryDenseVector) -> BinaryDenseVector
fn left_mul(&self, result_vector: &BinaryDenseVector) -> BinaryDenseVector
Multiplies the given matrix on the left by the dense vector.
sourcefn col(&self, c: usize) -> BinaryDenseVector
fn col(&self, c: usize) -> BinaryDenseVector
Returns a copy of the column as a BinaryDenseVector.
sourcefn column_part_all_zero(&self, c: usize, maxr: usize) -> bool
fn column_part_all_zero(&self, c: usize, maxr: usize) -> bool
Returns true if the given column is zero between 0 < maxr.
sourcefn extract_column_part(
&self,
c: usize,
maxr: usize,
size: usize
) -> BinaryDenseVector
fn extract_column_part( &self, c: usize, maxr: usize, size: usize ) -> BinaryDenseVector
Returns a vector of the given column from maxr < maxr+size.