Struct miden_core::QuadExtension
source · #[repr(C)]pub struct QuadExtension<B>(/* private fields */)
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§
source§impl<B> QuadExtension<B>where
B: ExtensibleField<2>,
impl<B> QuadExtension<B>where B: ExtensibleField<2>,
sourcepub const fn new(a: B, b: B) -> QuadExtension<B>
pub const 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.
sourcepub const fn to_base_elements(self) -> [B; 2]
pub const fn to_base_elements(self) -> [B; 2]
Returns an array of base field elements comprising this extension field element.
The order of abase elements in the returned array is the same as the order in which the elements are provided to the QuadExtension::new() constructor.
Trait Implementations§
source§impl<B> Add for QuadExtension<B>where
B: ExtensibleField<2>,
impl<B> Add for QuadExtension<B>where B: ExtensibleField<2>,
§type Output = QuadExtension<B>
type Output = QuadExtension<B>
+
operator.source§fn add(self, rhs: QuadExtension<B>) -> QuadExtension<B>
fn add(self, rhs: QuadExtension<B>) -> QuadExtension<B>
+
operation. Read moresource§impl<B> AddAssign for QuadExtension<B>where
B: ExtensibleField<2>,
impl<B> AddAssign for QuadExtension<B>where B: ExtensibleField<2>,
source§fn add_assign(&mut self, rhs: QuadExtension<B>)
fn add_assign(&mut self, rhs: QuadExtension<B>)
+=
operation. Read moresource§impl<B> AsBytes for QuadExtension<B>where
B: ExtensibleField<2>,
impl<B> AsBytes for QuadExtension<B>where B: ExtensibleField<2>,
source§impl<B> Clone for QuadExtension<B>where
B: Clone + ExtensibleField<2>,
impl<B> Clone for QuadExtension<B>where B: Clone + ExtensibleField<2>,
source§fn clone(&self) -> QuadExtension<B>
fn clone(&self) -> QuadExtension<B>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<B> Debug for QuadExtension<B>where
B: Debug + ExtensibleField<2>,
impl<B> Debug for QuadExtension<B>where B: Debug + ExtensibleField<2>,
source§impl<B> Default for QuadExtension<B>where
B: Default + ExtensibleField<2>,
impl<B> Default for QuadExtension<B>where B: Default + ExtensibleField<2>,
source§fn default() -> QuadExtension<B>
fn default() -> QuadExtension<B>
source§impl<B> Deserializable for QuadExtension<B>where
B: ExtensibleField<2>,
impl<B> Deserializable for QuadExtension<B>where B: ExtensibleField<2>,
source§fn 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,
source
, attempts to deserialize these bytes
into Self
, and returns the result. Read moresource§fn read_from_bytes(bytes: &[u8]) -> Result<Self, DeserializationError>
fn read_from_bytes(bytes: &[u8]) -> Result<Self, DeserializationError>
source§fn read_batch_from<R>(
source: &mut R,
num_elements: usize
) -> Result<Vec<Self>, DeserializationError>where
R: ByteReader,
fn read_batch_from<R>( source: &mut R, num_elements: usize ) -> Result<Vec<Self>, DeserializationError>where R: ByteReader,
source
, attempts to deserialize these bytes
into a vector with the specified number of Self
elements, and returns the result. Read moresource§impl<B> Display for QuadExtension<B>where
B: ExtensibleField<2>,
impl<B> Display for QuadExtension<B>where B: ExtensibleField<2>,
source§impl<B> Div for QuadExtension<B>where
B: ExtensibleField<2>,
impl<B> Div for QuadExtension<B>where B: ExtensibleField<2>,
§type Output = QuadExtension<B>
type Output = QuadExtension<B>
/
operator.source§fn div(self, rhs: QuadExtension<B>) -> QuadExtension<B>
fn div(self, rhs: QuadExtension<B>) -> QuadExtension<B>
/
operation. Read moresource§impl<B> DivAssign for QuadExtension<B>where
B: ExtensibleField<2>,
impl<B> DivAssign for QuadExtension<B>where B: ExtensibleField<2>,
source§fn div_assign(&mut self, rhs: QuadExtension<B>)
fn div_assign(&mut self, rhs: QuadExtension<B>)
/=
operation. Read moresource§impl<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>
source§impl<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
Self::BaseField
with no loss of precision.§type BaseField = B
type BaseField = B
BaseField
should be set
to Self
.source§const EXTENSION_DEGREE: usize = 2usize
const EXTENSION_DEGREE: usize = 2usize
Self::BaseField
. For prime fields,
extension degree should be set to 1.source§const ELEMENT_BYTES: usize = _
const ELEMENT_BYTES: usize = _
source§const IS_CANONICAL: bool = B::IS_CANONICAL
const IS_CANONICAL: bool = B::IS_CANONICAL
source§const ZERO: QuadExtension<B> = _
const ZERO: QuadExtension<B> = _
source§const ONE: QuadExtension<B> = _
const ONE: QuadExtension<B> = _
source§fn double(self) -> QuadExtension<B>
fn double(self) -> QuadExtension<B>
source§fn square(self) -> QuadExtension<B>
fn square(self) -> QuadExtension<B>
source§fn inv(self) -> QuadExtension<B>
fn inv(self) -> QuadExtension<B>
source§fn conjugate(&self) -> QuadExtension<B>
fn conjugate(&self) -> QuadExtension<B>
source§fn base_element(
&self,
i: usize
) -> <QuadExtension<B> as FieldElement>::BaseField
fn base_element( &self, i: usize ) -> <QuadExtension<B> as FieldElement>::BaseField
i
. Read moresource§fn slice_as_base_elements(
elements: &[QuadExtension<B>]
) -> &[<QuadExtension<B> as FieldElement>::BaseField]
fn slice_as_base_elements( elements: &[QuadExtension<B>] ) -> &[<QuadExtension<B> as FieldElement>::BaseField]
source§fn slice_from_base_elements(
elements: &[<QuadExtension<B> as FieldElement>::BaseField]
) -> &[QuadExtension<B>]
fn slice_from_base_elements( elements: &[<QuadExtension<B> as FieldElement>::BaseField] ) -> &[QuadExtension<B>]
source§fn elements_as_bytes(elements: &[QuadExtension<B>]) -> &[u8] ⓘ
fn elements_as_bytes(elements: &[QuadExtension<B>]) -> &[u8] ⓘ
source§unsafe fn bytes_as_elements(
bytes: &[u8]
) -> Result<&[QuadExtension<B>], DeserializationError>
unsafe fn bytes_as_elements( bytes: &[u8] ) -> Result<&[QuadExtension<B>], DeserializationError>
source§fn zeroed_vector(n: usize) -> Vec<QuadExtension<B>>
fn zeroed_vector(n: usize) -> Vec<QuadExtension<B>>
n
initialized with all ZERO elements. Read moresource§fn exp(self, power: Self::PositiveInteger) -> Self
fn exp(self, power: Self::PositiveInteger) -> Self
power
parameter.source§fn exp_vartime(self, power: Self::PositiveInteger) -> Self
fn exp_vartime(self, power: Self::PositiveInteger) -> Self
power
parameter.
This function is expressly variable time, to speed-up verifier computations.source§impl<B> From<B> for QuadExtension<B>where
B: ExtensibleField<2>,
impl<B> From<B> for QuadExtension<B>where B: ExtensibleField<2>,
source§fn from(value: B) -> QuadExtension<B>
fn from(value: B) -> QuadExtension<B>
source§impl<B> From<u128> for QuadExtension<B>where
B: ExtensibleField<2>,
impl<B> From<u128> for QuadExtension<B>where B: ExtensibleField<2>,
source§fn from(value: u128) -> QuadExtension<B>
fn from(value: u128) -> QuadExtension<B>
source§impl<B> From<u16> for QuadExtension<B>where
B: ExtensibleField<2>,
impl<B> From<u16> for QuadExtension<B>where B: ExtensibleField<2>,
source§fn from(value: u16) -> QuadExtension<B>
fn from(value: u16) -> QuadExtension<B>
source§impl<B> From<u32> for QuadExtension<B>where
B: ExtensibleField<2>,
impl<B> From<u32> for QuadExtension<B>where B: ExtensibleField<2>,
source§fn from(value: u32) -> QuadExtension<B>
fn from(value: u32) -> QuadExtension<B>
source§impl<B> From<u64> for QuadExtension<B>where
B: ExtensibleField<2>,
impl<B> From<u64> for QuadExtension<B>where B: ExtensibleField<2>,
source§fn from(value: u64) -> QuadExtension<B>
fn from(value: u64) -> QuadExtension<B>
source§impl<B> From<u8> for QuadExtension<B>where
B: ExtensibleField<2>,
impl<B> From<u8> for QuadExtension<B>where B: ExtensibleField<2>,
source§fn from(value: u8) -> QuadExtension<B>
fn from(value: u8) -> QuadExtension<B>
source§impl<B> Mul for QuadExtension<B>where
B: ExtensibleField<2>,
impl<B> Mul for QuadExtension<B>where B: ExtensibleField<2>,
§type Output = QuadExtension<B>
type Output = QuadExtension<B>
*
operator.source§fn mul(self, rhs: QuadExtension<B>) -> QuadExtension<B>
fn mul(self, rhs: QuadExtension<B>) -> QuadExtension<B>
*
operation. Read moresource§impl<B> MulAssign for QuadExtension<B>where
B: ExtensibleField<2>,
impl<B> MulAssign for QuadExtension<B>where B: ExtensibleField<2>,
source§fn mul_assign(&mut self, rhs: QuadExtension<B>)
fn mul_assign(&mut self, rhs: QuadExtension<B>)
*=
operation. Read moresource§impl<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>
-
operator.source§fn neg(self) -> QuadExtension<B>
fn neg(self) -> QuadExtension<B>
-
operation. Read moresource§impl<B> PartialEq for QuadExtension<B>where
B: PartialEq + ExtensibleField<2>,
impl<B> PartialEq for QuadExtension<B>where B: PartialEq + ExtensibleField<2>,
source§fn eq(&self, other: &QuadExtension<B>) -> bool
fn eq(&self, other: &QuadExtension<B>) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl<B> Randomizable for QuadExtension<B>where
B: ExtensibleField<2>,
impl<B> Randomizable for QuadExtension<B>where B: ExtensibleField<2>,
source§const VALUE_SIZE: usize = Self::ELEMENT_BYTES
const VALUE_SIZE: usize = Self::ELEMENT_BYTES
Self
in bytes. Read moresource§fn from_random_bytes(bytes: &[u8]) -> Option<QuadExtension<B>>
fn from_random_bytes(bytes: &[u8]) -> Option<QuadExtension<B>>
Self
if the set of bytes forms a valid value, otherwise returns None.source§impl<B> Serializable for QuadExtension<B>where
B: ExtensibleField<2>,
impl<B> Serializable for QuadExtension<B>where B: ExtensibleField<2>,
source§fn write_into<W>(&self, target: &mut W)where
W: ByteWriter,
fn write_into<W>(&self, target: &mut W)where W: ByteWriter,
self
into bytes and writes these bytes into the target
.source§fn 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,
source§fn get_size_hint(&self) -> usize
fn get_size_hint(&self) -> usize
source§impl<B> Sub for QuadExtension<B>where
B: ExtensibleField<2>,
impl<B> Sub for QuadExtension<B>where B: ExtensibleField<2>,
§type Output = QuadExtension<B>
type Output = QuadExtension<B>
-
operator.source§fn sub(self, rhs: QuadExtension<B>) -> QuadExtension<B>
fn sub(self, rhs: QuadExtension<B>) -> QuadExtension<B>
-
operation. Read moresource§impl<B> SubAssign for QuadExtension<B>where
B: ExtensibleField<2>,
impl<B> SubAssign for QuadExtension<B>where B: ExtensibleField<2>,
source§fn sub_assign(&mut self, rhs: QuadExtension<B>)
fn sub_assign(&mut self, rhs: QuadExtension<B>)
-=
operation. Read moresource§impl<'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>,
source§fn 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.