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§

source§

impl<P: Fp2Parameters> Fp2<P>

source

pub const fn new(c0: P::Fp, c1: P::Fp) -> Self

Initializes a Fp2 element from two Fp elements.

source§

impl<P: Fp2Parameters> Fp2<P>

source

pub fn norm(&self) -> P::Fp

Norm of Fp2 over Fp: Norm(a) = a.x^2 - beta * a.y^2

source

pub fn mul_by_fp(&mut self, element: &P::Fp)

Trait Implementations§

source§

impl<P: Fp2Parameters> Add<&&Fp2<P>> for Fp2<P>

§

type Output = Fp2<P>

The resulting type after applying the + operator.
source§

fn add(self, other: &&Self) -> Self

Performs the + operation. Read more
source§

impl<'a, P: Fp2Parameters> Add<&'a Fp2<P>> for Fp2<P>

§

type Output = Fp2<P>

The resulting type after applying the + operator.
source§

fn add(self, other: &Self) -> Self

Performs the + operation. Read more
source§

impl<'a, P: Fp2Parameters> Add<&'a mut Fp2<P>> for Fp2<P>

§

type Output = Fp2<P>

The resulting type after applying the + operator.
source§

fn add(self, other: &'a mut Self) -> Self

Performs the + operation. Read more
source§

impl<P: Fp2Parameters> Add for Fp2<P>

§

type Output = Fp2<P>

The resulting type after applying the + operator.
source§

fn add(self, other: Self) -> Self

Performs the + operation. Read more
source§

impl<P: Fp2Parameters> AddAssign<&&Fp2<P>> for Fp2<P>

source§

fn add_assign(&mut self, other: &&Self)

Performs the += operation. Read more
source§

impl<'a, P: Fp2Parameters> AddAssign<&'a Fp2<P>> for Fp2<P>

source§

fn add_assign(&mut self, other: &Self)

Performs the += operation. Read more
source§

impl<'a, P: Fp2Parameters> AddAssign<&'a mut Fp2<P>> for Fp2<P>

source§

fn add_assign(&mut self, other: &'a mut Self)

Performs the += operation. Read more
source§

impl<P: Fp2Parameters> AddAssign for Fp2<P>

source§

fn add_assign(&mut self, other: Self)

Performs the += operation. Read more
source§

impl<P: Fp2Parameters> CanonicalDeserialize for Fp2<P>

source§

impl<P: Fp2Parameters> CanonicalDeserializeWithFlags for Fp2<P>

source§

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>

source§

fn serialize_with_mode<W: Write>( &self, writer: W, _compress: Compress ) -> Result<(), SerializationError>

source§

fn serialized_size(&self, compress: Compress) -> usize

source§

fn serialize_compressed<W>(&self, writer: W) -> Result<(), SerializationError>
where W: Write,

source§

fn compressed_size(&self) -> usize

source§

fn serialize_uncompressed<W>(&self, writer: W) -> Result<(), SerializationError>
where W: Write,

source§

fn uncompressed_size(&self) -> usize

source§

impl<P: Fp2Parameters> CanonicalSerializeWithFlags for Fp2<P>

source§

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

Serializes self and flags into writer.
source§

impl<P: Clone + Fp2Parameters> Clone for Fp2<P>
where P::Fp: Clone,

source§

fn clone(&self) -> Fp2<P>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<P: Debug + Fp2Parameters> Debug for Fp2<P>
where P::Fp: Debug,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<P: Default + Fp2Parameters> Default for Fp2<P>
where P::Fp: Default,

source§

fn default() -> Fp2<P>

Returns the “default value” for a type. Read more
source§

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>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl<P: Fp2Parameters> Display for Fp2<P>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<P: Fp2Parameters> Distribution<Fp2<P>> for Standard

source§

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§

fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
where R: Rng, Self: Sized,

Create an iterator that generates random values of T, using rng as the source of randomness. Read more
source§

fn map<F, S>(self, func: F) -> DistMap<Self, F, T, S>
where F: Fn(T) -> S, Self: Sized,

Create a distribution of values of ‘S’ by mapping the output of Self through the closure F Read more
source§

impl<P: Fp2Parameters> Div<&&Fp2<P>> for Fp2<P>

§

type Output = Fp2<P>

The resulting type after applying the / operator.
source§

fn div(self, other: &&Self) -> Self

Performs the / operation. Read more
source§

impl<'a, P: Fp2Parameters> Div<&'a Fp2<P>> for Fp2<P>

§

type Output = Fp2<P>

The resulting type after applying the / operator.
source§

fn div(self, other: &Self) -> Self

Performs the / operation. Read more
source§

impl<'a, P: Fp2Parameters> Div<&'a mut Fp2<P>> for Fp2<P>

§

type Output = Fp2<P>

The resulting type after applying the / operator.
source§

fn div(self, other: &'a mut Self) -> Self

Performs the / operation. Read more
source§

impl<P: Fp2Parameters> Div for Fp2<P>

§

type Output = Fp2<P>

The resulting type after applying the / operator.
source§

fn div(self, other: Self) -> Self

Performs the / operation. Read more
source§

impl<P: Fp2Parameters> DivAssign<&&Fp2<P>> for Fp2<P>

source§

fn div_assign(&mut self, other: &&Self)

Performs the /= operation. Read more
source§

impl<'a, P: Fp2Parameters> DivAssign<&'a Fp2<P>> for Fp2<P>

source§

fn div_assign(&mut self, other: &Self)

Performs the /= operation. Read more
source§

impl<'a, P: Fp2Parameters> DivAssign<&'a mut Fp2<P>> for Fp2<P>

source§

fn div_assign(&mut self, other: &'a mut Self)

Performs the /= operation. Read more
source§

impl<P: Fp2Parameters> DivAssign for Fp2<P>

source§

fn div_assign(&mut self, other: Self)

Performs the /= operation. Read more
source§

impl<P: Fp2Parameters> Field for Fp2<P>

§

type BasePrimeField = <P as Fp2Parameters>::Fp

source§

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]

Returns the characteristic of the field.
source§

fn double(&self) -> Self

Returns self + self.
source§

fn double_in_place(&mut self)

Doubles self in place.
source§

fn square(&self) -> Self

Returns self * self.
source§

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>

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

Squares self in place.
source§

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>

Sets self to self’s inverse if it exists. Otherwise it is a no-op.
source§

fn frobenius_map(&mut self, power: usize)

Exponentiates this element by a power of the base prime modulus via the Frobenius automorphism.
source§

fn half() -> Self

Returns the constant 2^{-1}.
source§

fn sum_of_products<'a>( a: impl Iterator<Item = &'a Self> + Clone, b: impl Iterator<Item = &'a Self> + Clone ) -> Self

source§

fn pow<S: AsRef<[u64]>>(&self, exp: S) -> Self

Exponentiates this element by a number represented with u64 limbs, least significant limb first.
source§

impl<P: Fp2Parameters> From<u128> for Fp2<P>

source§

fn from(other: u128) -> Self

Converts to this type from the input type.
source§

impl<P: Fp2Parameters> From<u16> for Fp2<P>

source§

fn from(other: u16) -> Self

Converts to this type from the input type.
source§

impl<P: Fp2Parameters> From<u32> for Fp2<P>

source§

fn from(other: u32) -> Self

Converts to this type from the input type.
source§

impl<P: Fp2Parameters> From<u64> for Fp2<P>

source§

fn from(other: u64) -> Self

Converts to this type from the input type.
source§

impl<P: Fp2Parameters> From<u8> for Fp2<P>

source§

fn from(other: u8) -> Self

Converts to this type from the input type.
source§

impl<P: Fp2Parameters> FromBytes for Fp2<P>

source§

fn read_le<R: Read>(reader: R) -> IoResult<Self>

Reads Self from reader as little-endian bytes.
source§

fn from_bytes_le(bytes: &[u8]) -> Result<Self, Error>
where Self: Sized,

Returns Self from a byte array in little-endian order.
source§

impl<P: Hash + Fp2Parameters> Hash for Fp2<P>
where P::Fp: Hash,

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<P: Fp2Parameters> Mul<&&Fp2<P>> for Fp2<P>

§

type Output = Fp2<P>

The resulting type after applying the * operator.
source§

fn mul(self, other: &&Self) -> Self

Performs the * operation. Read more
source§

impl<'a, P: Fp2Parameters> Mul<&'a Fp2<P>> for Fp2<P>

§

type Output = Fp2<P>

The resulting type after applying the * operator.
source§

fn mul(self, other: &Self) -> Self

Performs the * operation. Read more
source§

impl<'a, P: Fp2Parameters> Mul<&'a mut Fp2<P>> for Fp2<P>

§

type Output = Fp2<P>

The resulting type after applying the * operator.
source§

fn mul(self, other: &'a mut Self) -> Self

Performs the * operation. Read more
source§

impl<P: Fp2Parameters> Mul for Fp2<P>

§

type Output = Fp2<P>

The resulting type after applying the * operator.
source§

fn mul(self, other: Self) -> Self

Performs the * operation. Read more
source§

impl<P: Fp2Parameters> MulAssign<&&Fp2<P>> for Fp2<P>

source§

fn mul_assign(&mut self, other: &&Self)

Performs the *= operation. Read more
source§

impl<'a, P: Fp2Parameters> MulAssign<&'a Fp2<P>> for Fp2<P>

source§

fn mul_assign(&mut self, other: &Self)

Performs the *= operation. Read more
source§

impl<'a, P: Fp2Parameters> MulAssign<&'a mut Fp2<P>> for Fp2<P>

source§

fn mul_assign(&mut self, other: &'a mut Self)

Performs the *= operation. Read more
source§

impl<P: Fp2Parameters> MulAssign for Fp2<P>

source§

fn mul_assign(&mut self, other: Self)

Performs the *= operation. Read more
source§

impl<P: Fp2Parameters> Neg for Fp2<P>

§

type Output = Fp2<P>

The resulting type after applying the - operator.
source§

fn neg(self) -> Self

Performs the unary - operation. Read more
source§

impl<P: Fp2Parameters> One for Fp2<P>

source§

fn one() -> Self

Returns the multiplicative identity element of Self, 1. Read more
source§

fn is_one(&self) -> bool

Returns true if self is equal to the multiplicative identity. Read more
source§

fn set_one(&mut self)

Sets self to the multiplicative identity element of Self, 1.
source§

impl<P: Fp2Parameters> Ord for Fp2<P>

Fp2 elements are ordered lexicographically.

source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl<P: PartialEq + Fp2Parameters> PartialEq for Fp2<P>
where P::Fp: PartialEq,

source§

fn eq(&self, other: &Fp2<P>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<P: Fp2Parameters> PartialOrd for Fp2<P>

source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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 more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<'a, P: Fp2Parameters> Product<&'a Fp2<P>> for Fp2<P>

source§

fn product<I: Iterator<Item = &'a Self>>(iter: I) -> Self

Method which takes an iterator and generates Self from the elements by multiplying the items.
source§

impl<P: Fp2Parameters> Product for Fp2<P>

source§

fn product<I: Iterator<Item = Self>>(iter: I) -> Self

Method which takes an iterator and generates Self from the elements by multiplying the items.
source§

impl<P: Fp2Parameters> Serialize for Fp2<P>
where P::Fp: Serialize,

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl<P: Fp2Parameters> SquareRootField for Fp2<P>
where P::Fp: SquareRootField,

source§

fn legendre(&self) -> LegendreSymbol

Returns the Legendre symbol.
source§

fn sqrt(&self) -> Option<Self>

Returns the square root of self, if it exists.
source§

fn sqrt_in_place(&mut self) -> Option<&mut Self>

Sets self to be the square root of self, if it exists.
source§

impl<P: Fp2Parameters> Sub<&&Fp2<P>> for Fp2<P>

§

type Output = Fp2<P>

The resulting type after applying the - operator.
source§

fn sub(self, other: &&Self) -> Self

Performs the - operation. Read more
source§

impl<'a, P: Fp2Parameters> Sub<&'a Fp2<P>> for Fp2<P>

§

type Output = Fp2<P>

The resulting type after applying the - operator.
source§

fn sub(self, other: &Self) -> Self

Performs the - operation. Read more
source§

impl<'a, P: Fp2Parameters> Sub<&'a mut Fp2<P>> for Fp2<P>

§

type Output = Fp2<P>

The resulting type after applying the - operator.
source§

fn sub(self, other: &'a mut Self) -> Self

Performs the - operation. Read more
source§

impl<P: Fp2Parameters> Sub for Fp2<P>

§

type Output = Fp2<P>

The resulting type after applying the - operator.
source§

fn sub(self, other: Self) -> Self

Performs the - operation. Read more
source§

impl<P: Fp2Parameters> SubAssign<&&Fp2<P>> for Fp2<P>

source§

fn sub_assign(&mut self, other: &&Self)

Performs the -= operation. Read more
source§

impl<'a, P: Fp2Parameters> SubAssign<&'a Fp2<P>> for Fp2<P>

source§

fn sub_assign(&mut self, other: &Self)

Performs the -= operation. Read more
source§

impl<'a, P: Fp2Parameters> SubAssign<&'a mut Fp2<P>> for Fp2<P>

source§

fn sub_assign(&mut self, other: &'a mut Self)

Performs the -= operation. Read more
source§

impl<P: Fp2Parameters> SubAssign for Fp2<P>

source§

fn sub_assign(&mut self, other: Self)

Performs the -= operation. Read more
source§

impl<'a, P: Fp2Parameters> Sum<&'a Fp2<P>> for Fp2<P>

source§

fn sum<I: Iterator<Item = &'a Self>>(iter: I) -> Self

Method which takes an iterator and generates Self from the elements by “summing up” the items.
source§

impl<P: Fp2Parameters> Sum for Fp2<P>

source§

fn sum<I: Iterator<Item = Self>>(iter: I) -> Self

Method which takes an iterator and generates Self from the elements by “summing up” the items.
source§

impl<P: Fp2Parameters> ToBits for Fp2<P>

source§

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>)

Writes self into the given vector as a boolean array in big-endian order.
source§

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>

Returns self as a boolean array in big-endian order.
source§

fn num_bits() -> Option<usize>

An optional indication of how many bits an object can be represented with.
source§

impl<P: Fp2Parameters> ToBytes for Fp2<P>

source§

fn write_le<W: Write>(&self, writer: W) -> IoResult<()>

Writes self into writer as little-endian bytes.
source§

fn to_bytes_le(&self) -> Result<Vec<u8>, Error>
where Self: Sized,

Returns self as a byte array in little-endian order.
source§

impl<P: Fp2Parameters> ToConstraintField<<P as Fp2Parameters>::Fp> for Fp2<P>

source§

impl<P: Fp2Parameters> Valid for Fp2<P>

source§

fn check(&self) -> Result<(), SerializationError>

source§

fn batch_check<'a>( _batch: impl Iterator<Item = &'a Self> + Send ) -> Result<(), SerializationError>
where Self: 'a,

source§

impl<P: Fp2Parameters> Zero for Fp2<P>

source§

fn zero() -> Self

source§

fn is_zero(&self) -> bool

source§

impl<P: Copy + Fp2Parameters> Copy for Fp2<P>
where P::Fp: Copy,

source§

impl<P: Eq + Fp2Parameters> Eq for Fp2<P>
where P::Fp: Eq,

source§

impl<P: Fp2Parameters> StructuralPartialEq for Fp2<P>

Auto Trait Implementations§

§

impl<P> RefUnwindSafe for Fp2<P>

§

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
source§

impl<'de, T> DeserializeExt<'de> for T

source§

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 Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

impl<T> ToSmolStr for T
where T: Display + ?Sized,

§

fn to_smolstr(&self) -> SmolStr

source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> Uniform for T

source§

fn rand<R>(rng: &mut R) -> T
where R: Rng + ?Sized,

Samples a random value from a uniform distribution.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,