Struct winter_math::fields::QuadExtension
source · [−]#[repr(C)]pub struct QuadExtension<B: ExtensibleField<2>>(_, _);Expand description
Represents an element in a quadratic extension of a StarkField.
The extension element is defined as α + β * φ, where φ is a root of in irreducible polynomial defined by the implementation of the ExtensibleField trait, and α and β are base field elements.
Implementations
sourceimpl<B: ExtensibleField<2>> QuadExtension<B>
impl<B: ExtensibleField<2>> QuadExtension<B>
sourcepub fn new(a: B, b: B) -> Self
pub fn new(a: B, b: B) -> Self
Returns a new extension element instantiated from the provided base elements.
sourcepub fn is_supported() -> bool
pub fn is_supported() -> bool
Returns true if the base field specified by B type parameter supports quadratic extensions.
Trait Implementations
sourceimpl<B: ExtensibleField<2>> Add<QuadExtension<B>> for QuadExtension<B>
impl<B: ExtensibleField<2>> Add<QuadExtension<B>> for QuadExtension<B>
type Output = QuadExtension<B>
type Output = QuadExtension<B>
The resulting type after applying the + operator.
sourceimpl<B: ExtensibleField<2>> AddAssign<QuadExtension<B>> for QuadExtension<B>
impl<B: ExtensibleField<2>> AddAssign<QuadExtension<B>> for QuadExtension<B>
sourcefn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
Performs the += operation. Read more
sourceimpl<B: ExtensibleField<2>> AsBytes for QuadExtension<B>
impl<B: ExtensibleField<2>> AsBytes for QuadExtension<B>
sourceimpl<B: Clone + ExtensibleField<2>> Clone for QuadExtension<B>
impl<B: Clone + ExtensibleField<2>> Clone for QuadExtension<B>
sourcefn clone(&self) -> QuadExtension<B>
fn clone(&self) -> QuadExtension<B>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl<B: Debug + ExtensibleField<2>> Debug for QuadExtension<B>
impl<B: Debug + ExtensibleField<2>> Debug for QuadExtension<B>
sourceimpl<B: Default + ExtensibleField<2>> Default for QuadExtension<B>
impl<B: Default + ExtensibleField<2>> Default for QuadExtension<B>
sourcefn default() -> QuadExtension<B>
fn default() -> QuadExtension<B>
Returns the “default value” for a type. Read more
sourceimpl<B: ExtensibleField<2>> Deserializable for QuadExtension<B>
impl<B: ExtensibleField<2>> Deserializable for QuadExtension<B>
sourcefn read_from<R: ByteReader>(
source: &mut R
) -> Result<Self, DeserializationError>
fn read_from<R: ByteReader>(
source: &mut R
) -> Result<Self, DeserializationError>
Reads a sequence of bytes from the provided source, attempts to deserialize these bytes
into Self, and returns the result. Read more
sourcefn read_batch_from<R>(
source: &mut R,
num_elements: usize
) -> Result<Vec<Self, Global>, DeserializationError> where
R: ByteReader,
fn read_batch_from<R>(
source: &mut R,
num_elements: usize
) -> Result<Vec<Self, Global>, DeserializationError> where
R: ByteReader,
Reads a sequence of bytes from the provided source, attempts to deserialize these bytes
into a vector with the specified number of Self elements, and returns the result. Read more
sourceimpl<B: ExtensibleField<2>> Display for QuadExtension<B>
impl<B: ExtensibleField<2>> Display for QuadExtension<B>
sourceimpl<B: ExtensibleField<2>> Div<QuadExtension<B>> for QuadExtension<B>
impl<B: ExtensibleField<2>> Div<QuadExtension<B>> for QuadExtension<B>
type Output = QuadExtension<B>
type Output = QuadExtension<B>
The resulting type after applying the / operator.
sourceimpl<B: ExtensibleField<2>> DivAssign<QuadExtension<B>> for QuadExtension<B>
impl<B: ExtensibleField<2>> DivAssign<QuadExtension<B>> for QuadExtension<B>
sourcefn div_assign(&mut self, rhs: Self)
fn div_assign(&mut self, rhs: Self)
Performs the /= operation. Read more
sourceimpl<B: ExtensibleField<2>> ExtensionOf<B> for QuadExtension<B>
impl<B: ExtensibleField<2>> ExtensionOf<B> for QuadExtension<B>
sourceimpl<B: ExtensibleField<2>> FieldElement for QuadExtension<B>
impl<B: ExtensibleField<2>> FieldElement for QuadExtension<B>
type PositiveInteger = <B as FieldElement>::PositiveInteger
type PositiveInteger = <B as FieldElement>::PositiveInteger
A type defining positive integers big enough to describe a field modulus for
Self::BaseField with no loss of precision. Read more
type BaseField = B
type BaseField = B
Base field type for this finite field. For prime fields, BaseField should be set
to Self. Read more
sourceconst ELEMENT_BYTES: usize = B::ELEMENT_BYTES * 2
const ELEMENT_BYTES: usize = B::ELEMENT_BYTES * 2
Number of bytes needed to encode an element
sourceconst IS_CANONICAL: bool = B::IS_CANONICAL
const IS_CANONICAL: bool = B::IS_CANONICAL
True if internal representation of the element is the same as its canonical representation.
sourcefn inv(self) -> Self
fn inv(self) -> Self
Returns a multiplicative inverse of this field element. If this element is ZERO, ZERO is returned. Read more
sourcefn elements_as_bytes(elements: &[Self]) -> &[u8]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
fn elements_as_bytes(elements: &[Self]) -> &[u8]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
Converts a list of elements into a list of bytes. Read more
sourceunsafe fn bytes_as_elements(
bytes: &[u8]
) -> Result<&[Self], DeserializationError>
unsafe fn bytes_as_elements(
bytes: &[u8]
) -> Result<&[Self], DeserializationError>
Converts a list of bytes into a list of field elements. Read more
sourcefn zeroed_vector(n: usize) -> Vec<Self>
fn zeroed_vector(n: usize) -> Vec<Self>
Returns a vector of length n initialized with all ZERO elements. Read more
sourcefn as_base_elements(elements: &[Self]) -> &[Self::BaseField]
fn as_base_elements(elements: &[Self]) -> &[Self::BaseField]
Converts a list of field elements into a list of elements in the underlying base field. Read more
sourcefn exp(self, power: Self::PositiveInteger) -> Self
fn exp(self, power: Self::PositiveInteger) -> Self
Exponentiates this field element by power parameter.
sourceimpl<B: ExtensibleField<2>> From<B> for QuadExtension<B>
impl<B: ExtensibleField<2>> From<B> for QuadExtension<B>
sourceimpl<B: ExtensibleField<2>> From<u128> for QuadExtension<B>
impl<B: ExtensibleField<2>> From<u128> for QuadExtension<B>
sourceimpl<B: ExtensibleField<2>> From<u16> for QuadExtension<B>
impl<B: ExtensibleField<2>> From<u16> for QuadExtension<B>
sourceimpl<B: ExtensibleField<2>> From<u32> for QuadExtension<B>
impl<B: ExtensibleField<2>> From<u32> for QuadExtension<B>
sourceimpl<B: ExtensibleField<2>> From<u64> for QuadExtension<B>
impl<B: ExtensibleField<2>> From<u64> for QuadExtension<B>
sourceimpl<B: ExtensibleField<2>> From<u8> for QuadExtension<B>
impl<B: ExtensibleField<2>> From<u8> for QuadExtension<B>
sourceimpl<B: ExtensibleField<2>> Mul<QuadExtension<B>> for QuadExtension<B>
impl<B: ExtensibleField<2>> Mul<QuadExtension<B>> for QuadExtension<B>
type Output = QuadExtension<B>
type Output = QuadExtension<B>
The resulting type after applying the * operator.
sourceimpl<B: ExtensibleField<2>> MulAssign<QuadExtension<B>> for QuadExtension<B>
impl<B: ExtensibleField<2>> MulAssign<QuadExtension<B>> for QuadExtension<B>
sourcefn mul_assign(&mut self, rhs: Self)
fn mul_assign(&mut self, rhs: Self)
Performs the *= operation. Read more
sourceimpl<B: ExtensibleField<2>> Neg for QuadExtension<B>
impl<B: ExtensibleField<2>> Neg for QuadExtension<B>
type Output = QuadExtension<B>
type Output = QuadExtension<B>
The resulting type after applying the - operator.
sourceimpl<B: PartialEq + ExtensibleField<2>> PartialEq<QuadExtension<B>> for QuadExtension<B>
impl<B: PartialEq + ExtensibleField<2>> PartialEq<QuadExtension<B>> for QuadExtension<B>
sourcefn eq(&self, other: &QuadExtension<B>) -> bool
fn eq(&self, other: &QuadExtension<B>) -> bool
This method tests for self and other values to be equal, and is used
by ==. Read more
sourcefn ne(&self, other: &QuadExtension<B>) -> bool
fn ne(&self, other: &QuadExtension<B>) -> bool
This method tests for !=.
sourceimpl<B: ExtensibleField<2>> Randomizable for QuadExtension<B>
impl<B: ExtensibleField<2>> Randomizable for QuadExtension<B>
sourceconst VALUE_SIZE: usize = Self::ELEMENT_BYTES
const VALUE_SIZE: usize = Self::ELEMENT_BYTES
Size of Self in bytes. Read more
sourceimpl<B: ExtensibleField<2>> Serializable for QuadExtension<B>
impl<B: ExtensibleField<2>> Serializable for QuadExtension<B>
sourcefn write_into<W: ByteWriter>(&self, target: &mut W)
fn write_into<W: ByteWriter>(&self, target: &mut W)
Serializes self into bytes and writes these bytes into the target.
sourcefn write_batch_into<W>(source: &[Self], target: &mut W) where
W: ByteWriter,
fn write_batch_into<W>(source: &[Self], target: &mut W) where
W: ByteWriter,
Serializes all elements of the source and writes these bytes into the target. Read more
sourcefn get_size_hint(&self) -> usize
fn get_size_hint(&self) -> usize
Returns an estimate of how many bytes are needed to represent self. Read more
sourceimpl<B: ExtensibleField<2>> Sub<QuadExtension<B>> for QuadExtension<B>
impl<B: ExtensibleField<2>> Sub<QuadExtension<B>> for QuadExtension<B>
type Output = QuadExtension<B>
type Output = QuadExtension<B>
The resulting type after applying the - operator.
sourceimpl<B: ExtensibleField<2>> SubAssign<QuadExtension<B>> for QuadExtension<B>
impl<B: ExtensibleField<2>> SubAssign<QuadExtension<B>> for QuadExtension<B>
sourcefn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
Performs the -= operation. Read more
sourceimpl<'a, B: ExtensibleField<2>> TryFrom<&'a [u8]> for QuadExtension<B>
impl<'a, B: ExtensibleField<2>> TryFrom<&'a [u8]> for QuadExtension<B>
sourcefn try_from(bytes: &[u8]) -> Result<Self, Self::Error>
fn try_from(bytes: &[u8]) -> Result<Self, Self::Error>
Converts a slice of bytes into a field element; returns error if the value encoded in bytes is not a valid field element. The bytes are assumed to be in little-endian byte order.
type Error = DeserializationError
type Error = DeserializationError
The type returned in the event of a conversion error.
impl<B: Copy + ExtensibleField<2>> Copy for QuadExtension<B>
impl<B: Eq + ExtensibleField<2>> Eq for QuadExtension<B>
impl<B: ExtensibleField<2>> StructuralEq for QuadExtension<B>
impl<B: ExtensibleField<2>> StructuralPartialEq for QuadExtension<B>
Auto Trait Implementations
impl<B> RefUnwindSafe for QuadExtension<B> where
B: RefUnwindSafe,
impl<B> Send for QuadExtension<B>
impl<B> Sync for QuadExtension<B>
impl<B> Unpin for QuadExtension<B> where
B: Unpin,
impl<B> UnwindSafe for QuadExtension<B> where
B: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more