Switch to optimized symbol decoding implementation

This commit is contained in:
Christopher Berner 2019-02-03 15:24:10 -08:00
parent 4e6b34282f
commit e13c8738c5
2 changed files with 7 additions and 4 deletions

@ -6,6 +6,7 @@ use systematic_constants::num_ldpc_symbols;
use systematic_constants::num_hdpc_symbols;
use constraint_matrix::generate_constraint_matrix;
use base::intermediate_tuple;
use base::fused_inverse_mul_symbols;
use constraint_matrix::enc_indices;
pub struct SourceBlockDecoder {
@ -94,11 +95,12 @@ impl SourceBlockDecoder {
}
let constraint_matrix = generate_constraint_matrix(self.source_block_symbols, encoded_indices.into_iter());
let inverse = constraint_matrix.inverse();
if inverse == None {
let intermediate_symbols = fused_inverse_mul_symbols(&constraint_matrix, &d, self.source_block_symbols);
if intermediate_symbols == None {
return None
}
let intermediate_symbols = inverse.unwrap().mul_symbols(&d);
let intermediate_symbols = intermediate_symbols.unwrap();
let mut result = vec![];
for i in 0..self.source_block_symbols as usize {

@ -10,6 +10,7 @@ use systematic_constants::num_ldpc_symbols;
use systematic_constants::num_hdpc_symbols;
use constraint_matrix::generate_constraint_matrix;
use base::intermediate_tuple;
use base::fused_inverse_mul_symbols;
pub struct SourceBlockEncoder {
source_block_id: u8,
@ -83,7 +84,7 @@ fn gen_intermediate_symbols(extended_source_block: Vec<Symbol>, symbol_size: usi
}
let A = generate_constraint_matrix(extended_source_block.len() as u32, 0..extended_source_block.len() as u32);
A.inverse().unwrap().mul_symbols(&D)
fused_inverse_mul_symbols(&A, &D, extended_source_block.len() as u32).unwrap()
}
// Enc[] function, as defined in section 5.3.5.3