The matrix multiplication in RLNC Recoder, which multiples a random sampled coding vector with a matrix, made of coding coefficients of received erasure-coded pieces, can be optimized to benefit from cache locality, by keeping the matrix in transposed form.
|
// Compute the resulting coding vector for the original source pieces |
|
// by multiplying the random sampled recoding vector by the matrix of received coding vectors. |
|
let computed_coding_vector = (0..self.num_pieces_coded_together) |
|
.map(|coeff_idx| { |
|
random_recoding_vector |
|
.iter() |
|
.enumerate() |
|
.fold(Gf256::default(), |acc, (recoding_vec_idx, &cur)| { |
|
let row_begins_at = recoding_vec_idx * self.num_pieces_coded_together; |
|
acc + Gf256::new(cur) * self.coding_vectors[row_begins_at + coeff_idx] |
|
}) |
|
.get() |
|
}) |
|
.collect::<Vec<u8>>(); |
The matrix multiplication in RLNC Recoder, which multiples a random sampled coding vector with a matrix, made of coding coefficients of received erasure-coded pieces, can be optimized to benefit from cache locality, by keeping the matrix in transposed form.
rlnc/src/full/recoder.rs
Lines 130 to 143 in 4e6cc41