Skip to content

Commit

Permalink
implemented batch inverse in secure field eval (#520)
Browse files Browse the repository at this point in the history
  • Loading branch information
ohad-starkware authored Mar 21, 2024
1 parent 535b916 commit f482ba8
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/core/backend/avx512/circle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,19 @@ impl AVX512Backend {

// Generates twiddle steps for efficiently computing the twiddles.
// steps[i] = t_i/(t_0*t_1*...*t_i-1).
fn twiddle_steps<F: Field>(mappings: &[F]) -> Vec<F> {
fn twiddle_steps<F: Field>(mappings: &[F]) -> Vec<F>
where
F: FieldExpOps,
{
let mut denominators: Vec<F> = vec![mappings[0]];

for i in 1..mappings.len() {
denominators.push(denominators[i - 1] * mappings[i]);
}

// TODO(Ohad): batch inverse.
let denom_inverses = denominators.iter().map(|d| d.inverse()).collect::<Vec<F>>();
let mut denom_inverses = vec![F::zero(); denominators.len()];
F::batch_inverse(&denominators, &mut denom_inverses);

let mut steps = vec![mappings[0]];

Expand Down

0 comments on commit f482ba8

Please sign in to comment.