1use crate::error::Result;
2use crate::gf2;
3
4pub fn eliminate_to_row_echelon(matrix: &[Vec<u8>]) -> Vec<Vec<u8>> {
5 gf2::try_row_echelon(matrix).expect("matrix rows must be rectangular binary vectors")
6}
7
8pub fn binary_rank(matrix: &[Vec<u8>]) -> usize {
9 gf2::try_rank(matrix).expect("matrix rows must be rectangular binary vectors")
10}
11
12pub fn try_eliminate_to_row_echelon(matrix: &[Vec<u8>]) -> Result<Vec<Vec<u8>>> {
13 gf2::try_row_echelon(matrix)
14}
15
16pub fn try_binary_rank(matrix: &[Vec<u8>]) -> Result<usize> {
17 gf2::try_rank(matrix)
18}
19
20pub fn try_in_row_span(matrix: &[Vec<u8>], target: &[u8]) -> Result<bool> {
21 gf2::try_in_row_span(matrix, target)
22}
23
24pub fn in_row_span(matrix: &[Vec<u8>], target: &[u8]) -> bool {
25 gf2::try_in_row_span(matrix, target)
26 .expect("matrix rows must be rectangular binary vectors and target entries must be binary")
27}