ldpc_toolbox/cli/
systematic.rs1use crate::{cli::Run, sparse::SparseMatrix, systematic::parity_to_systematic};
9use clap::Parser;
10use std::error::Error;
11
12#[derive(Debug, Parser)]
14#[command(about = "Converts a parity check matrix into systematic form")]
15pub struct Args {
16 alist: String,
18}
19
20impl Run for Args {
21 fn run(&self) -> Result<(), Box<dyn Error>> {
22 let h = SparseMatrix::from_alist(&std::fs::read_to_string(&self.alist)?)?;
23 let h_sys = parity_to_systematic(&h)?;
24 println!("{}", h_sys.alist());
25 Ok(())
26 }
27}