pub struct BatchInversion<F: Field> { /* private fields */ }Expand description
Reusable batch inversion context that owns its scratch buffers.
This struct manages the memory needed for batch field inversions, allowing efficient reuse across multiple inversion operations of the same size.
§Example
use binius_field::{BinaryField128bGhash, Field};
use binius_math::batch_invert::BatchInversion;
let mut inverter = BatchInversion::<BinaryField128bGhash>::new(8);
let mut elements = [BinaryField128bGhash::ONE; 8];
inverter.invert_or_zero(&mut elements);Implementations§
Source§impl<F: Field> BatchInversion<F>
impl<F: Field> BatchInversion<F>
Sourcepub fn invert_nonzero(&mut self, elements: &mut [F])
pub fn invert_nonzero(&mut self, elements: &mut [F])
Sourcepub fn invert_or_zero(&mut self, elements: &mut [F])
pub fn invert_or_zero(&mut self, elements: &mut [F])
Inverts elements in-place, handling zeros gracefully.
Zero elements remain zero after inversion, while non-zero elements are replaced with their multiplicative inverses.
§Parameters
elements: Mutable slice to invert in-place
§Panics
Panics if elements.len() != n (the size specified at construction).
Auto Trait Implementations§
impl<F> Freeze for BatchInversion<F>where
<F as WithUnderlier>::Underlier: Sized,
impl<F> RefUnwindSafe for BatchInversion<F>where
<F as WithUnderlier>::Underlier: Sized,
F: RefUnwindSafe,
impl<F> Send for BatchInversion<F>where
<F as WithUnderlier>::Underlier: Sized,
impl<F> Sync for BatchInversion<F>where
<F as WithUnderlier>::Underlier: Sized,
impl<F> Unpin for BatchInversion<F>
impl<F> UnwindSafe for BatchInversion<F>where
<F as WithUnderlier>::Underlier: Sized,
F: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more