Trait miden_processor::StarkField [−]
pub trait StarkField: FieldElement<BaseField = Self> {
type QuadExtension: FieldElement;
const MODULUS: Self::PositiveInteger;
const MODULUS_BITS: u32;
const GENERATOR: Self;
const TWO_ADICITY: u32;
const TWO_ADIC_ROOT_OF_UNITY: Self;
fn get_modulus_le_bytes() -> Vec<u8, Global>;
fn as_int(&self) -> Self::PositiveInteger;
fn get_root_of_unity(n: u32) -> Self { ... }
}Expand description
Defines an element in a STARK-friendly finite field.
A STARK-friendly field is defined as a prime field with high two-addicity. That is, the
the modulus of the field should be a prime number of the form k * 2^n + 1 (a Proth prime),
where n is relatively larger (e.g., greater than 32).
Associated Types
type QuadExtension: FieldElement
type QuadExtension: FieldElement
Type describing quadratic extension of this StarkField.
Associated Constants
const MODULUS: Self::PositiveInteger
const MODULUS: Self::PositiveInteger
Prime modulus of the field. Must be of the form k * 2^n + 1 (a Proth prime).
This ensures that the field has high 2-adicity.
const MODULUS_BITS: u32
const MODULUS_BITS: u32
The number of bits needed to represents Self::MODULUS.
const GENERATOR: Self
const GENERATOR: Self
A multiplicative generator of the field.
const TWO_ADICITY: u32
const TWO_ADICITY: u32
Let Self::MODULUS = k * 2^n + 1; then, TWO_ADICITY is n.
const TWO_ADIC_ROOT_OF_UNITY: Self
const TWO_ADIC_ROOT_OF_UNITY: Self
Let Self::MODULUS = k * 2^n + 1; then, TWO_ADIC_ROOT_OF_UNITY is 2^n root of unity
computed as Self::GENERATOR^k.
Required methods
fn get_modulus_le_bytes() -> Vec<u8, Global>
fn get_modulus_le_bytes() -> Vec<u8, Global>
Returns byte representation of the field modulus in little-endian byte order.
fn as_int(&self) -> Self::PositiveInteger
fn as_int(&self) -> Self::PositiveInteger
Returns a canonical integer representation of the field element.
Provided methods
fn get_root_of_unity(n: u32) -> Self
fn get_root_of_unity(n: u32) -> Self
Returns the root of unity of order 2^n.
Panics
Panics if the root of unity for the specified order does not exist in this field.
Implementations on Foreign Types
impl StarkField for BaseElement
impl StarkField for BaseElement
pub const MODULUS: <BaseElement as FieldElement>::PositiveInteger
pub const MODULUS: <BaseElement as FieldElement>::PositiveInteger
sage: MODULUS = 2^62 - 111 * 2^39 + 1
sage: GF(MODULUS).is_prime_field()
True
sage: GF(MODULUS).order()
4611624995532046337
pub const GENERATOR: BaseElement
pub const GENERATOR: BaseElement
sage: GF(MODULUS).primitive_element()
3
pub const TWO_ADICITY: u32
pub const TWO_ADICITY: u32
sage: is_odd((MODULUS - 1) / 2^39)
True
pub const TWO_ADIC_ROOT_OF_UNITY: BaseElement
pub const TWO_ADIC_ROOT_OF_UNITY: BaseElement
sage: k = (MODULUS - 1) / 2^39
sage: GF(MODULUS).primitive_element()^k
4421547261963328785