Struct lambdaworks_math::field::fields::montgomery_backed_prime_fields::MontgomeryBackendPrimeField
source · pub struct MontgomeryBackendPrimeField<M, const NUM_LIMBS: usize> { /* private fields */ }
Implementations§
source§impl<M, const NUM_LIMBS: usize> MontgomeryBackendPrimeField<M, NUM_LIMBS>where
M: IsModulus<UnsignedInteger<NUM_LIMBS>>,
impl<M, const NUM_LIMBS: usize> MontgomeryBackendPrimeField<M, NUM_LIMBS>where
M: IsModulus<UnsignedInteger<NUM_LIMBS>>,
pub const R2: UnsignedInteger<NUM_LIMBS> = _
pub const MU: u64 = _
pub const ZERO: UnsignedInteger<NUM_LIMBS> = _
pub const ONE: UnsignedInteger<NUM_LIMBS> = _
Trait Implementations§
source§impl<M: Clone, const NUM_LIMBS: usize> Clone for MontgomeryBackendPrimeField<M, NUM_LIMBS>
impl<M: Clone, const NUM_LIMBS: usize> Clone for MontgomeryBackendPrimeField<M, NUM_LIMBS>
source§fn clone(&self) -> MontgomeryBackendPrimeField<M, NUM_LIMBS>
fn clone(&self) -> MontgomeryBackendPrimeField<M, NUM_LIMBS>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl HasQuadraticNonResidue<MontgomeryBackendPrimeField<BN254FieldModulus, 4>> for BN254Residue
impl HasQuadraticNonResidue<MontgomeryBackendPrimeField<BN254FieldModulus, 4>> for BN254Residue
fn residue() -> FieldElement<BN254PrimeField>
source§impl HasQuadraticNonResidue<MontgomeryBackendPrimeField<MontgomeryConfigBabybear31PrimeField, 1>> for Babybear31PrimeField
impl HasQuadraticNonResidue<MontgomeryBackendPrimeField<MontgomeryConfigBabybear31PrimeField, 1>> for Babybear31PrimeField
source§impl HasQuadraticNonResidue<MontgomeryBackendPrimeField<TestCurve2Modulus, 6>> for TestCurve2QuadraticNonResidue
impl HasQuadraticNonResidue<MontgomeryBackendPrimeField<TestCurve2Modulus, 6>> for TestCurve2QuadraticNonResidue
source§impl<M, const NUM_LIMBS: usize> IsField for MontgomeryBackendPrimeField<M, NUM_LIMBS>
impl<M, const NUM_LIMBS: usize> IsField for MontgomeryBackendPrimeField<M, NUM_LIMBS>
type BaseType = UnsignedInteger<NUM_LIMBS>
source§fn mul(a: &Self::BaseType, b: &Self::BaseType) -> Self::BaseType
fn mul(a: &Self::BaseType, b: &Self::BaseType) -> Self::BaseType
Returns the multiplication of
a
and b
.source§fn square(a: &UnsignedInteger<NUM_LIMBS>) -> UnsignedInteger<NUM_LIMBS>
fn square(a: &UnsignedInteger<NUM_LIMBS>) -> UnsignedInteger<NUM_LIMBS>
Returns the multiplication of
a
and a
.source§fn sub(a: &Self::BaseType, b: &Self::BaseType) -> Self::BaseType
fn sub(a: &Self::BaseType, b: &Self::BaseType) -> Self::BaseType
Returns the subtraction of
a
and b
.source§fn inv(a: &Self::BaseType) -> Result<Self::BaseType, FieldError>
fn inv(a: &Self::BaseType) -> Result<Self::BaseType, FieldError>
Returns the multiplicative inverse of
a
.source§fn div(a: &Self::BaseType, b: &Self::BaseType) -> Self::BaseType
fn div(a: &Self::BaseType, b: &Self::BaseType) -> Self::BaseType
Returns the division of
a
and b
.source§fn eq(a: &Self::BaseType, b: &Self::BaseType) -> bool
fn eq(a: &Self::BaseType, b: &Self::BaseType) -> bool
Returns a boolean indicating whether
a
and b
are equal or not.source§fn from_u64(x: u64) -> Self::BaseType
fn from_u64(x: u64) -> Self::BaseType
Returns the element
x * 1
where 1 is the multiplicative neutral element.source§fn from_base_type(x: Self::BaseType) -> Self::BaseType
fn from_base_type(x: Self::BaseType) -> Self::BaseType
Takes as input an element of BaseType and returns the internal representation
of that element in the field.
fn pow<T>(a: &Self::BaseType, exponent: T) -> Self::BaseTypewhere
T: IsUnsignedInteger,
source§impl<M, const NUM_LIMBS: usize> IsPrimeField for MontgomeryBackendPrimeField<M, NUM_LIMBS>
impl<M, const NUM_LIMBS: usize> IsPrimeField for MontgomeryBackendPrimeField<M, NUM_LIMBS>
type RepresentativeType = <MontgomeryBackendPrimeField<M, NUM_LIMBS> as IsField>::BaseType
source§fn representative(x: &Self::BaseType) -> Self::RepresentativeType
fn representative(x: &Self::BaseType) -> Self::RepresentativeType
Returns the integer representative in
the range [0, p-1], where p the modulus
source§fn field_bit_size() -> usize
fn field_bit_size() -> usize
Returns the number of bits of the max element of the field, as per field documentation, not internal representation.
This is
log2(max FE)
rounded upsource§fn from_hex(hex_string: &str) -> Result<Self::BaseType, CreationError>
fn from_hex(hex_string: &str) -> Result<Self::BaseType, CreationError>
Creates a BaseType from a Hex String
0x is optional
Returns an
CreationError::InvalidHexString
if the value is not a hexstringfn modulus_minus_one() -> Self::RepresentativeType
fn legendre_symbol(a: &Self::BaseType) -> LegendreSymbol
impl<M: Copy, const NUM_LIMBS: usize> Copy for MontgomeryBackendPrimeField<M, NUM_LIMBS>
Auto Trait Implementations§
impl<M, const NUM_LIMBS: usize> Freeze for MontgomeryBackendPrimeField<M, NUM_LIMBS>
impl<M, const NUM_LIMBS: usize> RefUnwindSafe for MontgomeryBackendPrimeField<M, NUM_LIMBS>where
M: RefUnwindSafe,
impl<M, const NUM_LIMBS: usize> Send for MontgomeryBackendPrimeField<M, NUM_LIMBS>where
M: Send,
impl<M, const NUM_LIMBS: usize> Sync for MontgomeryBackendPrimeField<M, NUM_LIMBS>where
M: Sync,
impl<M, const NUM_LIMBS: usize> Unpin for MontgomeryBackendPrimeField<M, NUM_LIMBS>where
M: Unpin,
impl<M, const NUM_LIMBS: usize> UnwindSafe for MontgomeryBackendPrimeField<M, NUM_LIMBS>where
M: 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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)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