Function guff_matrix::simulator::interleave_streams[][src]

pub fn interleave_streams(dest: &mut [u8], slices: &Vec<&[u8]>)
Expand description

Interleave row-wise data for storage in column-wise matrix

The fast matrix multiply works best when all reads (apart from wrap-around reads) are contiguous in memory. That suits the case where we’re encoding using RS, striping or IDA, since each column of the input message corresponds to a contiguous chunk of input.

When decoding, though, the input has row-wise organisation: each stripe, share or parity is contiguous.

For this case, we need to interleave k contiguous streams.

Note that there’s no need to de-interleave on the output, since we can choose between row-wise and col-wise writes. Neither should have any impact on the speed of the program, since we never read from the output matrix.

Passed in a vector of slices and interleaves them into another slice