Struct winter_math::fields::f62::BaseElement [−][src]
pub struct BaseElement(_);
Expand description
Represents base field element in the field.
Internal values are stored in Montgomery representation and can be in the range [0; 2M). The
backing type is u64.
Implementations
Creates a new field element from the provided value; the value is converted into
Montgomery representation.
Trait Implementations
Performs the += operation. Read more
Returns the “default value” for a type. Read more
Reads a sequence of bytes from the provided source, attempts to deserialize these bytes
into Self, and returns the result. Read more
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,
Reads a sequence of bytes from the provided source, attempts to deserialize these bytes
into a vector with the specified number of Self elements, and returns the result. Read more
Performs the /= operation. Read more
type PositiveInteger = u64
type PositiveInteger = u64
A type defining positive integers big enough to describe a field modulus for
Self::BaseField with no loss of precision. Read more
type BaseField = Self
type BaseField = Self
Base field type for this finite field. For prime fields, BaseField should be set
to Self. Read more
Number of bytes needed to encode an element
True if internal representation of an element can be redundant - i.e., multiple internal representations map to the same canonical representation. Read more
Exponentiates this field element by power parameter.
Returns a multiplicative inverse of this field element. If this element is ZERO, ZERO is returned. Read more
Returns a cryptographically-secure random element drawn uniformly from the entire field.
Returns a field element if the set of bytes forms a valid field element, otherwise returns None. The element is expected to be in canonical representation. This function is primarily intended for sampling random field elements from a hash function output. Read more
Converts a vector of field elements into a vector of bytes. The elements may be in the internal representation rather than in the canonical representation. This conversion is intended to be zero-copy (i.e. by re-interpreting the underlying memory). Read more
Converts a list of elements into a list of bytes. The elements may be in the internal representation rather than in the canonical representation. This conversion is intended to be zero-copy (i.e. by re-interpreting the underlying memory). Read more
Converts a list of bytes into a list of field elements. The elements are assumed to encoded in the internal representation rather than in the canonical representation. The conversion is intended to be zero-copy (i.e. by re-interpreting the underlying memory). Read more
Returns a vector of length n initialized with all ZERO elements. Read more
Returns a vector of n pseudo-random elements drawn uniformly from the entire
field based on the provided seed. Read more
Converts the value encoded in an array of 8 bytes into a field element. The bytes are assumed to encode the element in the canonical representation in little-endian byte order. If the value is greater than or equal to the field modulus, modular reduction is silently preformed.
Performs the *= operation. Read more
sage: MODULUS = 2^62 - 111 * 2^39 + 1
sage: GF(MODULUS).is_prime_field()
True
sage: GF(MODULUS).order()
4611624995532046337
sage: is_odd((MODULUS - 1) / 2^39)
True
sage: k = (MODULUS - 1) / 2^39
sage: GF(MODULUS).primitive_element()^k
4421547261963328785
type QuadExtension = QuadExtensionA<Self>
type QuadExtension = QuadExtensionA<Self>
Type describing quadratic extension of this StarkField.
The number of bits needed to represents Self::MODULUS.
Returns byte representation of the field modulus in little-endian byte order.
Returns a canonical integer representation of the field element.
Returns the root of unity of order 2^n. Read more
Performs the -= operation. Read more
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 encode the element in the canonical representation in little-endian byte order.
type Error = DeserializationError
type Error = DeserializationError
The type returned in the event of a conversion error.
Auto Trait Implementations
impl RefUnwindSafe for BaseElement
impl Send for BaseElement
impl Sync for BaseElement
impl Unpin for BaseElement
impl UnwindSafe for BaseElement
Blanket Implementations
Mutably borrows from an owned value. Read more