From 7bf765f7bbdbdf24c50ea8c6d67399cc2eb0154b Mon Sep 17 00:00:00 2001 From: jonch <9093549+jon-chuang@users.noreply.github.com> Date: Tue, 30 Mar 2021 22:58:12 +0800 Subject: [PATCH] Improve comments --- poly/src/domain/radix2/fft.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/poly/src/domain/radix2/fft.rs b/poly/src/domain/radix2/fft.rs index a2bcef3b7..4846f204a 100644 --- a/poly/src/domain/radix2/fft.rs +++ b/poly/src/domain/radix2/fft.rs @@ -229,11 +229,16 @@ impl Radix2EvaluationDomain { fn oi_helper>(&self, xi: &mut [T], root: F) { let roots_cache = self.roots_of_unity(root); - let compaction_size = core::cmp::min( + + // The `cmp::min` is only necessary for the case where + // `MIN_NUM_CHUNKS_FOR_COMPACTION = 1`. Else, notice that we compact + // the roots cache by a stride of at least `MIN_NUM_CHUNKS_FOR_COMPACTION`. + + let compaction_max_size = core::cmp::min( roots_cache.len() / 2, roots_cache.len() / MIN_NUM_CHUNKS_FOR_COMPACTION, ); - let mut compacted_roots = vec![F::default(); compaction_size]; + let mut compacted_roots = vec![F::default(); compaction_max_size]; #[cfg(feature = "parallel")] let max_threads = rayon::current_num_threads();