Skip to content

Commit

Permalink
adding parallel iterator
Browse files Browse the repository at this point in the history
  • Loading branch information
anupsv committed Aug 29, 2024
1 parent ace9bf4 commit 5ba9700
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/kzg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use ark_serialize::Read;
use ark_std::{ops::Div, str::FromStr, One, Zero};
use crossbeam_channel::{bounded, Sender};
use num_traits::ToPrimitive;
use rayon::iter::{IntoParallelRefIterator, ParallelIterator};
use std::{fs::File, io, io::BufReader};

#[derive(Debug, PartialEq, Clone)]
Expand Down Expand Up @@ -559,15 +560,15 @@ impl Kzg {
}

let points_projective: Vec<G1Projective> = self.g1[..length]
.iter()
.par_iter()
.map(|&p| G1Projective::from(p))
.collect();

match GeneralEvaluationDomain::<Fr>::new(length) {
Some(domain) => {
let ifft_result = domain.ifft(&points_projective);
let ifft_result_affine: Vec<_> =
ifft_result.iter().map(|p| p.into_affine()).collect();
ifft_result.par_iter().map(|p| p.into_affine()).collect();
Ok(ifft_result_affine)
},
None => Err(KzgError::FftError(
Expand Down

0 comments on commit 5ba9700

Please sign in to comment.