Struct bit_matrix::matrix::BitMatrix
[−]
[src]
pub struct BitMatrix { // some fields omitted }
A matrix of bits.
Methods
impl BitMatrix
fn new(rows: usize, row_bits: usize) -> Self
Create a new BitMatrix with specific numbers of bits in columns and rows.
fn size(&self) -> (usize, usize)
Returns the matrix's size as (rows, columns)
.
fn set(&mut self, row: usize, col: usize, enabled: bool)
fn grow(&mut self, num_rows: usize, value: bool)
Grows the matrix in-place, adding num_rows
rows filled with value
.
fn sub_matrix(&self, range: Range<usize>) -> BitSubMatrix
Returns a slice of the matrix's rows.
fn split_at(&self, row: usize) -> (BitSubMatrix, &BitVecSlice, 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.
Functionally equivalent to (self.sub_matrix(0..row), &self[row], self.sub_matrix(row..self.num_rows()))
.
fn split_at_mut(&mut self, row: usize) -> (BitSubMatrixMut, &mut BitVecSlice, 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.
fn iter_row(&self, row: usize) -> Iter
Iterate over bits in the specified row.
fn transitive_closure(&mut self)
Computes the transitive closure of the binary relation represented by the matrix.
Uses the Warshall's algorithm.
Trait Implementations
impl Index<usize> for BitMatrix
Returns the matrix's row in the form of an immutable slice.
type Output = BitVecSlice
fn index(&self, row: usize) -> &BitVecSlice
impl IndexMut<usize> for BitMatrix
Returns the matrix's row in the form of a mutable slice.
fn index_mut(&mut self, row: usize) -> &mut BitVecSlice
impl Index<(usize, usize)> for BitMatrix
Returns true
if a bit is enabled in the matrix, or false
otherwise.