diff --git a/src/circuit2_witness.rs b/src/circuit2_witness.rs index f4a7a718..d9ddc34a 100644 --- a/src/circuit2_witness.rs +++ b/src/circuit2_witness.rs @@ -234,7 +234,10 @@ where // sparse mds { - elements_buffer[0] = scalar_product(elements, &m.w_hat); + elements_buffer[0] = elements + .iter() + .zip(&m.w_hat) + .fold(Scalar::ZERO, |acc, (&x, &y)| acc + (x * y)); for j in 1..width { elements_buffer[j] = elements[j] + elements[0] * m.v_rest[j - 1]; @@ -315,12 +318,6 @@ where } } -fn scalar_product(a: &[Scalar], b: &[Scalar]) -> Scalar { - a.iter() - .zip(b) - .fold(Scalar::ZERO, |acc, (&x, &y)| acc + (x * y)) -} - #[cfg(test)] mod test { use super::*;