use crate::matrix::MatrixGF2;
use crate::tanner::TannerGraph;

pub struct LdpcCode {
    pub n: usize, // Nombre de colonnes
    pub k: usize, // Longueur du message
    pub h_matrix: MatrixGF2,
    pub tanner_graph: TannerGraph,
}

impl LdpcCode {
    pub fn new(h_matrix: MatrixGF2) -> Self {
        let n = h_matrix.cols;
        let k = n - h_matrix.rows;
        let tanner_graph = TannerGraph::from_matrix(&h_matrix);
        Self {
            n,
            k,
            h_matrix,
            tanner_graph,
        }
    }
}
