pub(crate) struct M4riTable {
rows: Vec<usize>,
columns: Vec<LimbBitIndexPair>,
data: Vec<u64>,
min_limb: usize,
}Expand description
M4RI works as follows — first row reduce k rows using the naive algorithm. We then construct
a table of all 2^k linear combinations of these rows. This can be done in O(2^k) time. We then
use this table to reduce the remaining rows, so that each row takes O(num_columns) time,
which reduces the time taken by a factor of k x density.
Since we are likely to run into empty rows when doing row reduction, what we do in practice is
that we keep reducing rows until we collect k of them. Whenever we find a row, we record it
with M4riTable::add. We only record the row number and pivot column, as the values of these
rows will change as we go on due to the desire to land in a RREF.
Once we have recorded enough rows, we generate the table using M4riTable::generate, and
then reduce limbs using M4riTable::reduce. When we are done we clear it using
M4riTable::clear and proceed to the next k rows.
Fields§
§rows: Vec<usize>The indices of new rows in the table
columns: Vec<LimbBitIndexPair>The list of pivot columns of the rows
data: Vec<u64>The 2^k linear combinations of the k rows, apart from the first one which is identically zero.
min_limb: usizeThe smallest non-zero limb in this table. We use this when row reducing to save a few operations.
Implementations§
Source§impl M4riTable
impl M4riTable
Sourcepub fn new(k: usize, cols: usize) -> Self
pub fn new(k: usize, cols: usize) -> Self
Create a table with space for k vectors, each with cols columns.
Sourcepub fn generate(&mut self, matrix: &Matrix)
pub fn generate(&mut self, matrix: &Matrix)
Generates the table from the known data
num is the number of the vector being added.
pub fn reduce_naive(&self, matrix: &mut Matrix, target: usize)
pub fn reduce(&self, v: &mut [u64])
Trait Implementations§
Auto Trait Implementations§
impl Freeze for M4riTable
impl RefUnwindSafe for M4riTable
impl Send for M4riTable
impl Sync for M4riTable
impl Unpin for M4riTable
impl UnwindSafe for M4riTable
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more