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§
source§impl<B: ExtensibleField<2>> QuadExtension<B>
impl<B: ExtensibleField<2>> QuadExtension<B>
sourcepub const fn new(a: B, b: B) -> Self
pub const 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.
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: ExtensibleField<2>> Add<QuadExtension<B>> for QuadExtension<B>
impl<B: ExtensibleField<2>> Add<QuadExtension<B>> for QuadExtension<B>
source§impl<B: ExtensibleField<2>> AddAssign<QuadExtension<B>> for QuadExtension<B>
impl<B: ExtensibleField<2>> AddAssign<QuadExtension<B>> for QuadExtension<B>
source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
+=
operation. Read moresource§impl<B: ExtensibleField<2>> AsBytes for QuadExtension<B>
impl<B: ExtensibleField<2>> AsBytes for QuadExtension<B>
source§impl<B: Clone + ExtensibleField<2>> Clone for QuadExtension<B>
impl<B: Clone + ExtensibleField<2>> Clone for QuadExtension<B>
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 + ExtensibleField<2>> Debug for QuadExtension<B>
impl<B: Debug + ExtensibleField<2>> Debug for QuadExtension<B>
source§impl<B: Default + ExtensibleField<2>> Default for QuadExtension<B>
impl<B: Default + ExtensibleField<2>> Default for QuadExtension<B>
source§fn default() -> QuadExtension<B>
fn default() -> QuadExtension<B>
source§impl<B: ExtensibleField<2>> Deserializable for QuadExtension<B>
impl<B: ExtensibleField<2>> Deserializable for QuadExtension<B>
source§fn read_from<R: ByteReader>(
source: &mut R
) -> Result<Self, DeserializationError>
fn read_from<R: ByteReader>( source: &mut R ) -> Result<Self, DeserializationError>
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, Global>, DeserializationError>where
R: ByteReader,
fn read_batch_from<R>( source: &mut R, num_elements: usize ) -> Result<Vec<Self, Global>, 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: ExtensibleField<2>> Display for QuadExtension<B>
impl<B: ExtensibleField<2>> Display for QuadExtension<B>
source§impl<B: ExtensibleField<2>> Div<QuadExtension<B>> for QuadExtension<B>
impl<B: ExtensibleField<2>> Div<QuadExtension<B>> for QuadExtension<B>
source§impl<B: ExtensibleField<2>> DivAssign<QuadExtension<B>> for QuadExtension<B>
impl<B: ExtensibleField<2>> DivAssign<QuadExtension<B>> for QuadExtension<B>
source§fn div_assign(&mut self, rhs: Self)
fn div_assign(&mut self, rhs: Self)
/=
operation. Read moresource§impl<B: ExtensibleField<2>> ExtensionOf<B> for QuadExtension<B>
impl<B: ExtensibleField<2>> ExtensionOf<B> for QuadExtension<B>
source§impl<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
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§fn inv(self) -> Self
fn inv(self) -> Self
source§fn base_element(&self, i: usize) -> Self::BaseField
fn base_element(&self, i: usize) -> Self::BaseField
i
. Read moresource§fn slice_as_base_elements(elements: &[Self]) -> &[Self::BaseField]
fn slice_as_base_elements(elements: &[Self]) -> &[Self::BaseField]
source§fn slice_from_base_elements(elements: &[Self::BaseField]) -> &[Self]
fn slice_from_base_elements(elements: &[Self::BaseField]) -> &[Self]
source§fn elements_as_bytes(elements: &[Self]) -> &[u8] ⓘ
fn elements_as_bytes(elements: &[Self]) -> &[u8] ⓘ
source§unsafe fn bytes_as_elements(
bytes: &[u8]
) -> Result<&[Self], DeserializationError>
unsafe fn bytes_as_elements( bytes: &[u8] ) -> Result<&[Self], DeserializationError>
source§fn zeroed_vector(n: usize) -> Vec<Self>
fn zeroed_vector(n: usize) -> Vec<Self>
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: ExtensibleField<2>> From<B> for QuadExtension<B>
impl<B: ExtensibleField<2>> From<B> for QuadExtension<B>
source§impl<B: ExtensibleField<2>> From<u128> for QuadExtension<B>
impl<B: ExtensibleField<2>> From<u128> for QuadExtension<B>
source§impl<B: ExtensibleField<2>> From<u16> for QuadExtension<B>
impl<B: ExtensibleField<2>> From<u16> for QuadExtension<B>
source§impl<B: ExtensibleField<2>> From<u32> for QuadExtension<B>
impl<B: ExtensibleField<2>> From<u32> for QuadExtension<B>
source§impl<B: ExtensibleField<2>> From<u64> for QuadExtension<B>
impl<B: ExtensibleField<2>> From<u64> for QuadExtension<B>
source§impl<B: ExtensibleField<2>> From<u8> for QuadExtension<B>
impl<B: ExtensibleField<2>> From<u8> for QuadExtension<B>
source§impl<B: ExtensibleField<2>> Mul<QuadExtension<B>> for QuadExtension<B>
impl<B: ExtensibleField<2>> Mul<QuadExtension<B>> for QuadExtension<B>
source§impl<B: ExtensibleField<2>> MulAssign<QuadExtension<B>> for QuadExtension<B>
impl<B: ExtensibleField<2>> MulAssign<QuadExtension<B>> for QuadExtension<B>
source§fn mul_assign(&mut self, rhs: Self)
fn mul_assign(&mut self, rhs: Self)
*=
operation. Read moresource§impl<B: ExtensibleField<2>> Neg for QuadExtension<B>
impl<B: ExtensibleField<2>> Neg for QuadExtension<B>
source§impl<B: PartialEq + ExtensibleField<2>> PartialEq<QuadExtension<B>> for QuadExtension<B>
impl<B: PartialEq + ExtensibleField<2>> PartialEq<QuadExtension<B>> for QuadExtension<B>
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: ExtensibleField<2>> Randomizable for QuadExtension<B>
impl<B: ExtensibleField<2>> Randomizable for QuadExtension<B>
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<Self>
fn from_random_bytes(bytes: &[u8]) -> Option<Self>
Self
if the set of bytes forms a valid value, otherwise returns None.source§impl<B: ExtensibleField<2>> Serializable for QuadExtension<B>
impl<B: ExtensibleField<2>> Serializable for QuadExtension<B>
source§fn write_into<W: ByteWriter>(&self, target: &mut W)
fn write_into<W: ByteWriter>(&self, target: &mut W)
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: ExtensibleField<2>> Sub<QuadExtension<B>> for QuadExtension<B>
impl<B: ExtensibleField<2>> Sub<QuadExtension<B>> for QuadExtension<B>
source§impl<B: ExtensibleField<2>> SubAssign<QuadExtension<B>> for QuadExtension<B>
impl<B: ExtensibleField<2>> SubAssign<QuadExtension<B>> for QuadExtension<B>
source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
-=
operation. Read moresource§impl<'a, B: ExtensibleField<2>> TryFrom<&'a [u8]> for QuadExtension<B>
impl<'a, B: ExtensibleField<2>> TryFrom<&'a [u8]> for QuadExtension<B>
source§fn 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.