pub struct Fp2<P>where
P: Fp2Parameters,{
pub c0: <P as Fp2Parameters>::Fp,
pub c1: <P as Fp2Parameters>::Fp,
}
Fields§
§c0: <P as Fp2Parameters>::Fp
§c1: <P as Fp2Parameters>::Fp
Implementations§
Source§impl<P> Fp2<P>where
P: Fp2Parameters,
impl<P> Fp2<P>where
P: Fp2Parameters,
Sourcepub const fn new(
c0: <P as Fp2Parameters>::Fp,
c1: <P as Fp2Parameters>::Fp,
) -> Fp2<P>
pub const fn new( c0: <P as Fp2Parameters>::Fp, c1: <P as Fp2Parameters>::Fp, ) -> Fp2<P>
Initializes a Fp2
element from two Fp
elements.
Source§impl<P> Fp2<P>where
P: Fp2Parameters,
impl<P> Fp2<P>where
P: Fp2Parameters,
Sourcepub fn norm(&self) -> <P as Fp2Parameters>::Fp
pub fn norm(&self) -> <P as Fp2Parameters>::Fp
Norm of Fp2 over Fp: Norm(a) = a.x^2 - beta * a.y^2
pub fn mul_by_fp(&mut self, element: &<P as Fp2Parameters>::Fp)
Trait Implementations§
Source§impl<P> Add for Fp2<P>where
P: Fp2Parameters,
impl<P> Add for Fp2<P>where
P: Fp2Parameters,
Source§impl<P> AddAssign<&&Fp2<P>> for Fp2<P>where
P: Fp2Parameters,
impl<P> AddAssign<&&Fp2<P>> for Fp2<P>where
P: Fp2Parameters,
Source§fn add_assign(&mut self, other: &&Fp2<P>)
fn add_assign(&mut self, other: &&Fp2<P>)
Performs the
+=
operation. Read moreSource§impl<P> AddAssign<&Fp2<P>> for Fp2<P>where
P: Fp2Parameters,
impl<P> AddAssign<&Fp2<P>> for Fp2<P>where
P: Fp2Parameters,
Source§fn add_assign(&mut self, other: &Fp2<P>)
fn add_assign(&mut self, other: &Fp2<P>)
Performs the
+=
operation. Read moreSource§impl<'a, P> AddAssign<&'a mut Fp2<P>> for Fp2<P>where
P: Fp2Parameters,
impl<'a, P> AddAssign<&'a mut Fp2<P>> for Fp2<P>where
P: Fp2Parameters,
Source§fn add_assign(&mut self, other: &'a mut Fp2<P>)
fn add_assign(&mut self, other: &'a mut Fp2<P>)
Performs the
+=
operation. Read moreSource§impl<P> AddAssign for Fp2<P>where
P: Fp2Parameters,
impl<P> AddAssign for Fp2<P>where
P: Fp2Parameters,
Source§fn add_assign(&mut self, other: Fp2<P>)
fn add_assign(&mut self, other: Fp2<P>)
Performs the
+=
operation. Read moreSource§impl<P> CanonicalDeserialize for Fp2<P>where
P: Fp2Parameters,
impl<P> CanonicalDeserialize for Fp2<P>where
P: Fp2Parameters,
fn deserialize_with_mode<R>(
reader: R,
compress: Compress,
validate: Validate,
) -> Result<Fp2<P>, SerializationError>where
R: Read,
fn deserialize_compressed<R>(reader: R) -> Result<Self, SerializationError>where
R: Read,
fn deserialize_compressed_unchecked<R>(
reader: R,
) -> Result<Self, SerializationError>where
R: Read,
fn deserialize_uncompressed<R>(reader: R) -> Result<Self, SerializationError>where
R: Read,
fn deserialize_uncompressed_unchecked<R>(
reader: R,
) -> Result<Self, SerializationError>where
R: Read,
Source§impl<P> CanonicalDeserializeWithFlags for Fp2<P>where
P: Fp2Parameters,
impl<P> CanonicalDeserializeWithFlags for Fp2<P>where
P: Fp2Parameters,
Source§fn deserialize_with_flags<R, F>(
reader: R,
) -> Result<(Fp2<P>, F), SerializationError>
fn deserialize_with_flags<R, F>( reader: R, ) -> Result<(Fp2<P>, F), SerializationError>
Reads
Self
and Flags
from reader
.
Returns empty flags by default.Source§impl<P> CanonicalSerialize for Fp2<P>where
P: Fp2Parameters,
impl<P> CanonicalSerialize for Fp2<P>where
P: Fp2Parameters,
fn serialize_with_mode<W>(
&self,
writer: W,
_compress: Compress,
) -> Result<(), SerializationError>where
W: Write,
fn serialized_size(&self, compress: Compress) -> usize
fn serialize_compressed<W>(&self, writer: W) -> Result<(), SerializationError>where
W: Write,
fn compressed_size(&self) -> usize
fn serialize_uncompressed<W>(&self, writer: W) -> Result<(), SerializationError>where
W: Write,
fn uncompressed_size(&self) -> usize
Source§impl<P> CanonicalSerializeWithFlags for Fp2<P>where
P: Fp2Parameters,
impl<P> CanonicalSerializeWithFlags for Fp2<P>where
P: Fp2Parameters,
Source§fn serialize_with_flags<W, F>(
&self,
writer: W,
flags: F,
) -> Result<(), SerializationError>
fn serialize_with_flags<W, F>( &self, writer: W, flags: F, ) -> Result<(), SerializationError>
Serializes
self
and flags
into writer
.Source§fn serialized_size_with_flags<F>(&self) -> usizewhere
F: Flags,
fn serialized_size_with_flags<F>(&self) -> usizewhere
F: Flags,
Serializes
self
and flags
into writer
.Source§impl<'de, P> Deserialize<'de> for Fp2<P>
impl<'de, P> Deserialize<'de> for Fp2<P>
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Fp2<P>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Fp2<P>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<P> Display for Fp2<P>where
P: Fp2Parameters,
impl<P> Display for Fp2<P>where
P: Fp2Parameters,
Source§impl<P> Div for Fp2<P>where
P: Fp2Parameters,
impl<P> Div for Fp2<P>where
P: Fp2Parameters,
Source§impl<P> DivAssign<&&Fp2<P>> for Fp2<P>where
P: Fp2Parameters,
impl<P> DivAssign<&&Fp2<P>> for Fp2<P>where
P: Fp2Parameters,
Source§fn div_assign(&mut self, other: &&Fp2<P>)
fn div_assign(&mut self, other: &&Fp2<P>)
Performs the
/=
operation. Read moreSource§impl<P> DivAssign<&Fp2<P>> for Fp2<P>where
P: Fp2Parameters,
impl<P> DivAssign<&Fp2<P>> for Fp2<P>where
P: Fp2Parameters,
Source§fn div_assign(&mut self, other: &Fp2<P>)
fn div_assign(&mut self, other: &Fp2<P>)
Performs the
/=
operation. Read moreSource§impl<'a, P> DivAssign<&'a mut Fp2<P>> for Fp2<P>where
P: Fp2Parameters,
impl<'a, P> DivAssign<&'a mut Fp2<P>> for Fp2<P>where
P: Fp2Parameters,
Source§fn div_assign(&mut self, other: &'a mut Fp2<P>)
fn div_assign(&mut self, other: &'a mut Fp2<P>)
Performs the
/=
operation. Read moreSource§impl<P> DivAssign for Fp2<P>where
P: Fp2Parameters,
impl<P> DivAssign for Fp2<P>where
P: Fp2Parameters,
Source§fn div_assign(&mut self, other: Fp2<P>)
fn div_assign(&mut self, other: Fp2<P>)
Performs the
/=
operation. Read moreSource§impl<P> Field for Fp2<P>where
P: Fp2Parameters,
impl<P> Field for Fp2<P>where
P: Fp2Parameters,
type BasePrimeField = <P as Fp2Parameters>::Fp
Source§fn from_base_prime_field(other: <Fp2<P> as Field>::BasePrimeField) -> Fp2<P>
fn from_base_prime_field(other: <Fp2<P> as Field>::BasePrimeField) -> Fp2<P>
Constructs an element of
Self
from an element of the base
prime field.Source§fn characteristic<'a>() -> &'a [u64]
fn characteristic<'a>() -> &'a [u64]
Returns the characteristic of the field.
Source§fn double_in_place(&mut self)
fn double_in_place(&mut self)
Doubles
self
in place.Source§fn from_random_bytes_with_flags<F>(bytes: &[u8]) -> Option<(Fp2<P>, F)>where
F: Flags,
fn from_random_bytes_with_flags<F>(bytes: &[u8]) -> Option<(Fp2<P>, F)>where
F: Flags,
Returns a field element with an extra sign bit used for group parsing if
the set of bytes forms a valid field element, otherwise returns
None. This function is primarily intended for sampling
random field elements from a hash-function or RNG output.
Source§fn from_random_bytes(bytes: &[u8]) -> Option<Fp2<P>>
fn from_random_bytes(bytes: &[u8]) -> Option<Fp2<P>>
Returns a field element if the set of bytes forms a valid field element,
otherwise returns None. This function is primarily intended for sampling
random field elements from a hash-function or RNG output.
Source§fn square_in_place(&mut self) -> &mut Fp2<P>
fn square_in_place(&mut self) -> &mut Fp2<P>
Squares
self
in place.Source§fn inverse(&self) -> Option<Fp2<P>>
fn inverse(&self) -> Option<Fp2<P>>
Computes the multiplicative inverse of
self
if self
is nonzero.Source§fn inverse_in_place(&mut self) -> Option<&mut Fp2<P>>
fn inverse_in_place(&mut self) -> Option<&mut Fp2<P>>
Sets
self
to self
’s inverse if it exists. Otherwise it is a no-op.Source§fn frobenius_map(&mut self, power: usize)
fn frobenius_map(&mut self, power: usize)
Exponentiates this element by a power of the base prime modulus via
the Frobenius automorphism.
fn sum_of_products<'a>( a: impl Iterator<Item = &'a Self> + Clone, b: impl Iterator<Item = &'a Self> + Clone, ) -> Self
Source§impl<P> FromBytes for Fp2<P>where
P: Fp2Parameters,
impl<P> FromBytes for Fp2<P>where
P: Fp2Parameters,
Source§impl<P> Mul for Fp2<P>where
P: Fp2Parameters,
impl<P> Mul for Fp2<P>where
P: Fp2Parameters,
Source§impl<P> MulAssign<&&Fp2<P>> for Fp2<P>where
P: Fp2Parameters,
impl<P> MulAssign<&&Fp2<P>> for Fp2<P>where
P: Fp2Parameters,
Source§fn mul_assign(&mut self, other: &&Fp2<P>)
fn mul_assign(&mut self, other: &&Fp2<P>)
Performs the
*=
operation. Read moreSource§impl<P> MulAssign<&Fp2<P>> for Fp2<P>where
P: Fp2Parameters,
impl<P> MulAssign<&Fp2<P>> for Fp2<P>where
P: Fp2Parameters,
Source§fn mul_assign(&mut self, other: &Fp2<P>)
fn mul_assign(&mut self, other: &Fp2<P>)
Performs the
*=
operation. Read moreSource§impl<'a, P> MulAssign<&'a mut Fp2<P>> for Fp2<P>where
P: Fp2Parameters,
impl<'a, P> MulAssign<&'a mut Fp2<P>> for Fp2<P>where
P: Fp2Parameters,
Source§fn mul_assign(&mut self, other: &'a mut Fp2<P>)
fn mul_assign(&mut self, other: &'a mut Fp2<P>)
Performs the
*=
operation. Read moreSource§impl<P> MulAssign for Fp2<P>where
P: Fp2Parameters,
impl<P> MulAssign for Fp2<P>where
P: Fp2Parameters,
Source§fn mul_assign(&mut self, other: Fp2<P>)
fn mul_assign(&mut self, other: Fp2<P>)
Performs the
*=
operation. Read moreSource§impl<P> Neg for Fp2<P>where
P: Fp2Parameters,
impl<P> Neg for Fp2<P>where
P: Fp2Parameters,
Source§impl<P> One for Fp2<P>where
P: Fp2Parameters,
impl<P> One for Fp2<P>where
P: Fp2Parameters,
Source§impl<P> Ord for Fp2<P>where
P: Fp2Parameters,
Fp2
elements are ordered lexicographically.
impl<P> Ord for Fp2<P>where
P: Fp2Parameters,
Fp2
elements are ordered lexicographically.
Source§impl<P> PartialOrd for Fp2<P>where
P: Fp2Parameters,
impl<P> PartialOrd for Fp2<P>where
P: Fp2Parameters,
Source§impl<P> Product for Fp2<P>where
P: Fp2Parameters,
impl<P> Product for Fp2<P>where
P: Fp2Parameters,
Source§impl<P> Serialize for Fp2<P>
impl<P> Serialize for Fp2<P>
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Source§impl<P> SquareRootField for Fp2<P>
impl<P> SquareRootField for Fp2<P>
Source§impl<P> Sub for Fp2<P>where
P: Fp2Parameters,
impl<P> Sub for Fp2<P>where
P: Fp2Parameters,
Source§impl<P> SubAssign<&&Fp2<P>> for Fp2<P>where
P: Fp2Parameters,
impl<P> SubAssign<&&Fp2<P>> for Fp2<P>where
P: Fp2Parameters,
Source§fn sub_assign(&mut self, other: &&Fp2<P>)
fn sub_assign(&mut self, other: &&Fp2<P>)
Performs the
-=
operation. Read moreSource§impl<P> SubAssign<&Fp2<P>> for Fp2<P>where
P: Fp2Parameters,
impl<P> SubAssign<&Fp2<P>> for Fp2<P>where
P: Fp2Parameters,
Source§fn sub_assign(&mut self, other: &Fp2<P>)
fn sub_assign(&mut self, other: &Fp2<P>)
Performs the
-=
operation. Read moreSource§impl<'a, P> SubAssign<&'a mut Fp2<P>> for Fp2<P>where
P: Fp2Parameters,
impl<'a, P> SubAssign<&'a mut Fp2<P>> for Fp2<P>where
P: Fp2Parameters,
Source§fn sub_assign(&mut self, other: &'a mut Fp2<P>)
fn sub_assign(&mut self, other: &'a mut Fp2<P>)
Performs the
-=
operation. Read moreSource§impl<P> SubAssign for Fp2<P>where
P: Fp2Parameters,
impl<P> SubAssign for Fp2<P>where
P: Fp2Parameters,
Source§fn sub_assign(&mut self, other: Fp2<P>)
fn sub_assign(&mut self, other: Fp2<P>)
Performs the
-=
operation. Read moreSource§impl<P> Sum for Fp2<P>where
P: Fp2Parameters,
impl<P> Sum for Fp2<P>where
P: Fp2Parameters,
Source§impl<P> ToBits for Fp2<P>where
P: Fp2Parameters,
impl<P> ToBits for Fp2<P>where
P: Fp2Parameters,
Source§fn write_bits_le(&self, vec: &mut Vec<bool>)
fn write_bits_le(&self, vec: &mut Vec<bool>)
Writes
self
into the given vector as a boolean array in little-endian order.Source§fn write_bits_be(&self, vec: &mut Vec<bool>)
fn write_bits_be(&self, vec: &mut Vec<bool>)
Writes
self
into the given vector as a boolean array in big-endian order.Source§fn to_bits_le(&self) -> Vec<bool>
fn to_bits_le(&self) -> Vec<bool>
Returns
self
as a boolean array in little-endian order.Source§fn to_bits_be(&self) -> Vec<bool>
fn to_bits_be(&self) -> Vec<bool>
Returns
self
as a boolean array in big-endian order.Source§impl<P> ToBytes for Fp2<P>where
P: Fp2Parameters,
impl<P> ToBytes for Fp2<P>where
P: Fp2Parameters,
Source§impl<P> ToConstraintField<<P as Fp2Parameters>::Fp> for Fp2<P>where
P: Fp2Parameters,
impl<P> ToConstraintField<<P as Fp2Parameters>::Fp> for Fp2<P>where
P: Fp2Parameters,
fn to_field_elements( &self, ) -> Result<Vec<<P as Fp2Parameters>::Fp>, ConstraintFieldError>
Source§impl<P> Valid for Fp2<P>where
P: Fp2Parameters,
impl<P> Valid for Fp2<P>where
P: Fp2Parameters,
Source§impl<P> Zero for Fp2<P>where
P: Fp2Parameters,
impl<P> Zero for Fp2<P>where
P: Fp2Parameters,
impl<P> Copy for Fp2<P>
impl<P> Eq for Fp2<P>
impl<P> StructuralPartialEq for Fp2<P>where
P: Fp2Parameters,
Auto Trait Implementations§
impl<P> Freeze for Fp2<P>
impl<P> RefUnwindSafe for Fp2<P>
impl<P> Send for Fp2<P>
impl<P> Sync for Fp2<P>
impl<P> Unpin for Fp2<P>
impl<P> UnwindSafe for Fp2<P>
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§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<'de, T> DeserializeExt<'de> for Twhere
T: DeserializeOwned,
impl<'de, T> DeserializeExt<'de> for Twhere
T: DeserializeOwned,
fn take_from_value<D>(
value: &mut Value,
field: &str,
) -> Result<T, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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