openvm_algebra_guest::field

Trait Field

Source
pub trait Field:
    Sized
    + Eq
    + Clone
    + Debug
    + Neg<Output = Self>
    + Add<Output = Self>
    + Sub<Output = Self>
    + Mul<Output = Self>
    + for<'a> Add<&'a Self, Output = Self>
    + for<'a> Sub<&'a Self, Output = Self>
    + for<'a> Mul<&'a Self, Output = Self>
    + for<'a> DivUnsafe<&'a Self, Output = Self>
    + AddAssign
    + SubAssign
    + MulAssign
    + DivAssignUnsafe
    + for<'a> AddAssign<&'a Self>
    + for<'a> SubAssign<&'a Self>
    + for<'a> MulAssign<&'a Self>
    + for<'a> DivAssignUnsafe<&'a Self> {
    type SelfRef<'a>: Add<&'a Self, Output = Self> + Sub<&'a Self, Output = Self> + Mul<&'a Self, Output = Self> + DivUnsafe<&'a Self, Output = Self>
       where Self: 'a;

    const ZERO: Self;
    const ONE: Self;

    // Required methods
    fn double_assign(&mut self);
    fn square_assign(&mut self);

    // Provided method
    fn invert(&self) -> Self { ... }
}
Expand description

This is a simplified trait for field elements.

Required Associated Constants§

Source

const ZERO: Self

The zero element of the field, the additive identity.

Source

const ONE: Self

The one element of the field, the multiplicative identity.

Required Associated Types§

Source

type SelfRef<'a>: Add<&'a Self, Output = Self> + Sub<&'a Self, Output = Self> + Mul<&'a Self, Output = Self> + DivUnsafe<&'a Self, Output = Self> where Self: 'a

Required Methods§

Source

fn double_assign(&mut self)

Doubles self in-place.

Source

fn square_assign(&mut self)

Square self in-place

Provided Methods§

Source

fn invert(&self) -> Self

Unchecked inversion. See DivUnsafe.

§Panics

If self is zero.

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<F: Field> Field for F
where for<'a> &'a F: Add<&'a F, Output = F> + Sub<&'a F, Output = F> + Mul<&'a F, Output = F>,

Source§

const ZERO: Self = <F as ff::Field>::ZERO

Source§

const ONE: Self = <F as ff::Field>::ONE

Source§

type SelfRef<'a> = &'a F