From e98593aa7e092586674a773725de4702a4dea054 Mon Sep 17 00:00:00 2001 From: Daniel Lubarov Date: Mon, 24 May 2021 15:09:43 -0700 Subject: [PATCH] Little circuit optimization --- src/field/extension_field/target.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/field/extension_field/target.rs b/src/field/extension_field/target.rs index 1927e0d1..fa3071d1 100644 --- a/src/field/extension_field/target.rs +++ b/src/field/extension_field/target.rs @@ -56,15 +56,14 @@ impl CircuitBuilder { where F: Extendable, { - let w = self.constant(F::Extension::W); let mut res = [self.zero(); D]; for i in 0..D { for j in 0..D { res[(i + j) % D] = if i + j < D { self.mul_add(a.0[i], b.0[j], res[(i + j) % D]) } else { - let tmp = self.mul(a.0[i], b.0[j]); - self.mul_add(w, tmp, res[(i + j) % D]) + // W * a[i] * b[i] + res[(i + j) % W] + self.arithmetic(F::Extension::W, a.0[i], b.0[i], F::Extension::ONE, res[(i + j) % D]); } } }