p3_field

Function batch_multiplicative_inverse

Source
pub fn batch_multiplicative_inverse<F: Field>(x: &[F]) -> Vec<F>
Expand description

Batch multiplicative inverses with Montgomery’s trick This is Montgomery’s trick. At a high level, we invert the product of the given field elements, then derive the individual inverses from that via multiplication.

The usual Montgomery trick involves calculating an array of cumulative products, resulting in a long dependency chain. To increase instruction-level parallelism, we compute WIDTH separate cumulative product arrays that only meet at the end.

§Panics

This will panic if any of the inputs is zero.