Struct bit_matrix::matrix::BitMatrix
source · pub struct BitMatrix { /* private fields */ }
Expand description
A matrix of bits.
Implementations§
source§impl BitMatrix
impl BitMatrix
sourcepub fn new(rows: usize, row_bits: usize) -> Self
pub fn new(rows: usize, row_bits: usize) -> Self
Create a new BitMatrix with specific numbers of bits in columns and rows.
sourcepub fn grow(&mut self, num_rows: usize, value: bool)
pub fn grow(&mut self, num_rows: usize, value: bool)
Grows the matrix in-place, adding num_rows
rows filled with value
.
sourcepub fn sub_matrix(&self, range: Range<usize>) -> BitSubMatrix<'_>
pub fn sub_matrix(&self, range: Range<usize>) -> BitSubMatrix<'_>
Returns a slice of the matrix’s rows.
sourcepub fn split_at(&self, row: usize) -> (BitSubMatrix<'_>, BitSubMatrix<'_>)
pub fn split_at(&self, row: usize) -> (BitSubMatrix<'_>, BitSubMatrix<'_>)
Given a row’s index, returns a slice of all rows above that row, a reference to said row, and a slice of all rows below.
Functionally equivalent to (self.sub_matrix(0..row), &self[row], self.sub_matrix(row..self.num_rows()))
.
sourcepub fn split_at_mut(
&mut self,
row: usize
) -> (BitSubMatrixMut<'_>, BitSubMatrixMut<'_>)
pub fn split_at_mut( &mut self, row: usize ) -> (BitSubMatrixMut<'_>, BitSubMatrixMut<'_>)
Given a row’s index, returns a slice of all rows above that row, a reference to said row, and a slice of all rows below.
sourcepub fn transitive_closure(&mut self)
pub fn transitive_closure(&mut self)
Computes the transitive closure of the binary relation represented by the matrix.
Uses the Warshall’s algorithm.
sourcepub fn reflexive_closure(&mut self)
pub fn reflexive_closure(&mut self)
Computes the reflexive closure of the binary relation represented by the matrix.
Trait Implementations§
source§impl Index<(usize, usize)> for BitMatrix
impl Index<(usize, usize)> for BitMatrix
Returns true
if a bit is enabled in the matrix, or false
otherwise.
source§impl Ord for BitMatrix
impl Ord for BitMatrix
source§impl PartialEq for BitMatrix
impl PartialEq for BitMatrix
source§impl PartialOrd for BitMatrix
impl PartialOrd for BitMatrix
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more