ldpc rust

This commit is contained in:
2026-02-11 19:58:43 +01:00
parent a86b96fd5f
commit 8082d4c29b
359 changed files with 5920 additions and 4208 deletions

24
Code/ldpc/src/tanner.rs Normal file
View File

@ -0,0 +1,24 @@
use crate::matrix::MatrixGF2;
#[derive(Debug, Clone)]
pub struct TannerGraph {
pub check: Vec<Vec<usize>>,
pub bits: Vec<Vec<usize>>,
}
impl TannerGraph {
pub fn from_matrix(matrix: &MatrixGF2) -> Self {
let mut check = vec![vec![]; matrix.rows];
let mut bits = vec![vec![]; matrix.cols];
for i in 0..matrix.rows {
for j in 0..matrix.cols {
if matrix.get(i, j) == 0 {
check[i].push(j);
bits[j].push(i);
}
}
}
Self { check, bits }
}
}