Struct rustc_data_structures::bitvec::BitMatrix [−][src]
pub struct BitMatrix { /* fields omitted */ }
A "bit matrix" is basically a matrix of booleans represented as
one gigantic bitvector. In other words, it is as if you have
rows
bitvectors, each of length columns
.
Methods
impl BitMatrix
[src]
impl BitMatrix
pub fn new(rows: usize, columns: usize) -> BitMatrix
[src]
pub fn new(rows: usize, columns: usize) -> BitMatrix
Create a new rows x columns
matrix, initially empty.
pub fn add(&mut self, row: usize, column: usize) -> bool
[src]
pub fn add(&mut self, row: usize, column: usize) -> bool
Sets the cell at (row, column)
to true. Put another way, add
column
to the bitset for row
.
Returns true if this changed the matrix, and false otherwise.
pub fn contains(&self, row: usize, column: usize) -> bool
[src]
pub fn contains(&self, row: usize, column: usize) -> bool
Do the bits from row
contain column
? Put another way, is
the matrix cell at (row, column)
true? Put yet another way,
if the matrix represents (transitive) reachability, can
row
reach column
?
pub fn intersection(&self, a: usize, b: usize) -> Vec<usize>
[src]
pub fn intersection(&self, a: usize, b: usize) -> Vec<usize>
Returns those indices that are true in rows a
and b
. This
is an O(n) operation where n
is the number of elements
(somewhat independent from the actual size of the
intersection, in particular).
pub fn merge(&mut self, read: usize, write: usize) -> bool
[src]
pub fn merge(&mut self, read: usize, write: usize) -> bool
Add the bits from row read
to the bits from row write
,
return true if anything changed.
This is used when computing transitive reachability because if
you have an edge write -> read
, because in that case
write
can reach everything that read
can (and
potentially more).
ⓘImportant traits for BitVectorIter<'a>pub fn iter<'a>(&'a self, row: usize) -> BitVectorIter<'a>
[src]
pub fn iter<'a>(&'a self, row: usize) -> BitVectorIter<'a>
Iterates through all the columns set to true in a given row of the matrix.
Trait Implementations
impl Clone for BitMatrix
[src]
impl Clone for BitMatrix
fn clone(&self) -> BitMatrix
[src]
fn clone(&self) -> BitMatrix
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Debug for BitMatrix
[src]
impl Debug for BitMatrix