Struct snarkvm_fields::Fp2
source · pub struct Fp2<P: Fp2Parameters> {
pub c0: P::Fp,
pub c1: P::Fp,
}
Fields§
§c0: P::Fp
§c1: P::Fp
Implementations§
Trait Implementations§
source§impl<P: Fp2Parameters> AddAssign<&&Fp2<P>> for Fp2<P>
impl<P: Fp2Parameters> AddAssign<&&Fp2<P>> for Fp2<P>
source§fn add_assign(&mut self, other: &&Self)
fn add_assign(&mut self, other: &&Self)
Performs the
+=
operation. Read moresource§impl<'a, P: Fp2Parameters> AddAssign<&'a Fp2<P>> for Fp2<P>
impl<'a, P: Fp2Parameters> AddAssign<&'a Fp2<P>> for Fp2<P>
source§fn add_assign(&mut self, other: &Self)
fn add_assign(&mut self, other: &Self)
Performs the
+=
operation. Read moresource§impl<'a, P: Fp2Parameters> AddAssign<&'a mut Fp2<P>> for Fp2<P>
impl<'a, P: Fp2Parameters> AddAssign<&'a mut Fp2<P>> for Fp2<P>
source§fn add_assign(&mut self, other: &'a mut Self)
fn add_assign(&mut self, other: &'a mut Self)
Performs the
+=
operation. Read moresource§impl<P: Fp2Parameters> AddAssign<Fp2<P>> for Fp2<P>
impl<P: Fp2Parameters> AddAssign<Fp2<P>> for Fp2<P>
source§fn add_assign(&mut self, other: Self)
fn add_assign(&mut self, other: Self)
Performs the
+=
operation. Read moresource§impl<P: Fp2Parameters> CanonicalDeserialize for Fp2<P>
impl<P: Fp2Parameters> CanonicalDeserialize for Fp2<P>
fn deserialize_with_mode<R: Read>( reader: R, compress: Compress, validate: Validate ) -> Result<Self, SerializationError>
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: Fp2Parameters> CanonicalDeserializeWithFlags for Fp2<P>
impl<P: Fp2Parameters> CanonicalDeserializeWithFlags for Fp2<P>
source§fn deserialize_with_flags<R: Read, F: Flags>(
reader: R
) -> Result<(Self, F), SerializationError>
fn deserialize_with_flags<R: Read, F: Flags>( reader: R ) -> Result<(Self, F), SerializationError>
Reads
Self
and Flags
from reader
.
Returns empty flags by default.source§impl<P: Fp2Parameters> CanonicalSerialize for Fp2<P>
impl<P: Fp2Parameters> CanonicalSerialize for Fp2<P>
fn serialize_with_mode<W: Write>( &self, writer: W, _compress: Compress ) -> Result<(), SerializationError>
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: Fp2Parameters> CanonicalSerializeWithFlags for Fp2<P>
impl<P: Fp2Parameters> CanonicalSerializeWithFlags for Fp2<P>
source§fn serialize_with_flags<W: Write, F: Flags>(
&self,
writer: W,
flags: F
) -> Result<(), SerializationError>
fn serialize_with_flags<W: Write, F: Flags>( &self, writer: W, flags: F ) -> Result<(), SerializationError>
Serializes
self
and flags
into writer
.source§fn serialized_size_with_flags<F: Flags>(&self) -> usize
fn serialized_size_with_flags<F: Flags>(&self) -> usize
Serializes
self
and flags
into writer
.source§impl<P> Clone for Fp2<P>where
P: Fp2Parameters,
impl<P> Clone for Fp2<P>where P: Fp2Parameters,
source§impl<P> Debug for Fp2<P>where
P: Fp2Parameters,
impl<P> Debug for Fp2<P>where P: Fp2Parameters,
source§impl<P> Default for Fp2<P>where
P: Fp2Parameters,
impl<P> Default for Fp2<P>where P: Fp2Parameters,
source§impl<'de, P: Fp2Parameters> Deserialize<'de> for Fp2<P>where
P::Fp: Deserialize<'de>,
impl<'de, P: Fp2Parameters> Deserialize<'de> for Fp2<P>where P::Fp: Deserialize<'de>,
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl<P: Fp2Parameters> Display for Fp2<P>
impl<P: Fp2Parameters> Display for Fp2<P>
source§impl<P: Fp2Parameters> Distribution<Fp2<P>> for Standard
impl<P: Fp2Parameters> Distribution<Fp2<P>> for Standard
source§fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Fp2<P>
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Fp2<P>
Generate a random value of
T
, using rng
as the source of randomness.source§impl<P: Fp2Parameters> DivAssign<&&Fp2<P>> for Fp2<P>
impl<P: Fp2Parameters> DivAssign<&&Fp2<P>> for Fp2<P>
source§fn div_assign(&mut self, other: &&Self)
fn div_assign(&mut self, other: &&Self)
Performs the
/=
operation. Read moresource§impl<'a, P: Fp2Parameters> DivAssign<&'a Fp2<P>> for Fp2<P>
impl<'a, P: Fp2Parameters> DivAssign<&'a Fp2<P>> for Fp2<P>
source§fn div_assign(&mut self, other: &Self)
fn div_assign(&mut self, other: &Self)
Performs the
/=
operation. Read moresource§impl<'a, P: Fp2Parameters> DivAssign<&'a mut Fp2<P>> for Fp2<P>
impl<'a, P: Fp2Parameters> DivAssign<&'a mut Fp2<P>> for Fp2<P>
source§fn div_assign(&mut self, other: &'a mut Self)
fn div_assign(&mut self, other: &'a mut Self)
Performs the
/=
operation. Read moresource§impl<P: Fp2Parameters> DivAssign<Fp2<P>> for Fp2<P>
impl<P: Fp2Parameters> DivAssign<Fp2<P>> for Fp2<P>
source§fn div_assign(&mut self, other: Self)
fn div_assign(&mut self, other: Self)
Performs the
/=
operation. Read moresource§impl<P: Fp2Parameters> Field for Fp2<P>
impl<P: Fp2Parameters> Field for Fp2<P>
type BasePrimeField = <P as Fp2Parameters>::Fp
source§fn from_base_prime_field(other: Self::BasePrimeField) -> Self
fn from_base_prime_field(other: Self::BasePrimeField) -> Self
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: Flags>(bytes: &[u8]) -> Option<(Self, F)>
fn from_random_bytes_with_flags<F: Flags>(bytes: &[u8]) -> Option<(Self, F)>
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<Self>
fn from_random_bytes(bytes: &[u8]) -> Option<Self>
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 Self
fn square_in_place(&mut self) -> &mut Self
Squares
self
in place.source§fn inverse(&self) -> Option<Self>
fn inverse(&self) -> Option<Self>
Computes the multiplicative inverse of
self
if self
is nonzero.source§fn inverse_in_place(&mut self) -> Option<&mut Self>
fn inverse_in_place(&mut self) -> Option<&mut Self>
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: Fp2Parameters> FromBytes for Fp2<P>
impl<P: Fp2Parameters> FromBytes for Fp2<P>
source§impl<P> Hash for Fp2<P>where
P: Fp2Parameters,
impl<P> Hash for Fp2<P>where P: Fp2Parameters,
source§impl<P: Fp2Parameters> MulAssign<&&Fp2<P>> for Fp2<P>
impl<P: Fp2Parameters> MulAssign<&&Fp2<P>> for Fp2<P>
source§fn mul_assign(&mut self, other: &&Self)
fn mul_assign(&mut self, other: &&Self)
Performs the
*=
operation. Read moresource§impl<'a, P: Fp2Parameters> MulAssign<&'a Fp2<P>> for Fp2<P>
impl<'a, P: Fp2Parameters> MulAssign<&'a Fp2<P>> for Fp2<P>
source§fn mul_assign(&mut self, other: &Self)
fn mul_assign(&mut self, other: &Self)
Performs the
*=
operation. Read moresource§impl<'a, P: Fp2Parameters> MulAssign<&'a mut Fp2<P>> for Fp2<P>
impl<'a, P: Fp2Parameters> MulAssign<&'a mut Fp2<P>> for Fp2<P>
source§fn mul_assign(&mut self, other: &'a mut Self)
fn mul_assign(&mut self, other: &'a mut Self)
Performs the
*=
operation. Read moresource§impl<P: Fp2Parameters> MulAssign<Fp2<P>> for Fp2<P>
impl<P: Fp2Parameters> MulAssign<Fp2<P>> for Fp2<P>
source§fn mul_assign(&mut self, other: Self)
fn mul_assign(&mut self, other: Self)
Performs the
*=
operation. Read moresource§impl<P: Fp2Parameters> Neg for Fp2<P>
impl<P: Fp2Parameters> Neg for Fp2<P>
source§impl<P: Fp2Parameters> One for Fp2<P>
impl<P: Fp2Parameters> One for Fp2<P>
source§impl<P: Fp2Parameters> Ord for Fp2<P>
impl<P: Fp2Parameters> Ord for Fp2<P>
Fp2
elements are ordered lexicographically.
source§impl<P> PartialEq<Fp2<P>> for Fp2<P>where
P: Fp2Parameters,
impl<P> PartialEq<Fp2<P>> for Fp2<P>where P: Fp2Parameters,
source§impl<P: Fp2Parameters> PartialOrd<Fp2<P>> for Fp2<P>
impl<P: Fp2Parameters> PartialOrd<Fp2<P>> for Fp2<P>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl<P: Fp2Parameters> SquareRootField for Fp2<P>where
P::Fp: SquareRootField,
impl<P: Fp2Parameters> SquareRootField for Fp2<P>where P::Fp: SquareRootField,
source§impl<P: Fp2Parameters> SubAssign<&&Fp2<P>> for Fp2<P>
impl<P: Fp2Parameters> SubAssign<&&Fp2<P>> for Fp2<P>
source§fn sub_assign(&mut self, other: &&Self)
fn sub_assign(&mut self, other: &&Self)
Performs the
-=
operation. Read moresource§impl<'a, P: Fp2Parameters> SubAssign<&'a Fp2<P>> for Fp2<P>
impl<'a, P: Fp2Parameters> SubAssign<&'a Fp2<P>> for Fp2<P>
source§fn sub_assign(&mut self, other: &Self)
fn sub_assign(&mut self, other: &Self)
Performs the
-=
operation. Read moresource§impl<'a, P: Fp2Parameters> SubAssign<&'a mut Fp2<P>> for Fp2<P>
impl<'a, P: Fp2Parameters> SubAssign<&'a mut Fp2<P>> for Fp2<P>
source§fn sub_assign(&mut self, other: &'a mut Self)
fn sub_assign(&mut self, other: &'a mut Self)
Performs the
-=
operation. Read moresource§impl<P: Fp2Parameters> SubAssign<Fp2<P>> for Fp2<P>
impl<P: Fp2Parameters> SubAssign<Fp2<P>> for Fp2<P>
source§fn sub_assign(&mut self, other: Self)
fn sub_assign(&mut self, other: Self)
Performs the
-=
operation. Read moresource§impl<P: Fp2Parameters> ToBits for Fp2<P>
impl<P: Fp2Parameters> ToBits for Fp2<P>
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: Fp2Parameters> ToBytes for Fp2<P>
impl<P: Fp2Parameters> ToBytes for Fp2<P>
source§impl<P: Fp2Parameters> ToConstraintField<<P as Fp2Parameters>::Fp> for Fp2<P>
impl<P: Fp2Parameters> ToConstraintField<<P as Fp2Parameters>::Fp> for Fp2<P>
fn to_field_elements(&self) -> Result<Vec<P::Fp>, ConstraintFieldError>
source§impl<P: Fp2Parameters> Valid for Fp2<P>
impl<P: Fp2Parameters> Valid for Fp2<P>
fn check(&self) -> Result<(), SerializationError>
fn batch_check<'a>( _batch: impl Iterator<Item = &'a Self> + Send ) -> Result<(), SerializationError>where Self: 'a,
source§impl<P: Fp2Parameters> Zero for Fp2<P>
impl<P: Fp2Parameters> Zero for Fp2<P>
impl<P> Copy for Fp2<P>where P: Fp2Parameters,
impl<P> Eq for Fp2<P>where P: Fp2Parameters,
Auto Trait Implementations§
impl<P> RefUnwindSafe for Fp2<P>where <P as Fp2Parameters>::Fp: RefUnwindSafe,
impl<P> Send for Fp2<P>
impl<P> Sync for Fp2<P>
impl<P> Unpin for Fp2<P>where <P as Fp2Parameters>::Fp: Unpin,
impl<P> UnwindSafe for Fp2<P>where <P as Fp2Parameters>::Fp: 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<'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>,
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.