elliptic_curve::ops

Trait BatchInvert

Source
pub trait BatchInvert<FieldElements: ?Sized>: Invert + Sized {
    type Output: AsRef<[Self]>;

    // Required method
    fn batch_invert(
        field_elements: &FieldElements,
    ) -> CtOption<<Self as BatchInvert<FieldElements>>::Output>;
}
Expand description

Perform a batched inversion on a sequence of field elements (i.e. base field elements or scalars) at an amortized cost that should be practically as efficient as a single inversion.

Required Associated Types§

Source

type Output: AsRef<[Self]>

The output of batch inversion. A container of field elements.

Required Methods§

Source

fn batch_invert( field_elements: &FieldElements, ) -> CtOption<<Self as BatchInvert<FieldElements>>::Output>

Invert a batch of field elements.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T> BatchInvert<[T]> for T
where T: Invert<Output = CtOption<Self>> + Mul<Self, Output = Self> + Copy + Default + ConditionallySelectable,

Source§

impl<const N: usize, T> BatchInvert<[T; N]> for T
where T: Invert<Output = CtOption<Self>> + Mul<Self, Output = Self> + Copy + Default + ConditionallySelectable,