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)

Sets the value of a bit.

Panics

Panics if (row, col) is out of bounds.

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.

type Output = bool

fn index(&self, (row, col): (usize, usize)) -> &bool

Derived Implementations

impl Hash for BitMatrix

fn hash<__H: Hasher>(&self, __arg_0: &mut __H)

1.3.0fn hash_slice<H>(data: &[Self], state: &mut H) where H: Hasher

impl Ord for BitMatrix

fn cmp(&self, __arg_0: &BitMatrix) -> Ordering

impl PartialOrd for BitMatrix

fn partial_cmp(&self, __arg_0: &BitMatrix) -> Option<Ordering>

fn lt(&self, __arg_0: &BitMatrix) -> bool

fn le(&self, __arg_0: &BitMatrix) -> bool

fn gt(&self, __arg_0: &BitMatrix) -> bool

fn ge(&self, __arg_0: &BitMatrix) -> bool

impl Eq for BitMatrix

impl PartialEq for BitMatrix

fn eq(&self, __arg_0: &BitMatrix) -> bool

fn ne(&self, __arg_0: &BitMatrix) -> bool

impl Debug for BitMatrix

fn fmt(&self, __arg_0: &mut Formatter) -> Result

impl Clone for BitMatrix

fn clone(&self) -> BitMatrix

1.0.0fn clone_from(&mut self, source: &Self)