diff --git a/Cargo.toml b/Cargo.toml index c9ee82f..cdb910f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,4 +8,4 @@ description = "Kuhn-Munkres (aka Hungarian) algorithm for solving the Assignment keywords = ["algorithm"] [dependencies] -bit-vec = "*" +fixedbitset = "0.1" diff --git a/src/coverage.rs b/src/coverage.rs index d83ad9b..55b7821 100644 --- a/src/coverage.rs +++ b/src/coverage.rs @@ -1,10 +1,10 @@ -use bit_vec::BitVec; +use fixedbitset::FixedBitSet; #[derive(Debug)] pub struct Coverage { n: usize, - rows: BitVec, - cols: BitVec, + rows: FixedBitSet, + cols: FixedBitSet, } impl Coverage { @@ -13,19 +13,19 @@ impl Coverage { pub fn new(n: usize) -> Coverage { Coverage { n: n, - rows: BitVec::from_elem(n, false), - cols: BitVec::from_elem(n, false), + rows: FixedBitSet::with_capacity(n), + cols: FixedBitSet::with_capacity(n), } } #[inline] pub fn is_row_covered(&self, row: usize) -> bool { - self.rows[row] + self.rows.contains(row) } #[inline] pub fn is_col_covered(&self, col: usize) -> bool { - self.cols[col] + self.cols.contains(col) } #[inline] diff --git a/src/lib.rs b/src/lib.rs index d80a5eb..54c4a51 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -17,7 +17,7 @@ // * More test cases // * Non-square matrices -extern crate bit_vec; +extern crate fixedbitset; #[cfg(test)] extern crate test;