Skip to content

Commit

Permalink
small refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
tcoratger committed Nov 19, 2024
1 parent c4f6495 commit 72ff205
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
4 changes: 2 additions & 2 deletions ff/src/fields/fft_friendly.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@ pub trait FftField: crate::Field {

omega = large_subgroup_root_of_unity;
for _ in q_adicity..small_subgroup_base_adicity {
omega = omega.pow([q as u64]);
omega = omega.pow([q]);
}

for _ in two_adicity..Self::TWO_ADICITY {
omega.square_in_place();
}
} else {
// Compute the next power of 2.
let size = n.next_power_of_two() as u64;
let size = n.next_power_of_two();
let log_size_of_group = ark_std::log2(usize::try_from(size).expect("too large"));

if n != size || log_size_of_group > Self::TWO_ADICITY {
Expand Down
12 changes: 4 additions & 8 deletions poly/src/domain/radix2/fft.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,17 +88,15 @@ impl<F: FftField> Radix2EvaluationDomain<F> {
}

fn fft_helper_in_place<T: DomainCoeff<F>>(&self, x_s: &mut [T], ord: FFTOrder) {
use FFTOrder::*;

let log_len = ark_std::log2(x_s.len());

if ord == OI {
if ord == FFTOrder::OI {
self.oi_helper(x_s, self.group_gen, 1);
} else {
self.io_helper(x_s, self.group_gen);
}

if ord == II {
if ord == FFTOrder::II {
derange(x_s, log_len);
}
}
Expand All @@ -107,15 +105,13 @@ impl<F: FftField> Radix2EvaluationDomain<F> {
// The results here must all be divided by |x_s|,
// which is left up to the caller to do.
fn ifft_helper_in_place<T: DomainCoeff<F>>(&self, x_s: &mut [T], ord: FFTOrder) {
use FFTOrder::*;

let log_len = ark_std::log2(x_s.len());

if ord == II {
if ord == FFTOrder::II {
derange(x_s, log_len);
}

if ord == IO {
if ord == FFTOrder::IO {
self.io_helper(x_s, self.group_gen_inv);
} else {
self.oi_helper(x_s, self.group_gen_inv, 1);
Expand Down

0 comments on commit 72ff205

Please sign in to comment.