pub struct QuadraticExtensionField<F, T>where
F: IsField,
T: HasQuadraticNonResidue<F>,{ /* private fields */ }
Expand description
A general quadratic extension field over F
with quadratic non residue Q::residue()
Trait Implementations§
source§impl<F, T> Clone for QuadraticExtensionField<F, T>
impl<F, T> Clone for QuadraticExtensionField<F, T>
source§fn clone(&self) -> QuadraticExtensionField<F, T>
fn clone(&self) -> QuadraticExtensionField<F, T>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<F, T> Debug for QuadraticExtensionField<F, T>
impl<F, T> Debug for QuadraticExtensionField<F, T>
source§impl HasCubicNonResidue<QuadraticExtensionField<MontgomeryBackendPrimeField<BN254FieldModulus, 4>, BN254Residue>> for LevelTwoResidue
impl HasCubicNonResidue<QuadraticExtensionField<MontgomeryBackendPrimeField<BN254FieldModulus, 4>, BN254Residue>> for LevelTwoResidue
source§fn residue() -> FieldElement<Degree2ExtensionField>
fn residue() -> FieldElement<Degree2ExtensionField>
source§impl<F, Q> IsField for QuadraticExtensionField<F, Q>
impl<F, Q> IsField for QuadraticExtensionField<F, Q>
source§fn add(
a: &[FieldElement<F>; 2],
b: &[FieldElement<F>; 2],
) -> [FieldElement<F>; 2]
fn add( a: &[FieldElement<F>; 2], b: &[FieldElement<F>; 2], ) -> [FieldElement<F>; 2]
Returns the component wise addition of a
and b
source§fn mul(
a: &[FieldElement<F>; 2],
b: &[FieldElement<F>; 2],
) -> [FieldElement<F>; 2]
fn mul( a: &[FieldElement<F>; 2], b: &[FieldElement<F>; 2], ) -> [FieldElement<F>; 2]
Returns the multiplication of a
and b
using the following
equation:
(a0 + a1 * t) * (b0 + b1 * t) = a0 * b0 + a1 * b1 * Q::residue() + (a0 * b1 + a1 * b0) * t
where t.pow(2)
equals Q::residue()
.
source§fn sub(
a: &[FieldElement<F>; 2],
b: &[FieldElement<F>; 2],
) -> [FieldElement<F>; 2]
fn sub( a: &[FieldElement<F>; 2], b: &[FieldElement<F>; 2], ) -> [FieldElement<F>; 2]
Returns the component wise subtraction of a
and b
source§fn neg(a: &[FieldElement<F>; 2]) -> [FieldElement<F>; 2]
fn neg(a: &[FieldElement<F>; 2]) -> [FieldElement<F>; 2]
Returns the component wise negation of a
source§fn inv(a: &[FieldElement<F>; 2]) -> Result<[FieldElement<F>; 2], FieldError>
fn inv(a: &[FieldElement<F>; 2]) -> Result<[FieldElement<F>; 2], FieldError>
Returns the multiplicative inverse of a
This uses the equality (a0 + a1 * t) * (a0 - a1 * t) = a0.pow(2) - a1.pow(2) * Q::residue()
source§fn div(
a: &[FieldElement<F>; 2],
b: &[FieldElement<F>; 2],
) -> [FieldElement<F>; 2]
fn div( a: &[FieldElement<F>; 2], b: &[FieldElement<F>; 2], ) -> [FieldElement<F>; 2]
Returns the division of a
and b
source§fn eq(a: &[FieldElement<F>; 2], b: &[FieldElement<F>; 2]) -> bool
fn eq(a: &[FieldElement<F>; 2], b: &[FieldElement<F>; 2]) -> bool
Returns a boolean indicating whether a
and b
are equal component wise.
source§fn zero() -> [FieldElement<F>; 2]
fn zero() -> [FieldElement<F>; 2]
Returns the additive neutral element of the field extension.
source§fn one() -> [FieldElement<F>; 2]
fn one() -> [FieldElement<F>; 2]
Returns the multiplicative neutral element of the field extension.
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: [FieldElement<F>; 2]) -> [FieldElement<F>; 2]
fn from_base_type(x: [FieldElement<F>; 2]) -> [FieldElement<F>; 2]
Takes as input an element of BaseType and returns the internal representation of that element in the field. Note: for this case this is simply the identity, because the components already have correct representations.
type BaseType = [FieldElement<F>; 2]
source§fn square(a: &[FieldElement<F>; 2]) -> [FieldElement<F>; 2]
fn square(a: &[FieldElement<F>; 2]) -> [FieldElement<F>; 2]
a
and a
.fn pow<T>(a: &Self::BaseType, exponent: T) -> Self::BaseTypewhere
T: IsUnsignedInteger,
source§impl<F, T> PartialEq for QuadraticExtensionField<F, T>
impl<F, T> PartialEq for QuadraticExtensionField<F, T>
source§fn eq(&self, other: &QuadraticExtensionField<F, T>) -> bool
fn eq(&self, other: &QuadraticExtensionField<F, T>) -> bool
self
and other
values to be equal, and is used by ==
.impl<F, T> Eq for QuadraticExtensionField<F, T>
impl<F, T> StructuralPartialEq for QuadraticExtensionField<F, T>where
F: IsField,
T: HasQuadraticNonResidue<F>,
Auto Trait Implementations§
impl<F, T> Freeze for QuadraticExtensionField<F, T>
impl<F, T> RefUnwindSafe for QuadraticExtensionField<F, T>where
F: RefUnwindSafe,
T: RefUnwindSafe,
impl<F, T> Send for QuadraticExtensionField<F, T>
impl<F, T> Sync for QuadraticExtensionField<F, T>
impl<F, T> Unpin for QuadraticExtensionField<F, T>
impl<F, T> UnwindSafe for QuadraticExtensionField<F, T>where
F: UnwindSafe,
T: 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
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)
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>
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>
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