From ae521be709871f94a622c85b0e5d6e8f776be144 Mon Sep 17 00:00:00 2001 From: Artem Storozhuk Date: Thu, 4 Jan 2024 19:22:14 +0200 Subject: [PATCH] Parallel computation of `Pi` polynomials (#233) * chore: Parallelise 'Pi' computing * chore: Put 'x' out of brackets --- src/provider/mlkzg.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/provider/mlkzg.rs b/src/provider/mlkzg.rs index 2c002306e..6cf6e0c83 100644 --- a/src/provider/mlkzg.rs +++ b/src/provider/mlkzg.rs @@ -234,10 +234,9 @@ where let mut Pi = vec![E::Fr::ZERO; Pi_len]; #[allow(clippy::needless_range_loop)] - for j in 0..Pi_len { - Pi[j] = x[ell-i-1] * polys[i][2*j + 1] // Odd part of P^(i-1) - + (E::Fr::ONE - x[ell-i-1]) * polys[i][2*j]; // Even part of P^(i-1) - } + Pi.par_iter_mut().enumerate().for_each(|(j, Pi_j)| { + *Pi_j = x[ell - i - 1] * (polys[i][2 * j + 1] - polys[i][2 * j]) + polys[i][2 * j]; + }); if i == ell - 1 && *eval != Pi[0] { return Err(NovaError::UnSat);