pub struct Goldilocks { /* private fields */ }
Expand description
The prime field known as Goldilocks, defined as F_p
where p = 2^64 - 2^32 + 1
.
Trait Implementations§
Source§impl AbstractField for Goldilocks
impl AbstractField for Goldilocks
const ZERO: Self = _
const ONE: Self = _
const TWO: Self = _
const NEG_ONE: Self = _
type F = Goldilocks
fn from_f(f: Self::F) -> Self
Source§fn from_canonical_u8(n: u8) -> Self
fn from_canonical_u8(n: u8) -> Self
Convert from a canonical
u8
. Read moreSource§fn from_canonical_u16(n: u16) -> Self
fn from_canonical_u16(n: u16) -> Self
Convert from a canonical
u16
. Read moreSource§fn from_canonical_u32(n: u32) -> Self
fn from_canonical_u32(n: u32) -> Self
Convert from a canonical
u32
. Read moreSource§fn from_canonical_u64(n: u64) -> Self
fn from_canonical_u64(n: u64) -> Self
Convert from a canonical
u64
. Read moreSource§fn from_canonical_usize(n: usize) -> Self
fn from_canonical_usize(n: usize) -> Self
Convert from a canonical
usize
. Read morefn from_wrapped_u32(n: u32) -> Self
fn from_wrapped_u64(n: u64) -> Self
Source§fn zero_vec(len: usize) -> Vec<Self>
fn zero_vec(len: usize) -> Vec<Self>
Allocates a vector of zero elements of length
len
. Many operating systems zero pages
before assigning them to a userspace process. In that case, our process should not need to
write zeros, which would be redundant. However, the compiler may not always recognize this. Read morefn double(&self) -> Self
fn square(&self) -> Self
fn cube(&self) -> Self
fn exp_const_u64<const POWER: u64>(&self) -> Self
fn exp_power_of_2(&self, power_log: usize) -> Self
Source§fn mul_2exp_u64(&self, exp: u64) -> Self
fn mul_2exp_u64(&self, exp: u64) -> Self
self * 2^exp
fn powers(&self) -> Powers<Self>
fn shifted_powers(&self, start: Self) -> Powers<Self>
fn powers_packed<P>(&self) -> PackedPowers<Self, P>where
P: PackedField<Scalar = Self>,
fn shifted_powers_packed<P>(&self, start: Self) -> PackedPowers<Self, P>where
P: PackedField<Scalar = Self>,
fn dot_product<const N: usize>(u: &[Self; N], v: &[Self; N]) -> Self
fn try_div<Rhs>(self, rhs: Rhs) -> Option<Self::Output>
Source§impl Add for Goldilocks
impl Add for Goldilocks
Source§impl AddAssign for Goldilocks
impl AddAssign for Goldilocks
Source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
Performs the
+=
operation. Read moreSource§impl BinomiallyExtendable<2> for Goldilocks
impl BinomiallyExtendable<2> for Goldilocks
Source§impl Clone for Goldilocks
impl Clone for Goldilocks
Source§fn clone(&self) -> Goldilocks
fn clone(&self) -> Goldilocks
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Convolve<Goldilocks, i128, i64, i128> for SmallConvolveGoldilocks
impl Convolve<Goldilocks, i128, i64, i128> for SmallConvolveGoldilocks
Source§fn read(input: Goldilocks) -> i128
fn read(input: Goldilocks) -> i128
Return the lift of a Goldilocks element, 0 <= input.value <= P < 2^64. We widen immediately, since some valid Goldilocks elements don’t fit in an i64, and since in any case overflow can occur for even the smallest convolutions.
Source§fn parity_dot<const N: usize>(u: [i128; N], v: [i64; N]) -> i128
fn parity_dot<const N: usize>(u: [i128; N], v: [i64; N]) -> i128
For a convolution of size N, |x| < N * 2^64 and (as per the
assumption above), |y| < 2^51. So the product is at most N *
2^115 which will not overflow for N <= 16. We widen y
at
this point to perform the multiplication.
Source§fn reduce(z: i128) -> Goldilocks
fn reduce(z: i128) -> Goldilocks
The assumptions above mean z < N^2 * 2^115, which is at most 2^123 when N <= 16.
NB: Even though intermediate values could be negative, the output must be non-negative since the inputs were non-negative.
fn conv3(lhs: [T; 3], rhs: [U; 3], output: &mut [V])
fn negacyclic_conv3(lhs: [T; 3], rhs: [U; 3], output: &mut [V])
fn conv4(lhs: [T; 4], rhs: [U; 4], output: &mut [V])
fn negacyclic_conv4(lhs: [T; 4], rhs: [U; 4], output: &mut [V])
fn conv6(lhs: [T; 6], rhs: [U; 6], output: &mut [V])
fn negacyclic_conv6(lhs: [T; 6], rhs: [U; 6], output: &mut [V])
fn conv8(lhs: [T; 8], rhs: [U; 8], output: &mut [V])
fn negacyclic_conv8(lhs: [T; 8], rhs: [U; 8], output: &mut [V])
fn conv12(lhs: [T; 12], rhs: [U; 12], output: &mut [V])
fn negacyclic_conv12(lhs: [T; 12], rhs: [U; 12], output: &mut [V])
fn conv16(lhs: [T; 16], rhs: [U; 16], output: &mut [V])
fn negacyclic_conv16(lhs: [T; 16], rhs: [U; 16], output: &mut [V])
fn conv24(lhs: [T; 24], rhs: [U; 24], output: &mut [V])
fn conv32(lhs: [T; 32], rhs: [U; 32], output: &mut [V])
fn negacyclic_conv32(lhs: [T; 32], rhs: [U; 32], output: &mut [V])
fn conv64(lhs: [T; 64], rhs: [U; 64], output: &mut [V])
Source§impl Debug for Goldilocks
impl Debug for Goldilocks
Source§impl Default for Goldilocks
impl Default for Goldilocks
Source§fn default() -> Goldilocks
fn default() -> Goldilocks
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for Goldilocks
impl<'de> Deserialize<'de> for Goldilocks
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for Goldilocks
impl Display for Goldilocks
Source§impl Distribution<Goldilocks> for Standard
impl Distribution<Goldilocks> for Standard
Source§impl Div for Goldilocks
impl Div for Goldilocks
Source§impl Field for Goldilocks
impl Field for Goldilocks
type Packing = Goldilocks
fn is_zero(&self) -> bool
Source§fn exp_u64_generic<AF: AbstractField<F = Self>>(val: AF, power: u64) -> AF
fn exp_u64_generic<AF: AbstractField<F = Self>>(val: AF, power: u64) -> AF
Exponentiation by a
u64
power. This is similar to exp_u64
, but more general in that it
can be used with AbstractField
s, not just this concrete field. Read moreSource§fn try_inverse(&self) -> Option<Self>
fn try_inverse(&self) -> Option<Self>
The multiplicative inverse of this field element, if it exists. Read more
Source§fn halve(&self) -> Self
fn halve(&self) -> Self
Computes input/2.
Should be overwritten by most field implementations to use bitshifts.
Will error if the field characteristic is 2.
fn order() -> BigUint
fn is_one(&self) -> bool
Source§fn div_2exp_u64(&self, exp: u64) -> Self
fn div_2exp_u64(&self, exp: u64) -> Self
self / 2^exp
fn inverse(&self) -> Self
Source§fn multiplicative_group_factors() -> Vec<(BigUint, usize)>
fn multiplicative_group_factors() -> Vec<(BigUint, usize)>
A list of (factor, exponent) pairs.
fn bits() -> usize
Source§impl HasTwoAdicBionmialExtension<2> for Goldilocks
impl HasTwoAdicBionmialExtension<2> for Goldilocks
const EXT_TWO_ADICITY: usize = 33usize
Source§fn ext_two_adic_generator(bits: usize) -> [Self; 2]
fn ext_two_adic_generator(bits: usize) -> [Self; 2]
Assumes the multiplicative group size has at least
bits
powers of two, otherwise the
behavior is undefined.Source§impl Hash for Goldilocks
impl Hash for Goldilocks
Source§impl Mul for Goldilocks
impl Mul for Goldilocks
Source§impl MulAssign for Goldilocks
impl MulAssign for Goldilocks
Source§fn mul_assign(&mut self, rhs: Self)
fn mul_assign(&mut self, rhs: Self)
Performs the
*=
operation. Read moreSource§impl Neg for Goldilocks
impl Neg for Goldilocks
Source§impl Ord for Goldilocks
impl Ord for Goldilocks
Source§impl PartialEq for Goldilocks
impl PartialEq for Goldilocks
Source§impl PartialOrd for Goldilocks
impl PartialOrd for Goldilocks
Source§impl PrimeField for Goldilocks
impl PrimeField for Goldilocks
fn as_canonical_biguint(&self) -> BigUint
Source§impl PrimeField64 for Goldilocks
impl PrimeField64 for Goldilocks
Source§impl Product for Goldilocks
impl Product for Goldilocks
Source§impl Serialize for Goldilocks
impl Serialize for Goldilocks
Source§impl Sub for Goldilocks
impl Sub for Goldilocks
Source§impl SubAssign for Goldilocks
impl SubAssign for Goldilocks
Source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
Performs the
-=
operation. Read moreSource§impl Sum for Goldilocks
impl Sum for Goldilocks
Source§impl TwoAdicField for Goldilocks
impl TwoAdicField for Goldilocks
Source§const TWO_ADICITY: usize = 32usize
const TWO_ADICITY: usize = 32usize
The number of factors of two in this field’s multiplicative group.
Source§fn two_adic_generator(bits: usize) -> Self
fn two_adic_generator(bits: usize) -> Self
Returns a generator of the multiplicative group of order
2^bits
.
Assumes bits <= TWO_ADICITY
, otherwise the result is undefined.impl Copy for Goldilocks
impl Eq for Goldilocks
impl MdsPermutation<Goldilocks, 12> for MdsMatrixGoldilocks
impl MdsPermutation<Goldilocks, 16> for MdsMatrixGoldilocks
impl MdsPermutation<Goldilocks, 24> for MdsMatrixGoldilocks
impl MdsPermutation<Goldilocks, 32> for MdsMatrixGoldilocks
impl MdsPermutation<Goldilocks, 64> for MdsMatrixGoldilocks
impl MdsPermutation<Goldilocks, 68> for MdsMatrixGoldilocks
impl MdsPermutation<Goldilocks, 8> for MdsMatrixGoldilocks
impl Packable for Goldilocks
Auto Trait Implementations§
impl Freeze for Goldilocks
impl RefUnwindSafe for Goldilocks
impl Send for Goldilocks
impl Sync for Goldilocks
impl Unpin for Goldilocks
impl UnwindSafe for Goldilocks
Blanket Implementations§
Source§impl<AF> AbstractExtensionField<AF> for AFwhere
AF: AbstractField,
impl<AF> AbstractExtensionField<AF> for AFwhere
AF: AbstractField,
const D: usize = 1usize
fn from_base(b: AF) -> AF
Source§fn from_base_slice(bs: &[AF]) -> AF
fn from_base_slice(bs: &[AF]) -> AF
Suppose this field extension is represented by the quotient
ring B[X]/(f(X)) where B is
Base
and f is an irreducible
polynomial of degree D
. This function takes a slice bs
of
length at exactly D, and constructs the field element
\sum_i bs[i] * X^i. Read morefn from_base_iter<I>(iter: I) -> AFwhere
I: Iterator<Item = AF>,
Source§fn from_base_fn<F>(f: F) -> AF
fn from_base_fn<F>(f: F) -> AF
Similar to
core:array::from_fn
, with the same caveats as
from_base_slice
.Source§fn as_base_slice(&self) -> &[AF]
fn as_base_slice(&self) -> &[AF]
Suppose this field extension is represented by the quotient
ring B[X]/(f(X)) where B is
Base
and f is an irreducible
polynomial of degree D
. This function takes a field element
\sum_i bs[i] * X^i and returns the coefficients as a slice
bs
of length at most D containing, from lowest degree to
highest. Read moreSource§fn monomial(exponent: usize) -> Self
fn monomial(exponent: usize) -> Self
Suppose this field extension is represented by the quotient
ring B[X]/(f(X)) where B is
Base
and f is an irreducible
polynomial of degree D
. This function returns the field
element X^exponent
if exponent < D
and panics otherwise.
(The fact that f is not known at the point that this function
is defined prevents implementing exponentiation of higher
powers since the reduction cannot be performed.) Read moreSource§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
Mutably borrows from an owned value. Read more
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)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)Source§impl<F> ExtensionField<F> for Fwhere
F: Field,
impl<F> ExtensionField<F> for Fwhere
F: Field,
type ExtensionPacking = <F as Field>::Packing
fn is_in_basefield(&self) -> bool
fn as_base(&self) -> Option<Base>
fn ext_powers_packed(&self) -> impl Iterator<Item = Self::ExtensionPacking>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more