Skip to content

Commit

Permalink
Merge branch 'babybear-isfft-#539' of https://github.com/mdvillagra/l…
Browse files Browse the repository at this point in the history
…ambdaworks into babybear-isfft-#539
  • Loading branch information
mdvillagra committed Sep 27, 2023
2 parents abbaeab + d7cae1c commit 017d391
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions math/src/fft/cpu/roots_of_unity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ pub fn get_powers_of_primitive_root<F: IsFFTField>(
RootsConfig::Natural | RootsConfig::BitReverse => F::get_primitive_root_of_unity(n)?,
_ => F::get_primitive_root_of_unity(n)?.inv().unwrap(),
};
println!("el tipo es {}", std::any::type_name::<F>());
println!("un root of unity is {:?}", root);
println!(" la raiz del campo es {:?}", F::TWO_ADIC_PRIMITVE_ROOT_OF_UNITY);
let up_to = match config {
RootsConfig::Natural | RootsConfig::NaturalInversed => count,
// In bit reverse form we could need as many as `(1 << count.bits()) - 1` roots
Expand Down
8 changes: 7 additions & 1 deletion math/src/fft/polynomial.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,10 @@ mod tests {
let twiddles =
get_powers_of_primitive_root(order.into(), len, RootsConfig::Natural).unwrap();

println!("len = {}", len);
println!("order = {}", order);
println!("twiddles = {:?}", twiddles);

let fft_eval = poly.evaluate_fft(1, None).unwrap();
let naive_eval = poly.evaluate_slice(&twiddles);

Expand Down Expand Up @@ -408,8 +412,10 @@ mod tests {
proptest! {
// Property-based test that ensures FFT eval. gives same result as a naive polynomial evaluation.
#[test]
fn test_fft_matches_naive_evaluation(poly in poly(8)) {
fn test_fft_matches_naive_evaluation(poly in poly(2)) {
println!("poly = {:?}", poly);
let (fft_eval, naive_eval) = gen_fft_and_naive_evaluation(poly);
println!("=========================");
prop_assert_eq!(fft_eval, naive_eval);
}

Expand Down

0 comments on commit 017d391

Please sign in to comment.