From 5c563eca12a0111ee226e59894ebf5d695d81627 Mon Sep 17 00:00:00 2001 From: Sean Bowe Date: Thu, 15 Oct 2020 13:56:42 -0600 Subject: [PATCH] Do not enumerate product inside of lagrange_interpolate. --- src/arithmetic.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/arithmetic.rs b/src/arithmetic.rs index 3c03aa4..d5bcc5c 100644 --- a/src/arithmetic.rs +++ b/src/arithmetic.rs @@ -448,13 +448,13 @@ pub fn lagrange_interpolate(points: &[F], evals: &[F]) -> Vec { // Compute (x_j - x_k)^(-1) let denom = (*x_j - x_k).invert().unwrap(); product.resize(tmp.len() + 1, F::zero()); - for (i, (a, b)) in tmp + for ((a, b), product) in tmp .iter() .chain(std::iter::once(&F::zero())) .zip(std::iter::once(&F::zero()).chain(tmp.iter())) - .enumerate() + .zip(product.iter_mut()) { - product[i] = *a * (-denom * x_k) + *b * denom; + *product = *a * (-denom * x_k) + *b * denom; } std::mem::swap(&mut tmp, &mut product); }