From 27d0c5257647230c27ac4221224d691335908374 Mon Sep 17 00:00:00 2001 From: mmagician Date: Fri, 3 Nov 2023 05:14:28 +0100 Subject: [PATCH] If the poly has 1 evaluation, we should fix the window=1 (#697) --- poly/src/evaluations/multivariate/multilinear/sparse.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/poly/src/evaluations/multivariate/multilinear/sparse.rs b/poly/src/evaluations/multivariate/multilinear/sparse.rs index ba8227c7f..574229160 100644 --- a/poly/src/evaluations/multivariate/multilinear/sparse.rs +++ b/poly/src/evaluations/multivariate/multilinear/sparse.rs @@ -156,13 +156,16 @@ impl MultilinearExtension for SparseMultilinearExtension { let dim = partial_point.len(); assert!(dim <= self.num_vars, "invalid partial point dimension"); - let window = ark_std::log2(self.evaluations.len()) as usize; + let mut window = ark_std::log2(self.evaluations.len()) as usize; + if window == 0 { + window = 1; + } let mut point = partial_point; let mut last = treemap_to_hashmap(&self.evaluations); // batch evaluation while !point.is_empty() { - let focus_length = if window > 0 && point.len() > window { + let focus_length = if point.len() > window { window } else { point.len()