Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

small refactor #891

Merged
merged 1 commit into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading