[][src]Function local_reconstruction_code_gen::gen_encode_matrix

pub fn gen_encode_matrix<'a, GF: 'a + From<u8> + Into<u8> + GaloisField>(
    k: usize,
    l: usize,
    r: usize
) -> Result<impl Iterator<Item = u8> + DoubleEndedIterator + FusedIterator + 'a, MatrixGenError>

Generate encode matrix for a (k,l,r) Local Reconstruction Code.

The k data symbols divided into l groups with each having a single local parity symbol and r global parity symbols.

Examples

use local_reconstruction_code_gen::gen_encode_matrix;
use g2p::g2p;

g2p!(GF16, 4, modulus: 0b10011);
let encode_matrix = gen_encode_matrix::<GF16>(6, 2, 2).map(Iterator::collect);
assert_eq!(
    encode_matrix,
    Ok(vec![
        0b0001, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000,
        0b0000, 0b0001, 0b0000, 0b0000, 0b0000, 0b0000,
        0b0000, 0b0000, 0b0001, 0b0000, 0b0000, 0b0000,
        0b0000, 0b0000, 0b0000, 0b0001, 0b0000, 0b0000,
        0b0000, 0b0000, 0b0000, 0b0000, 0b0001, 0b0000,
        0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0001,
        0b0001, 0b0001, 0b0001, 0b0000, 0b0000, 0b0000,
        0b0000, 0b0000, 0b0000, 0b0001, 0b0001, 0b0001,
        0b0001, 0b0010, 0b0011, 0b0100, 0b1000, 0b1100,
        0b0001, 0b0100, 0b0101, 0b0011, 0b1100, 0b1111,
    ])
);