Struct miden_core::QuadExtension
source · pub struct QuadExtension<B>(_, _)
where
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> QuadExtension<B>where
B: ExtensibleField<2>,
impl<B> QuadExtension<B>where
B: ExtensibleField<2>,
sourcepub fn new(a: B, b: B) -> QuadExtension<B>
pub fn new(a: B, b: B) -> QuadExtension<B>
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> Add<QuadExtension<B>> for QuadExtension<B>where
B: ExtensibleField<2>,
impl<B> Add<QuadExtension<B>> for QuadExtension<B>where
B: ExtensibleField<2>,
type Output = QuadExtension<B>
type Output = QuadExtension<B>
The resulting type after applying the
+ operator.sourcefn add(self, rhs: QuadExtension<B>) -> QuadExtension<B>
fn add(self, rhs: QuadExtension<B>) -> QuadExtension<B>
Performs the
+ operation. Read moresourceimpl<B> AddAssign<QuadExtension<B>> for QuadExtension<B>where
B: ExtensibleField<2>,
impl<B> AddAssign<QuadExtension<B>> for QuadExtension<B>where
B: ExtensibleField<2>,
sourcefn add_assign(&mut self, rhs: QuadExtension<B>)
fn add_assign(&mut self, rhs: QuadExtension<B>)
Performs the
+= operation. Read moresourceimpl<B> AsBytes for QuadExtension<B>where
B: ExtensibleField<2>,
impl<B> AsBytes for QuadExtension<B>where
B: ExtensibleField<2>,
sourceimpl<B> Clone for QuadExtension<B>where
B: Clone + ExtensibleField<2>,
impl<B> Clone for QuadExtension<B>where
B: Clone + ExtensibleField<2>,
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 moresourceimpl<B> Debug for QuadExtension<B>where
B: Debug + ExtensibleField<2>,
impl<B> Debug for QuadExtension<B>where
B: Debug + ExtensibleField<2>,
sourceimpl<B> Default for QuadExtension<B>where
B: Default + ExtensibleField<2>,
impl<B> Default for QuadExtension<B>where
B: Default + ExtensibleField<2>,
sourcefn default() -> QuadExtension<B>
fn default() -> QuadExtension<B>
Returns the “default value” for a type. Read more
sourceimpl<B> Deserializable for QuadExtension<B>where
B: ExtensibleField<2>,
impl<B> Deserializable for QuadExtension<B>where
B: ExtensibleField<2>,
sourcefn read_from<R>(
source: &mut R
) -> Result<QuadExtension<B>, DeserializationError>where
R: ByteReader,
fn read_from<R>(
source: &mut R
) -> Result<QuadExtension<B>, DeserializationError>where
R: ByteReader,
Reads a sequence of bytes from the provided
source, attempts to deserialize these bytes
into Self, and returns the result. Read moresourcefn 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 moresourceimpl<B> Display for QuadExtension<B>where
B: ExtensibleField<2>,
impl<B> Display for QuadExtension<B>where
B: ExtensibleField<2>,
sourceimpl<B> Div<QuadExtension<B>> for QuadExtension<B>where
B: ExtensibleField<2>,
impl<B> Div<QuadExtension<B>> for QuadExtension<B>where
B: ExtensibleField<2>,
type Output = QuadExtension<B>
type Output = QuadExtension<B>
The resulting type after applying the
/ operator.sourcefn div(self, rhs: QuadExtension<B>) -> QuadExtension<B>
fn div(self, rhs: QuadExtension<B>) -> QuadExtension<B>
Performs the
/ operation. Read moresourceimpl<B> DivAssign<QuadExtension<B>> for QuadExtension<B>where
B: ExtensibleField<2>,
impl<B> DivAssign<QuadExtension<B>> for QuadExtension<B>where
B: ExtensibleField<2>,
sourcefn div_assign(&mut self, rhs: QuadExtension<B>)
fn div_assign(&mut self, rhs: QuadExtension<B>)
Performs the
/= operation. Read moresourceimpl<B> ExtensionOf<B> for QuadExtension<B>where
B: ExtensibleField<2>,
impl<B> ExtensionOf<B> for QuadExtension<B>where
B: ExtensibleField<2>,
fn mul_base(self, other: B) -> QuadExtension<B>
sourceimpl<B> FieldElement for QuadExtension<B>where
B: ExtensibleField<2>,
impl<B> FieldElement for QuadExtension<B>where
B: ExtensibleField<2>,
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 moretype BaseField = B
type BaseField = B
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.
sourceconst ZERO: QuadExtension<B> = Self(B::ZERO, B::ZERO)
const ZERO: QuadExtension<B> = Self(B::ZERO, B::ZERO)
The additive identity.
sourceconst ONE: QuadExtension<B> = Self(B::ONE, B::ZERO)
const ONE: QuadExtension<B> = Self(B::ONE, B::ZERO)
The multiplicative identity.
sourcefn double(self) -> QuadExtension<B>
fn double(self) -> QuadExtension<B>
Returns this field element added to itself.
sourcefn inv(self) -> QuadExtension<B>
fn inv(self) -> QuadExtension<B>
Returns a multiplicative inverse of this field element. If this element is ZERO, ZERO is
returned. Read more
sourcefn conjugate(&self) -> QuadExtension<B>
fn conjugate(&self) -> QuadExtension<B>
Returns a conjugate of this field element.
sourcefn elements_as_bytes(elements: &[QuadExtension<B>]) -> &[u8] ⓘ
fn elements_as_bytes(elements: &[QuadExtension<B>]) -> &[u8] ⓘ
Converts a list of elements into a list of bytes. Read more
sourceunsafe fn bytes_as_elements(
bytes: &[u8]
) -> Result<&[QuadExtension<B>], DeserializationError>
unsafe fn bytes_as_elements(
bytes: &[u8]
) -> Result<&[QuadExtension<B>], DeserializationError>
Converts a list of bytes into a list of field elements. Read more
sourcefn zeroed_vector(n: usize) -> Vec<QuadExtension<B>, Global> ⓘ
fn zeroed_vector(n: usize) -> Vec<QuadExtension<B>, Global> ⓘ
Returns a vector of length
n initialized with all ZERO elements. Read moresourcefn as_base_elements(
elements: &[QuadExtension<B>]
) -> &[<QuadExtension<B> as FieldElement>::BaseField]
fn as_base_elements(
elements: &[QuadExtension<B>]
) -> &[<QuadExtension<B> as FieldElement>::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> From<B> for QuadExtension<B>where
B: ExtensibleField<2>,
impl<B> From<B> for QuadExtension<B>where
B: ExtensibleField<2>,
sourcefn from(value: B) -> QuadExtension<B>
fn from(value: B) -> QuadExtension<B>
Converts to this type from the input type.
sourceimpl<B> From<u128> for QuadExtension<B>where
B: ExtensibleField<2>,
impl<B> From<u128> for QuadExtension<B>where
B: ExtensibleField<2>,
sourcefn from(value: u128) -> QuadExtension<B>
fn from(value: u128) -> QuadExtension<B>
Converts to this type from the input type.
sourceimpl<B> From<u16> for QuadExtension<B>where
B: ExtensibleField<2>,
impl<B> From<u16> for QuadExtension<B>where
B: ExtensibleField<2>,
sourcefn from(value: u16) -> QuadExtension<B>
fn from(value: u16) -> QuadExtension<B>
Converts to this type from the input type.
sourceimpl<B> From<u32> for QuadExtension<B>where
B: ExtensibleField<2>,
impl<B> From<u32> for QuadExtension<B>where
B: ExtensibleField<2>,
sourcefn from(value: u32) -> QuadExtension<B>
fn from(value: u32) -> QuadExtension<B>
Converts to this type from the input type.
sourceimpl<B> From<u64> for QuadExtension<B>where
B: ExtensibleField<2>,
impl<B> From<u64> for QuadExtension<B>where
B: ExtensibleField<2>,
sourcefn from(value: u64) -> QuadExtension<B>
fn from(value: u64) -> QuadExtension<B>
Converts to this type from the input type.
sourceimpl<B> From<u8> for QuadExtension<B>where
B: ExtensibleField<2>,
impl<B> From<u8> for QuadExtension<B>where
B: ExtensibleField<2>,
sourcefn from(value: u8) -> QuadExtension<B>
fn from(value: u8) -> QuadExtension<B>
Converts to this type from the input type.
sourceimpl<B> Mul<QuadExtension<B>> for QuadExtension<B>where
B: ExtensibleField<2>,
impl<B> Mul<QuadExtension<B>> for QuadExtension<B>where
B: ExtensibleField<2>,
type Output = QuadExtension<B>
type Output = QuadExtension<B>
The resulting type after applying the
* operator.sourcefn mul(self, rhs: QuadExtension<B>) -> QuadExtension<B>
fn mul(self, rhs: QuadExtension<B>) -> QuadExtension<B>
Performs the
* operation. Read moresourceimpl<B> MulAssign<QuadExtension<B>> for QuadExtension<B>where
B: ExtensibleField<2>,
impl<B> MulAssign<QuadExtension<B>> for QuadExtension<B>where
B: ExtensibleField<2>,
sourcefn mul_assign(&mut self, rhs: QuadExtension<B>)
fn mul_assign(&mut self, rhs: QuadExtension<B>)
Performs the
*= operation. Read moresourceimpl<B> Neg for QuadExtension<B>where
B: ExtensibleField<2>,
impl<B> Neg for QuadExtension<B>where
B: ExtensibleField<2>,
type Output = QuadExtension<B>
type Output = QuadExtension<B>
The resulting type after applying the
- operator.sourcefn neg(self) -> QuadExtension<B>
fn neg(self) -> QuadExtension<B>
Performs the unary
- operation. Read moresourceimpl<B> PartialEq<QuadExtension<B>> for QuadExtension<B>where
B: PartialEq<B> + ExtensibleField<2>,
impl<B> PartialEq<QuadExtension<B>> for QuadExtension<B>where
B: PartialEq<B> + ExtensibleField<2>,
sourcefn eq(&self, other: &QuadExtension<B>) -> bool
fn eq(&self, other: &QuadExtension<B>) -> bool
sourceimpl<B> Randomizable for QuadExtension<B>where
B: ExtensibleField<2>,
impl<B> Randomizable for QuadExtension<B>where
B: ExtensibleField<2>,
sourceconst VALUE_SIZE: usize = Self::ELEMENT_BYTES
const VALUE_SIZE: usize = Self::ELEMENT_BYTES
Size of
Self in bytes. Read moresourcefn from_random_bytes(bytes: &[u8]) -> Option<QuadExtension<B>>
fn from_random_bytes(bytes: &[u8]) -> Option<QuadExtension<B>>
Returns
Self if the set of bytes forms a valid value, otherwise returns None.sourceimpl<B> Serializable for QuadExtension<B>where
B: ExtensibleField<2>,
impl<B> Serializable for QuadExtension<B>where
B: ExtensibleField<2>,
sourcefn write_into<W>(&self, target: &mut W)where
W: ByteWriter,
fn write_into<W>(&self, target: &mut W)where
W: ByteWriter,
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,
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> Sub<QuadExtension<B>> for QuadExtension<B>where
B: ExtensibleField<2>,
impl<B> Sub<QuadExtension<B>> for QuadExtension<B>where
B: ExtensibleField<2>,
type Output = QuadExtension<B>
type Output = QuadExtension<B>
The resulting type after applying the
- operator.sourcefn sub(self, rhs: QuadExtension<B>) -> QuadExtension<B>
fn sub(self, rhs: QuadExtension<B>) -> QuadExtension<B>
Performs the
- operation. Read moresourceimpl<B> SubAssign<QuadExtension<B>> for QuadExtension<B>where
B: ExtensibleField<2>,
impl<B> SubAssign<QuadExtension<B>> for QuadExtension<B>where
B: ExtensibleField<2>,
sourcefn sub_assign(&mut self, rhs: QuadExtension<B>)
fn sub_assign(&mut self, rhs: QuadExtension<B>)
Performs the
-= operation. Read moresourceimpl<'a, B> TryFrom<&'a [u8]> for QuadExtension<B>where
B: ExtensibleField<2>,
impl<'a, B> TryFrom<&'a [u8]> for QuadExtension<B>where
B: ExtensibleField<2>,
sourcefn try_from(
bytes: &[u8]
) -> Result<QuadExtension<B>, <QuadExtension<B> as TryFrom<&'a [u8]>>::Error>
fn try_from(
bytes: &[u8]
) -> Result<QuadExtension<B>, <QuadExtension<B> as TryFrom<&'a [u8]>>::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 for QuadExtension<B>where
B: Copy + ExtensibleField<2>,
impl<B> Eq for QuadExtension<B>where
B: Eq + ExtensibleField<2>,
impl<B> StructuralEq for QuadExtension<B>where
B: ExtensibleField<2>,
impl<B> StructuralPartialEq for QuadExtension<B>where
B: ExtensibleField<2>,
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 Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
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