pub struct Poly192(/* private fields */);Expand description
GF(2^192), as three coordinates over GF(2^64) in the basis 1, y, y^2.
The defining relation is y^3 = y + 1, which also gives y^4 = y^2 + y.
Everything below reduces with those two rewrites and nothing else.
Implementations§
Source§impl Poly192
impl Poly192
Sourcepub const fn new(coefficients: [Poly64; 3]) -> Self
pub const fn new(coefficients: [Poly64; 3]) -> Self
The element with the given coordinates in the basis 1, y, y^2.
Sourcepub const fn coefficients(self) -> [Poly64; 3]
pub const fn coefficients(self) -> [Poly64; 3]
The coordinates of this element in the basis 1, y, y^2.
Sourcepub fn invert_or_zero(self) -> Self
pub fn invert_or_zero(self) -> Self
The inverse of this element, with zero sent to zero.
Every step runs whatever the operand is, so the cost says nothing about the value.
Trait Implementations§
Source§impl<T: Into<Self>> AddAssign<T> for Poly192
impl<T: Into<Self>> AddAssign<T> for Poly192
Source§fn add_assign(&mut self, rhs: T)
fn add_assign(&mut self, rhs: T)
+= operation. Read moreSource§impl Algebra<Gf2> for Poly192
impl Algebra<Gf2> for Poly192
Source§fn quadratic_extension_square(a: &[Self; 2], w: F) -> [Self; 2]
fn quadratic_extension_square(a: &[Self; 2], w: F) -> [Self; 2]
Source§fn mixed_dot_product<const N: usize>(a: &[Self; N], f: &[F; N]) -> Selfwhere
F: Dup,
fn mixed_dot_product<const N: usize>(a: &[Self; N], f: &[F; N]) -> Selfwhere
F: Dup,
Source§const BATCHED_LC_CHUNK: usize = 8
const BATCHED_LC_CHUNK: usize = 8
batched_linear_combination. Read moreSource§impl Algebra<Poly64> for Poly192
impl Algebra<Poly64> for Poly192
Source§fn quadratic_extension_square(a: &[Self; 2], w: F) -> [Self; 2]
fn quadratic_extension_square(a: &[Self; 2], w: F) -> [Self; 2]
Source§fn mixed_dot_product<const N: usize>(a: &[Self; N], f: &[F; N]) -> Selfwhere
F: Dup,
fn mixed_dot_product<const N: usize>(a: &[Self; N], f: &[F; N]) -> Selfwhere
F: Dup,
Source§const BATCHED_LC_CHUNK: usize = 8
const BATCHED_LC_CHUNK: usize = 8
batched_linear_combination. Read moreSource§impl AlgebraIdentity<Poly64> for Poly192
impl AlgebraIdentity<Poly64> for Poly192
Source§impl BasedVectorSpace<Poly64> for Poly192
impl BasedVectorSpace<Poly64> for Poly192
Source§fn flatten_to_base(vec: Vec<Self>) -> Vec<Poly64>
fn flatten_to_base(vec: Vec<Self>) -> Vec<Poly64>
A whole vector of elements is one contiguous run of coordinates, so this is a copy.
Source§const DIMENSION: usize = DEGREE
const DIMENSION: usize = DEGREE
Source§fn as_basis_coefficients_slice(&self) -> &[Poly64]
fn as_basis_coefficients_slice(&self) -> &[Poly64]
A and uses this to
map an element of A to a slice of DIMENSION F elements. Read moreSource§fn from_basis_coefficients_fn<F: FnMut(usize) -> Poly64>(f: F) -> Self
fn from_basis_coefficients_fn<F: FnMut(usize) -> Poly64>(f: F) -> Self
A and uses this to
map DIMENSION F elements to an element of A. Similar
to core:array::from_fn, the DIMENSION F elements are
given by Fn(0), ..., Fn(DIMENSION - 1) called in that order. Read moreSource§fn from_basis_coefficients_iter<I: ExactSizeIterator<Item = Poly64>>(
iter: I,
) -> Option<Self>
fn from_basis_coefficients_iter<I: ExactSizeIterator<Item = Poly64>>( iter: I, ) -> Option<Self>
A and uses this to
map DIMENSION F elements to an element of A. Read moreSource§fn from_basis_coefficients_slice(slice: &[F]) -> Option<Self>
fn from_basis_coefficients_slice(slice: &[F]) -> Option<Self>
A and uses this to
map DIMENSION F elements to an element of A. Read moreimpl Copy for Poly192
Source§impl<'de> Deserialize<'de> for Poly192
impl<'de> Deserialize<'de> for Poly192
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>,
Source§impl Distribution<Poly192> for StandardUniform
impl Distribution<Poly192> for StandardUniform
Source§impl DivAssign for Poly192
impl DivAssign for Poly192
Source§fn div_assign(&mut self, rhs: Poly192)
fn div_assign(&mut self, rhs: Poly192)
/= operation. Read moreSource§impl DivAssign<Poly64> for Poly192
impl DivAssign<Poly64> for Poly192
Source§fn div_assign(&mut self, rhs: Poly64)
fn div_assign(&mut self, rhs: Poly64)
/= operation. Read moreimpl Eq for Poly192
Source§impl ExtensionField<Poly64> for Poly192
impl ExtensionField<Poly64> for Poly192
type ExtensionPacking = Poly192
Source§fn is_in_basefield(&self) -> bool
fn is_in_basefield(&self) -> bool
Source§fn as_base(&self) -> Option<Poly64>
fn as_base(&self) -> Option<Poly64>
Source§fn from_ext_basis_coefficients(coeffs: &[Self]) -> Option<Self>
fn from_ext_basis_coefficients(coeffs: &[Self]) -> Option<Self>
Self from D = DIMENSION coefficients in Self
via Σⱼ basisⱼ · coeffsⱼ. Returns None if coeffs.len() != Self::DIMENSION. Read moreSource§impl Field for Poly192
impl Field for Poly192
Source§fn try_inverse(&self) -> Option<Self>
fn try_inverse(&self) -> Option<Self>
§Algorithm
Multiplication by a fixed element is a 3 x 3 matrix over the coefficient field.
Its columns are where that multiplication sends the three basis elements:
a * 1 = ( a_0, a_1, a_2 )
a * y = ( a_2, a_0 + a_2, a_1 )
a * y^2 = ( a_1, a_1 + a_2, a_0 + a_2 )The inverse is the first column of that matrix inverted.
The adjugate gives it as the top row of cofactors over the determinant.
The determinant is the norm down to the coefficient field, and it vanishes only at zero.
Source§fn try_sqrt(&self) -> Option<Self>
fn try_sqrt(&self) -> Option<Self>
Squaring is a triangular map on the coordinates, so its inverse is one too.
b_0 = a_0^2, b_1 = a_2^2, b_2 = a_1^2 + a_2^2Reading that backwards costs three coefficient-field square roots and one addition.
Source§fn interpolation_node(i: usize) -> Self
fn interpolation_node(i: usize) -> Self
The enumeration by bit pattern.
The coordinates over GF(2) run through the coefficient fields in order.
An index narrower than 64 bits therefore lands entirely in the first of them.
type Packing = Poly192
Source§const BENEFITS_FROM_LOCKSTEP_EVALUATION: bool = false
const BENEFITS_FROM_LOCKSTEP_EVALUATION: bool = false
Source§fn is_zero(&self) -> bool
fn is_zero(&self) -> bool
Source§fn is_one(&self) -> bool
fn is_one(&self) -> bool
Source§fn add_slices(slice_1: &mut [Self], slice_2: &[Self])
fn add_slices(slice_1: &mut [Self], slice_2: &[Self])
Source§fn batched_columnwise_dot_product<EF, R, I, const N: usize>(
acc: &mut [<EF as ExtensionField<Self>>::ExtensionPacking],
items: I,
)where
EF: ExtensionField<Self>,
R: Iterator<Item = Self::Packing>,
I: Iterator<Item = (R, [EF; N])>,
fn batched_columnwise_dot_product<EF, R, I, const N: usize>(
acc: &mut [<EF as ExtensionField<Self>>::ExtensionPacking],
items: I,
)where
EF: ExtensionField<Self>,
R: Iterator<Item = Self::Packing>,
I: Iterator<Item = (R, [EF; N])>,
acc[c * N + j] += scales[j] * row[c] over a stream of packed rows. Read moreSource§impl HasFrobenius<Poly64> for Poly192
impl HasFrobenius<Poly64> for Poly192
Source§fn frobenius(&self) -> Self
fn frobenius(&self) -> Self
The map raising to the size of the coefficient field.
It fixes every coefficient and permutes the basis.
The three roots of the modulus are y, y^2 and y^2 + y, so:
y^(2^64) = y^2
a_0 + a_1 y + a_2 y^2 -> a_0 + a_2 y + (a_1 + a_2) y^2So one application is one addition and a permutation, with no products at all.
Source§fn repeated_frobenius(&self, count: usize) -> Self
fn repeated_frobenius(&self, count: usize) -> Self
count times. Read moreSource§fn pseudo_inv(&self) -> Self
fn pseudo_inv(&self) -> Self
Source§fn galois_orbit(self) -> Vec<Self>
fn galois_orbit(self) -> Vec<Self>
Source§impl Mul for Poly192
impl Mul for Poly192
Source§fn mul(self, rhs: Self) -> Self
fn mul(self, rhs: Self) -> Self
§Algorithm
Karatsuba over three limbs: six products instead of the schoolbook nine.
c_i = a_i b_i
d_ij = (a_i + a_j) (b_i + b_j)
p_1 = d_01 + c_0 + c_1
p_2 = d_02 + c_0 + c_1 + c_2
p_3 = d_12 + c_1 + c_2The unreduced product spans degrees 0 to 4, and the modulus folds the top two down:
y^3 = y + 1
y^4 = y^2 + ySource§impl<T: Into<Self>> MulAssign<T> for Poly192
impl<T: Into<Self>> MulAssign<T> for Poly192
Source§fn mul_assign(&mut self, rhs: T)
fn mul_assign(&mut self, rhs: T)
*= operation. Read moreSource§impl Ord for Poly192
impl Ord for Poly192
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
impl Packable for Poly192
Source§impl PackedFieldExtension<Poly64, Poly192> for Poly192
One element per vector, so every lane index is zero.
impl PackedFieldExtension<Poly64, Poly192> for Poly192
One element per vector, so every lane index is zero.
Source§fn from_ext_fn(f: impl Fn(usize) -> Self) -> Self
fn from_ext_fn(f: impl Fn(usize) -> Self) -> Self
f to each lane. Read moreSource§fn from_ext_slice(slice: &[Self]) -> Self
fn from_ext_slice(slice: &[Self]) -> Self
WIDTH slice of extension field elements into one packed extension. Read moreSource§fn extract(&self, lane: usize) -> Self
fn extract(&self, lane: usize) -> Self
Source§fn add_assign_lane(&mut self, lane: usize, value: Self)
fn add_assign_lane(&mut self, lane: usize, value: Self)
Source§fn packed_ext_powers(base: Self) -> Powers<Self> ⓘ
fn packed_ext_powers(base: Self) -> Powers<Self> ⓘ
packed_powers, construct an iterator which returns
powers of base packed into PackedFieldExtension elements.Source§fn pack_ext_columns<const N: usize>(rows: &[[ExtField; N]]) -> [Self; N]
fn pack_ext_columns<const N: usize>(rows: &[[ExtField; N]]) -> [Self; N]
Source§fn pack_ext_columns_fn<const N: usize>(
row_fn: impl Fn(usize) -> [ExtField; N],
) -> [Self; N]
fn pack_ext_columns_fn<const N: usize>( row_fn: impl Fn(usize) -> [ExtField; N], ) -> [Self; N]
N columns using a closure that produces each row. Read moreSource§fn to_ext_slice(&self, out: &mut [ExtField])
fn to_ext_slice(&self, out: &mut [ExtField])
W lanes into the given slice. Read moreSource§fn unpack_ext_into<const N: usize>(
packed: &[Self; N],
rows: &mut [[ExtField; N]],
)
fn unpack_ext_into<const N: usize>( packed: &[Self; N], rows: &mut [[ExtField; N]], )
Source§fn unpack_ext_iter<const N: usize>(
packed: [Self; N],
) -> impl Iterator<Item = [ExtField; N]>
fn unpack_ext_iter<const N: usize>( packed: [Self; N], ) -> impl Iterator<Item = [ExtField; N]>
PackedFieldExtension::unpack_ext_into. Read moreSource§fn to_ext_iter(
iter: impl IntoIterator<Item = Self>,
) -> impl Iterator<Item = ExtField>
fn to_ext_iter( iter: impl IntoIterator<Item = Self>, ) -> impl Iterator<Item = ExtField>
ExtField per lane per packed value).Source§fn unpack_transpose_into(src: &[Self], dst: &mut [ExtField], src_width: usize)
fn unpack_transpose_into(src: &[Self], dst: &mut [ExtField], src_width: usize)
Source§impl PartialOrd for Poly192
impl PartialOrd for Poly192
Source§impl PrimeCharacteristicRing for Poly192
impl PrimeCharacteristicRing for Poly192
Source§fn square(&self) -> Self
fn square(&self) -> Self
Squaring is F_2-linear, so the cross terms vanish and only the fold survives.
(a_0 + a_1 y + a_2 y^2)^2 = a_0^2 + a_1^2 y^2 + a_2^2 y^4
= a_0^2 + a_2^2 y + (a_1^2 + a_2^2) y^2Source§fn div_2exp_u64(&self, _exp: u64) -> Self
fn div_2exp_u64(&self, _exp: u64) -> Self
§Panics
Always panics: 2 is not invertible in characteristic 2.
Source§type PrimeSubfield = Gf2
type PrimeSubfield = Gf2
ℤ/p where the characteristic of this ring is p.Source§fn zero_vec(len: usize) -> Vec<Self>
fn zero_vec(len: usize) -> Vec<Self>
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 moreSource§fn from_prime_subfield(f: Self::PrimeSubfield) -> Self
fn from_prime_subfield(f: Self::PrimeSubfield) -> Self
Source§fn xor(&self, y: &Self) -> Self
fn xor(&self, y: &Self) -> Self
xor. Read moreSource§fn mul_2exp_u64(&self, exp: u64) -> Self
fn mul_2exp_u64(&self, exp: u64) -> Self
mul_2exp_u64(a, exp) = a * 2^{exp}. Read moreSource§fn from_usize(int: usize) -> Self
fn from_usize(int: usize) -> Self
Source§fn from_isize(int: isize) -> Self
fn from_isize(int: isize) -> Self
Source§fn xor3(&self, y: &Self, z: &Self) -> Self
fn xor3(&self, y: &Self, z: &Self) -> Self
xor. Read moreSource§fn bool_check(&self) -> Self
fn bool_check(&self) -> Self
x * (x - 1). Read moreSource§fn exp_const_u64<const POWER: u64>(&self) -> Self
fn exp_const_u64<const POWER: u64>(&self) -> Self
Source§fn exp_power_of_2(&self, power_log: usize) -> Self
fn exp_power_of_2(&self, power_log: usize) -> Self
exp_power_of_2(a, power_log) = a^{2^power_log}. Read moreSource§fn powers(&self) -> Powers<Self> ⓘ
fn powers(&self) -> Powers<Self> ⓘ
self: self^0, self^1, self^2, ....Source§fn shifted_powers(&self, start: Self) -> Powers<Self> ⓘ
fn shifted_powers(&self, start: Self) -> Powers<Self> ⓘ
self shifted by start: start, start*self^1, start*self^2, ....Source§impl RawDataSerializable for Poly192
impl RawDataSerializable for Poly192
Source§const NUM_BYTES: usize
const NUM_BYTES: usize
Source§fn into_bytes(self) -> impl IntoIterator<Item = u8>
fn into_bytes(self) -> impl IntoIterator<Item = u8>
Source§fn into_byte_stream(
input: impl IntoIterator<Item = Self>,
) -> impl IntoIterator<Item = u8>
fn into_byte_stream( input: impl IntoIterator<Item = Self>, ) -> impl IntoIterator<Item = u8>
Source§fn into_u32_stream(
input: impl IntoIterator<Item = Self>,
) -> impl IntoIterator<Item = u32>
fn into_u32_stream( input: impl IntoIterator<Item = Self>, ) -> impl IntoIterator<Item = u32>
Source§fn into_u64_stream(
input: impl IntoIterator<Item = Self>,
) -> impl IntoIterator<Item = u64>
fn into_u64_stream( input: impl IntoIterator<Item = Self>, ) -> impl IntoIterator<Item = u64>
Source§fn into_parallel_byte_streams<const N: usize>(
input: impl IntoIterator<Item = [Self; N]>,
) -> impl IntoIterator<Item = [u8; N]>
fn into_parallel_byte_streams<const N: usize>( input: impl IntoIterator<Item = [Self; N]>, ) -> impl IntoIterator<Item = [u8; N]>
Source§fn into_parallel_u32_streams<const N: usize>(
input: impl IntoIterator<Item = [Self; N]>,
) -> impl IntoIterator<Item = [u32; N]>
fn into_parallel_u32_streams<const N: usize>( input: impl IntoIterator<Item = [Self; N]>, ) -> impl IntoIterator<Item = [u32; N]>
Source§fn into_parallel_u64_streams<const N: usize>(
input: impl IntoIterator<Item = [Self; N]>,
) -> impl IntoIterator<Item = [u64; N]>
fn into_parallel_u64_streams<const N: usize>( input: impl IntoIterator<Item = [Self; N]>, ) -> impl IntoIterator<Item = [u64; N]>
impl StructuralPartialEq for Poly192
Auto Trait Implementations§
impl Freeze for Poly192
impl RefUnwindSafe for Poly192
impl Send for Poly192
impl Sync for Poly192
impl Unpin for Poly192
impl UnsafeUnpin for Poly192
impl UnwindSafe for Poly192
Blanket Implementations§
Source§impl<R> Algebra<R> for Rwhere
R: PrimeCharacteristicRing,
impl<R> Algebra<R> for Rwhere
R: PrimeCharacteristicRing,
Source§fn mixed_dot_product<const N: usize>(a: &[R; N], f: &[R; N]) -> R
fn mixed_dot_product<const N: usize>(a: &[R; N], f: &[R; N]) -> R
Source§fn quadratic_extension_square(a: &[Self; 2], w: F) -> [Self; 2]
fn quadratic_extension_square(a: &[Self; 2], w: F) -> [Self; 2]
Source§const BATCHED_LC_CHUNK: usize = 8
const BATCHED_LC_CHUNK: usize = 8
batched_linear_combination. Read moreSource§impl<F> AlgebraIdentity<F> for Fwhere
F: PrimeCharacteristicRing,
impl<F> AlgebraIdentity<F> for Fwhere
F: PrimeCharacteristicRing,
Source§impl<F> BasedVectorSpace<F> for Fwhere
F: PrimeCharacteristicRing,
impl<F> BasedVectorSpace<F> for Fwhere
F: PrimeCharacteristicRing,
Source§const DIMENSION: usize = 1
const DIMENSION: usize = 1
Source§fn as_basis_coefficients_slice(&self) -> &[F]
fn as_basis_coefficients_slice(&self) -> &[F]
A and uses this to
map an element of A to a slice of DIMENSION F elements. Read moreSource§fn from_basis_coefficients_fn<Fn>(f: Fn) -> F
fn from_basis_coefficients_fn<Fn>(f: Fn) -> F
A and uses this to
map DIMENSION F elements to an element of A. Similar
to core:array::from_fn, the DIMENSION F elements are
given by Fn(0), ..., Fn(DIMENSION - 1) called in that order. Read moreSource§fn from_basis_coefficients_iter<I>(iter: I) -> Option<F>where
I: ExactSizeIterator<Item = F>,
fn from_basis_coefficients_iter<I>(iter: I) -> Option<F>where
I: ExactSizeIterator<Item = F>,
A and uses this to
map DIMENSION F elements to an element of A. Read moreSource§fn flatten_to_base(vec: Vec<F>) -> Vec<F>
fn flatten_to_base(vec: Vec<F>) -> Vec<F>
Source§fn reconstitute_from_base(vec: Vec<F>) -> Vec<F>
fn reconstitute_from_base(vec: Vec<F>) -> Vec<F>
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<F> ExtensionField<F> for Fwhere
F: Field,
impl<F> ExtensionField<F> for Fwhere
F: Field,
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> ⓘ
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> ⓘ
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 moreSource§impl<F> PackedField for Fwhere
F: Field,
impl<F> PackedField for Fwhere
F: Field,
type Scalar = F
Source§fn packed_powers(base: Self::Scalar) -> Powers<Self> ⓘ
fn packed_powers(base: Self::Scalar) -> Powers<Self> ⓘ
base packed into packed field elements. Read more