../../.cargo/katex-header.html

Struct winter_math::fields::CubeExtension

source ·
#[repr(C)]
pub struct CubeExtension<B: ExtensibleField<3>>(/* private fields */);
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: ExtensibleField<3>> CubeExtension<B>

source

pub const fn new(a: B, b: B, c: B) -> Self

Returns a new extension element instantiated from the provided base elements.

source

pub fn is_supported() -> bool

Returns true if the base field specified by B type parameter supports cubic extensions.

source

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: ExtensibleField<3>> Add for CubeExtension<B>

§

type Output = CubeExtension<B>

The resulting type after applying the + operator.
source§

fn add(self, rhs: Self) -> Self

Performs the + operation. Read more
source§

impl<B: ExtensibleField<3>> AddAssign for CubeExtension<B>

source§

fn add_assign(&mut self, rhs: Self)

Performs the += operation. Read more
source§

impl<B: ExtensibleField<3>> AsBytes for CubeExtension<B>

source§

fn as_bytes(&self) -> &[u8]

Returns a byte representation of self. Read more
source§

impl<B: Clone + ExtensibleField<3>> Clone for CubeExtension<B>

source§

fn clone(&self) -> CubeExtension<B>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<B: Debug + ExtensibleField<3>> Debug for CubeExtension<B>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<B: Default + ExtensibleField<3>> Default for CubeExtension<B>

source§

fn default() -> CubeExtension<B>

Returns the “default value” for a type. Read more
source§

impl<B: ExtensibleField<3>> Deserializable for CubeExtension<B>

source§

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
source§

fn read_from_bytes(bytes: &[u8]) -> Result<Self, DeserializationError>

Attempts to deserialize the provided bytes into Self and returns the result. Read more
source§

impl<B: ExtensibleField<3>> Display for CubeExtension<B>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<B: ExtensibleField<3>> Div for CubeExtension<B>

§

type Output = CubeExtension<B>

The resulting type after applying the / operator.
source§

fn div(self, rhs: Self) -> Self

Performs the / operation. Read more
source§

impl<B: ExtensibleField<3>> DivAssign for CubeExtension<B>

source§

fn div_assign(&mut self, rhs: Self)

Performs the /= operation. Read more
source§

impl<B: ExtensibleField<3>> ExtensionOf<B> for CubeExtension<B>

source§

fn mul_base(self, other: B) -> Self

source§

impl<B: ExtensibleField<3>> FieldElement for CubeExtension<B>

§

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.
§

type BaseField = B

Base field type for this finite field. For prime fields, BaseField should be set to Self.
source§

const EXTENSION_DEGREE: usize = 3usize

Extension degree of this field with respect to Self::BaseField. For prime fields, extension degree should be set to 1.
source§

const ELEMENT_BYTES: usize = _

Number of bytes needed to encode an element
source§

const IS_CANONICAL: bool = B::IS_CANONICAL

True if internal representation of the element is the same as its canonical representation.
source§

const ZERO: Self = _

The additive identity.
source§

const ONE: Self = _

The multiplicative identity.
source§

fn double(self) -> Self

Returns this field element added to itself.
source§

fn square(self) -> Self

Returns this field element raised to power 2.
source§

fn inv(self) -> Self

Returns a multiplicative inverse of this field element. If this element is ZERO, ZERO is returned.
source§

fn conjugate(&self) -> Self

Returns a conjugate of this field element.
source§

fn base_element(&self, i: usize) -> Self::BaseField

Return base filed element component of this field element at the specified index i. Read more
source§

fn slice_as_base_elements(elements: &[Self]) -> &[Self::BaseField]

Converts a slice of field elements into a slice of elements in the underlying base field. Read more
source§

fn slice_from_base_elements(elements: &[Self::BaseField]) -> &[Self]

Convert a slice of base field elements into a slice of field elements. Read more
source§

fn elements_as_bytes(elements: &[Self]) -> &[u8]

Converts a list of elements into a list of bytes. Read more
source§

unsafe fn bytes_as_elements( bytes: &[u8] ) -> Result<&[Self], DeserializationError>

Converts a list of bytes into a list of field elements. Read more
source§

fn cube(self) -> Self

Returns this field element raised to power 3.
source§

fn exp(self, power: Self::PositiveInteger) -> Self

Exponentiates this field element by power parameter.
source§

fn exp_vartime(self, power: Self::PositiveInteger) -> Self

Exponentiates this field element by power parameter. This function is expressly variable time, to speed-up verifier computations.
source§

impl<B: ExtensibleField<3>> From<B> for CubeExtension<B>

source§

fn from(value: B) -> Self

Converts to this type from the input type.
source§

impl<B: ExtensibleField<3>> From<u16> for CubeExtension<B>

source§

fn from(value: u16) -> Self

Converts to this type from the input type.
source§

impl<B: ExtensibleField<3>> From<u32> for CubeExtension<B>

source§

fn from(value: u32) -> Self

Converts to this type from the input type.
source§

impl<B: ExtensibleField<3>> From<u8> for CubeExtension<B>

source§

fn from(value: u8) -> Self

Converts to this type from the input type.
source§

impl<B: ExtensibleField<3>> Mul for CubeExtension<B>

§

type Output = CubeExtension<B>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: Self) -> Self

Performs the * operation. Read more
source§

impl<B: ExtensibleField<3>> MulAssign for CubeExtension<B>

source§

fn mul_assign(&mut self, rhs: Self)

Performs the *= operation. Read more
source§

impl<B: ExtensibleField<3>> Neg for CubeExtension<B>

§

type Output = CubeExtension<B>

The resulting type after applying the - operator.
source§

fn neg(self) -> Self

Performs the unary - operation. Read more
source§

impl<B: PartialEq + ExtensibleField<3>> PartialEq for CubeExtension<B>

source§

fn eq(&self, other: &CubeExtension<B>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<B: ExtensibleField<3>> Randomizable for CubeExtension<B>

source§

const VALUE_SIZE: usize = Self::ELEMENT_BYTES

Size of Self in bytes. Read more
source§

fn from_random_bytes(bytes: &[u8]) -> Option<Self>

Returns Self if the set of bytes forms a valid value, otherwise returns None.
source§

impl<B: ExtensibleField<3>> Serializable for CubeExtension<B>

source§

fn write_into<W: ByteWriter>(&self, target: &mut W)

Serializes self into bytes and writes these bytes into the target.
source§

fn to_bytes(&self) -> Vec<u8>

Serializes self into a vector of bytes.
source§

fn get_size_hint(&self) -> usize

Returns an estimate of how many bytes are needed to represent self. Read more
source§

impl<B: ExtensibleField<3>> Sub for CubeExtension<B>

§

type Output = CubeExtension<B>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: Self) -> Self

Performs the - operation. Read more
source§

impl<B: ExtensibleField<3>> SubAssign for CubeExtension<B>

source§

fn sub_assign(&mut self, rhs: Self)

Performs the -= operation. Read more
source§

impl<'a, B: ExtensibleField<3>> TryFrom<&'a [u8]> for CubeExtension<B>

source§

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

The type returned in the event of a conversion error.
source§

impl<B: ExtensibleField<3>> TryFrom<u128> for CubeExtension<B>

§

type Error = String

The type returned in the event of a conversion error.
source§

fn try_from(value: u128) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<B: ExtensibleField<3>> TryFrom<u64> for CubeExtension<B>

§

type Error = String

The type returned in the event of a conversion error.
source§

fn try_from(value: u64) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<B: Copy + ExtensibleField<3>> Copy for CubeExtension<B>

source§

impl<B: Eq + ExtensibleField<3>> Eq for CubeExtension<B>

source§

impl<B: ExtensibleField<3>> StructuralPartialEq for CubeExtension<B>

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<E> ExtensionOf<E> for E
where E: FieldElement,

source§

fn mul_base(self, other: E) -> E

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<E> ToElements<E> for E
where E: FieldElement,

source§

fn to_elements(&self) -> Vec<E>

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.