#[repr(C)]pub struct CubeExtension<B>(/* private fields */)
where
B: ExtensibleField<3>;
Expand description
Represents an element in a cubic extension of a StarkField.
The extension element is defined as α + β * φ + γ * φ^2, where φ is a root of in irreducible polynomial defined by the implementation of the ExtensibleField trait, and α, β, γ are base field elements.
Implementations§
source§impl<B> CubeExtension<B>where
B: ExtensibleField<3>,
impl<B> CubeExtension<B>where
B: ExtensibleField<3>,
sourcepub const fn new(a: B, b: B, c: B) -> CubeExtension<B>
pub const fn new(a: B, b: B, c: B) -> CubeExtension<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 cubic extensions.
sourcepub const fn to_base_elements(self) -> [B; 3]
pub const fn to_base_elements(self) -> [B; 3]
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 CubeExtension::new() constructor.
Trait Implementations§
source§impl<B> Add for CubeExtension<B>where
B: ExtensibleField<3>,
impl<B> Add for CubeExtension<B>where
B: ExtensibleField<3>,
source§type Output = CubeExtension<B>
type Output = CubeExtension<B>
+
operator.source§fn add(self, rhs: CubeExtension<B>) -> CubeExtension<B>
fn add(self, rhs: CubeExtension<B>) -> CubeExtension<B>
+
operation. Read moresource§impl<B> AddAssign for CubeExtension<B>where
B: ExtensibleField<3>,
impl<B> AddAssign for CubeExtension<B>where
B: ExtensibleField<3>,
source§fn add_assign(&mut self, rhs: CubeExtension<B>)
fn add_assign(&mut self, rhs: CubeExtension<B>)
+=
operation. Read moresource§impl<B> AsBytes for CubeExtension<B>where
B: ExtensibleField<3>,
impl<B> AsBytes for CubeExtension<B>where
B: ExtensibleField<3>,
source§impl<B> Clone for CubeExtension<B>where
B: Clone + ExtensibleField<3>,
impl<B> Clone for CubeExtension<B>where
B: Clone + ExtensibleField<3>,
source§fn clone(&self) -> CubeExtension<B>
fn clone(&self) -> CubeExtension<B>
1.6.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<B> Debug for CubeExtension<B>where
B: Debug + ExtensibleField<3>,
impl<B> Debug for CubeExtension<B>where
B: Debug + ExtensibleField<3>,
source§impl<B> Default for CubeExtension<B>where
B: Default + ExtensibleField<3>,
impl<B> Default for CubeExtension<B>where
B: Default + ExtensibleField<3>,
source§fn default() -> CubeExtension<B>
fn default() -> CubeExtension<B>
source§impl<B> Deserializable for CubeExtension<B>where
B: ExtensibleField<3>,
impl<B> Deserializable for CubeExtension<B>where
B: ExtensibleField<3>,
source§fn read_from<R>(
source: &mut R,
) -> Result<CubeExtension<B>, DeserializationError>where
R: ByteReader,
fn read_from<R>(
source: &mut R,
) -> Result<CubeExtension<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§impl<B> Display for CubeExtension<B>where
B: ExtensibleField<3>,
impl<B> Display for CubeExtension<B>where
B: ExtensibleField<3>,
source§impl<B> Div for CubeExtension<B>where
B: ExtensibleField<3>,
impl<B> Div for CubeExtension<B>where
B: ExtensibleField<3>,
source§type Output = CubeExtension<B>
type Output = CubeExtension<B>
/
operator.source§fn div(self, rhs: CubeExtension<B>) -> CubeExtension<B>
fn div(self, rhs: CubeExtension<B>) -> CubeExtension<B>
/
operation. Read moresource§impl<B> DivAssign for CubeExtension<B>where
B: ExtensibleField<3>,
impl<B> DivAssign for CubeExtension<B>where
B: ExtensibleField<3>,
source§fn div_assign(&mut self, rhs: CubeExtension<B>)
fn div_assign(&mut self, rhs: CubeExtension<B>)
/=
operation. Read moresource§impl<B> ExtensionOf<B> for CubeExtension<B>where
B: ExtensibleField<3>,
impl<B> ExtensionOf<B> for CubeExtension<B>where
B: ExtensibleField<3>,
fn mul_base(self, other: B) -> CubeExtension<B>
source§impl<B> FieldElement for CubeExtension<B>where
B: ExtensibleField<3>,
impl<B> FieldElement for CubeExtension<B>where
B: ExtensibleField<3>,
source§const EXTENSION_DEGREE: usize = 3usize
const EXTENSION_DEGREE: usize = 3usize
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: CubeExtension<B> = _
const ZERO: CubeExtension<B> = _
source§const ONE: CubeExtension<B> = _
const ONE: CubeExtension<B> = _
source§type PositiveInteger = <B as FieldElement>::PositiveInteger
type PositiveInteger = <B as FieldElement>::PositiveInteger
Self::BaseField
with no loss of precision.source§type BaseField = B
type BaseField = B
BaseField
should be set
to Self
.source§fn double(self) -> CubeExtension<B>
fn double(self) -> CubeExtension<B>
source§fn square(self) -> CubeExtension<B>
fn square(self) -> CubeExtension<B>
source§fn inv(self) -> CubeExtension<B>
fn inv(self) -> CubeExtension<B>
source§fn conjugate(&self) -> CubeExtension<B>
fn conjugate(&self) -> CubeExtension<B>
source§fn base_element(
&self,
i: usize,
) -> <CubeExtension<B> as FieldElement>::BaseField
fn base_element( &self, i: usize, ) -> <CubeExtension<B> as FieldElement>::BaseField
i
. Read moresource§fn slice_as_base_elements(
elements: &[CubeExtension<B>],
) -> &[<CubeExtension<B> as FieldElement>::BaseField]
fn slice_as_base_elements( elements: &[CubeExtension<B>], ) -> &[<CubeExtension<B> as FieldElement>::BaseField]
source§fn slice_from_base_elements(
elements: &[<CubeExtension<B> as FieldElement>::BaseField],
) -> &[CubeExtension<B>]
fn slice_from_base_elements( elements: &[<CubeExtension<B> as FieldElement>::BaseField], ) -> &[CubeExtension<B>]
source§fn elements_as_bytes(elements: &[CubeExtension<B>]) -> &[u8] ⓘ
fn elements_as_bytes(elements: &[CubeExtension<B>]) -> &[u8] ⓘ
source§unsafe fn bytes_as_elements(
bytes: &[u8],
) -> Result<&[CubeExtension<B>], DeserializationError>
unsafe fn bytes_as_elements( bytes: &[u8], ) -> Result<&[CubeExtension<B>], DeserializationError>
source§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 CubeExtension<B>where
B: ExtensibleField<3>,
impl<B> From<B> for CubeExtension<B>where
B: ExtensibleField<3>,
source§fn from(value: B) -> CubeExtension<B>
fn from(value: B) -> CubeExtension<B>
source§impl<B> From<u16> for CubeExtension<B>where
B: ExtensibleField<3>,
impl<B> From<u16> for CubeExtension<B>where
B: ExtensibleField<3>,
source§fn from(value: u16) -> CubeExtension<B>
fn from(value: u16) -> CubeExtension<B>
source§impl<B> From<u32> for CubeExtension<B>where
B: ExtensibleField<3>,
impl<B> From<u32> for CubeExtension<B>where
B: ExtensibleField<3>,
source§fn from(value: u32) -> CubeExtension<B>
fn from(value: u32) -> CubeExtension<B>
source§impl<B> From<u8> for CubeExtension<B>where
B: ExtensibleField<3>,
impl<B> From<u8> for CubeExtension<B>where
B: ExtensibleField<3>,
source§fn from(value: u8) -> CubeExtension<B>
fn from(value: u8) -> CubeExtension<B>
source§impl<B> Mul for CubeExtension<B>where
B: ExtensibleField<3>,
impl<B> Mul for CubeExtension<B>where
B: ExtensibleField<3>,
source§type Output = CubeExtension<B>
type Output = CubeExtension<B>
*
operator.source§fn mul(self, rhs: CubeExtension<B>) -> CubeExtension<B>
fn mul(self, rhs: CubeExtension<B>) -> CubeExtension<B>
*
operation. Read moresource§impl<B> MulAssign for CubeExtension<B>where
B: ExtensibleField<3>,
impl<B> MulAssign for CubeExtension<B>where
B: ExtensibleField<3>,
source§fn mul_assign(&mut self, rhs: CubeExtension<B>)
fn mul_assign(&mut self, rhs: CubeExtension<B>)
*=
operation. Read moresource§impl<B> Neg for CubeExtension<B>where
B: ExtensibleField<3>,
impl<B> Neg for CubeExtension<B>where
B: ExtensibleField<3>,
source§type Output = CubeExtension<B>
type Output = CubeExtension<B>
-
operator.source§fn neg(self) -> CubeExtension<B>
fn neg(self) -> CubeExtension<B>
-
operation. Read moresource§impl<B> PartialEq for CubeExtension<B>where
B: PartialEq + ExtensibleField<3>,
impl<B> PartialEq for CubeExtension<B>where
B: PartialEq + ExtensibleField<3>,
source§impl<B> Randomizable for CubeExtension<B>where
B: ExtensibleField<3>,
impl<B> Randomizable for CubeExtension<B>where
B: ExtensibleField<3>,
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<CubeExtension<B>>
fn from_random_bytes(bytes: &[u8]) -> Option<CubeExtension<B>>
Self
if the set of bytes forms a valid value, otherwise returns None.source§impl<B> Serializable for CubeExtension<B>where
B: ExtensibleField<3>,
impl<B> Serializable for CubeExtension<B>where
B: ExtensibleField<3>,
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 get_size_hint(&self) -> usize
fn get_size_hint(&self) -> usize
source§impl<B> Sub for CubeExtension<B>where
B: ExtensibleField<3>,
impl<B> Sub for CubeExtension<B>where
B: ExtensibleField<3>,
source§type Output = CubeExtension<B>
type Output = CubeExtension<B>
-
operator.source§fn sub(self, rhs: CubeExtension<B>) -> CubeExtension<B>
fn sub(self, rhs: CubeExtension<B>) -> CubeExtension<B>
-
operation. Read moresource§impl<B> SubAssign for CubeExtension<B>where
B: ExtensibleField<3>,
impl<B> SubAssign for CubeExtension<B>where
B: ExtensibleField<3>,
source§fn sub_assign(&mut self, rhs: CubeExtension<B>)
fn sub_assign(&mut self, rhs: CubeExtension<B>)
-=
operation. Read moresource§impl<'a, B> TryFrom<&'a [u8]> for CubeExtension<B>where
B: ExtensibleField<3>,
impl<'a, B> TryFrom<&'a [u8]> for CubeExtension<B>where
B: ExtensibleField<3>,
source§fn try_from(
bytes: &[u8],
) -> Result<CubeExtension<B>, <CubeExtension<B> as TryFrom<&'a [u8]>>::Error>
fn try_from( bytes: &[u8], ) -> Result<CubeExtension<B>, <CubeExtension<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.
source§type Error = DeserializationError
type Error = DeserializationError
source§impl<B> TryFrom<u128> for CubeExtension<B>where
B: ExtensibleField<3>,
impl<B> TryFrom<u128> for CubeExtension<B>where
B: ExtensibleField<3>,
source§impl<B> TryFrom<u64> for CubeExtension<B>where
B: ExtensibleField<3>,
impl<B> TryFrom<u64> for CubeExtension<B>where
B: ExtensibleField<3>,
impl<B> Copy for CubeExtension<B>where
B: Copy + ExtensibleField<3>,
impl<B> Eq for CubeExtension<B>where
B: Eq + ExtensibleField<3>,
impl<B> StructuralPartialEq for CubeExtension<B>where
B: ExtensibleField<3>,
Auto Trait Implementations§
impl<B> Freeze for CubeExtension<B>where
B: Freeze,
impl<B> RefUnwindSafe for CubeExtension<B>where
B: RefUnwindSafe,
impl<B> Send for CubeExtension<B>
impl<B> Sync for CubeExtension<B>
impl<B> Unpin for CubeExtension<B>where
B: Unpin,
impl<B> UnwindSafe for CubeExtension<B>where
B: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)