Skip to main content

batch_multiplicative_inverse_general

Function batch_multiplicative_inverse_general 

Source
pub fn batch_multiplicative_inverse_general<F, Inv>(
    x: &[F],
    result: &mut [F],
    inv: Inv,
)
where F: PrimeCharacteristicRing + Copy, Inv: Fn(F) -> F,
Expand description

A simple single-threaded implementation of Montgomery’s trick. Since not all PrimeCharacteristicRings support inversion, this takes a custom inversion function.

Unlike batch_multiplicative_inverse, this writes into a caller-provided buffer, avoiding heap allocation. This makes it suitable for small, fixed-size inputs such as packed field lanes.