Require borrowing for matmul

This commit is contained in:
Christopher Berner 2019-02-13 21:39:35 -08:00
parent 1f0a6639b4
commit f20204d045
2 changed files with 4 additions and 4 deletions

@ -122,7 +122,7 @@ pub fn generate_constraint_matrix<T:Iterator<Item=u32>>(source_block_symbols: u3
}
// G_HDPC
let g_hdpc = generate_mt(H, Kprime, S) * generate_gamma(Kprime, S);
let g_hdpc = &generate_mt(H, Kprime, S) * &generate_gamma(Kprime, S);
for i in 0..H {
for j in 0..(Kprime + S) {
matrix.set(i + S, j, g_hdpc.get(i, j));

@ -103,10 +103,10 @@ impl OctetMatrix {
}
}
impl Mul for OctetMatrix {
impl<'a, 'b> Mul<&'b OctetMatrix> for &'a OctetMatrix {
type Output = OctetMatrix;
fn mul(self, rhs: OctetMatrix) -> OctetMatrix {
fn mul(self, rhs: &'b OctetMatrix) -> OctetMatrix {
assert_eq!(self.width, rhs.height);
let mut result = OctetMatrix::new(self.height, rhs.width);
for row in 0..self.height {
@ -152,6 +152,6 @@ mod tests {
a.set(i, j, Octet::new(rand::thread_rng().gen()));
}
}
assert_eq!(a.clone(), identity * a.clone());
assert_eq!(a, &identity * &a);
}
}