Skip to content

Attempt to optimize RLNC Recoder Matrix Multiplication #15

@itzmeanjan

Description

@itzmeanjan

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

// 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>>();

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions