twenty_first::math::x_field_element

Struct XFieldElement

Source
pub struct XFieldElement {
    pub coefficients: [BFieldElement; 3],
}

Fields§

§coefficients: [BFieldElement; 3]

Implementations§

Source§

impl XFieldElement

Source

pub fn shah_polynomial() -> Polynomial<'static, BFieldElement>

The quotient defining the field extension over the base field, namely x³ - x + 1.

Source

pub const fn new(coefficients: [BFieldElement; 3]) -> Self

Source

pub const fn new_const(element: BFieldElement) -> Self

Source

pub fn unlift(&self) -> Option<BFieldElement>

Source

pub fn increment(&mut self, index: usize)

Source

pub fn decrement(&mut self, index: usize)

Trait Implementations§

Source§

impl Add<BFieldElement> for XFieldElement

Source§

type Output = XFieldElement

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl Add<XFieldElement> for BFieldElement

The bfe + xfe -> xfe instance belongs to BFieldElement.

Source§

type Output = XFieldElement

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl Add for XFieldElement

Source§

type Output = XFieldElement

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl AddAssign<BFieldElement> for XFieldElement

Source§

fn add_assign(&mut self, rhs: BFieldElement)

Performs the += operation. Read more
Source§

impl AddAssign for XFieldElement

Source§

fn add_assign(&mut self, rhs: Self)

Performs the += operation. Read more
Source§

impl<'arbitrary> Arbitrary<'arbitrary> for XFieldElement

Source§

fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>

Generate an arbitrary value of Self from the given unstructured data. Read more
Source§

fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>

Generate an arbitrary value of Self from the entirety of the given unstructured data. Read more
Source§

fn size_hint(depth: usize) -> (usize, Option<usize>)

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more
Source§

impl BFieldCodec for XFieldElement

Source§

type Error = XFieldElementBFieldDecodingError

Source§

fn decode(sequence: &[BFieldElement]) -> Result<Box<Self>, Self::Error>

Source§

fn encode(&self) -> Vec<BFieldElement>

Source§

fn static_length() -> Option<usize>

Returns the length in number of BFieldElements if it is known at compile-time. Otherwise, None.
Source§

impl Clone for XFieldElement

Source§

fn clone(&self) -> XFieldElement

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 ConstOne for XFieldElement

Source§

const ONE: Self = _

The multiplicative identity element of Self, 1.
Source§

impl ConstZero for XFieldElement

Source§

const ZERO: Self = _

The additive identity element of Self, 0.
Source§

impl CyclicGroupGenerator for XFieldElement

Source§

impl Debug for XFieldElement

Source§

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

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

impl<'de> Deserialize<'de> for XFieldElement

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 Display for XFieldElement

Source§

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

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

impl Distribution<XFieldElement> for Standard

Source§

fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> XFieldElement

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 Div for XFieldElement

Source§

type Output = XFieldElement

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl FiniteField for XFieldElement

Source§

fn batch_inversion(input: Vec<Self>) -> Vec<Self>

Montgomery Batch Inversion
Source§

fn square(self) -> Self

Source§

impl<T> From<[T; 3]> for XFieldElement
where T: Into<BFieldElement>,

Source§

fn from(value: [T; 3]) -> Self

Converts to this type from the input type.
Source§

impl From<Polynomial<'_, BFieldElement>> for XFieldElement

Source§

fn from(poly: Polynomial<'_, BFieldElement>) -> Self

Converts to this type from the input type.
Source§

impl<T> From<T> for XFieldElement
where T: Into<BFieldElement>,

Source§

fn from(value: T) -> Self

Converts to this type from the input type.
Source§

impl From<XFieldElement> for Digest

Source§

fn from(xfe: XFieldElement) -> Self

Interpret the XFieldElement as a Digest. No hashing is performed. This interpretation can be useful for the AlgebraicHasher trait and, by extension, allows building MerkleTrees directly from XFieldElements.

Source§

impl From<XFieldElement> for Polynomial<'static, BFieldElement>

Source§

fn from(xfe: XFieldElement) -> Self

Converts to this type from the input type.
Source§

impl Hash for XFieldElement

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 Inverse for XFieldElement

Source§

fn inverse(&self) -> Self

Source§

fn inverse_or_zero(&self) -> Self

Source§

impl ModPowU32 for XFieldElement

Source§

fn mod_pow_u32(&self, exp: u32) -> Self

Source§

impl ModPowU64 for XFieldElement

Source§

fn mod_pow_u64(&self, exponent: u64) -> Self

Source§

impl Mul<BFieldElement> for XFieldElement

XField * BField means scalar multiplication of the BFieldElement onto each coefficient of the XField.

Source§

type Output = XFieldElement

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl<FF, FF2> Mul<Polynomial<'_, FF>> for XFieldElement
where FF: FiniteField + Mul<XFieldElement, Output = FF2>, FF2: 'static + FiniteField,

Source§

type Output = Polynomial<'static, FF2>

The resulting type after applying the * operator.
Source§

fn mul(self, other: Polynomial<'_, FF>) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<XFieldElement> for BFieldElement

Source§

type Output = XFieldElement

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl Mul for XFieldElement

Source§

type Output = XFieldElement

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl MulAssign<BFieldElement> for XFieldElement

Source§

fn mul_assign(&mut self, rhs: BFieldElement)

Performs the *= operation. Read more
Source§

impl MulAssign for XFieldElement

Source§

fn mul_assign(&mut self, rhs: Self)

Performs the *= operation. Read more
Source§

impl Neg for XFieldElement

Source§

type Output = XFieldElement

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self

Performs the unary - operation. Read more
Source§

impl One for XFieldElement

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 PartialEq for XFieldElement

Source§

fn eq(&self, other: &XFieldElement) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PrimitiveRootOfUnity for XFieldElement

Source§

impl Serialize for XFieldElement

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 Sub<BFieldElement> for XFieldElement

Source§

type Output = XFieldElement

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl Sub<XFieldElement> for BFieldElement

Source§

type Output = XFieldElement

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl Sub for XFieldElement

Source§

type Output = XFieldElement

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl SubAssign<BFieldElement> for XFieldElement

Source§

fn sub_assign(&mut self, rhs: BFieldElement)

Performs the -= operation. Read more
Source§

impl SubAssign for XFieldElement

Source§

fn sub_assign(&mut self, rhs: Self)

Performs the -= operation. Read more
Source§

impl Sum for XFieldElement

Source§

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

Takes an iterator and generates Self from the elements by “summing up” the items.
Source§

impl TryFrom<&[BFieldElement]> for XFieldElement

Source§

type Error = TryFromXFieldElementError

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

fn try_from(value: &[BFieldElement]) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Digest> for XFieldElement

Source§

type Error = TryFromXFieldElementError

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

fn try_from(digest: Digest) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Vec<BFieldElement>> for XFieldElement

Source§

type Error = TryFromXFieldElementError

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

fn try_from(value: Vec<BFieldElement>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl Zero for XFieldElement

Source§

fn zero() -> Self

Returns the additive identity element of Self, 0. Read more
Source§

fn is_zero(&self) -> bool

Returns true if self is equal to the additive identity.
Source§

fn set_zero(&mut self)

Sets self to the additive identity element of Self, 0.
Source§

impl Copy for XFieldElement

Source§

impl Eq for XFieldElement

Source§

impl StructuralPartialEq for XFieldElement

Auto Trait Implementations§

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
Source§

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

Source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
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.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize = _

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

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

Initializes a with the given initializer. Read more
Source§

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

Dereferences the given pointer. Read more
Source§

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

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

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

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

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

Source§

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

Source§

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

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