pub struct BinomialExtensionField<AF, const D: usize> { /* private fields */ }
Implementations§
Source§impl<AF: AbstractField> BinomialExtensionField<AF, 2>
impl<AF: AbstractField> BinomialExtensionField<AF, 2>
Convenience methods for complex extensions
pub const fn new(real: AF, imag: AF) -> Self
pub const fn new_real(real: AF) -> Self
pub const fn new_imag(imag: AF) -> Self
pub fn real(&self) -> AF
pub fn imag(&self) -> AF
pub fn conjugate(&self) -> Self
pub fn norm(&self) -> AF
pub fn to_array(&self) -> [AF; 2]
pub fn rotate<Ext: AbstractExtensionField<AF>>( &self, rhs: Complex<Ext>, ) -> Complex<Ext>
Trait Implementations§
Source§impl<AF, const D: usize> AbstractExtensionField<AF> for BinomialExtensionField<AF, D>
impl<AF, const D: usize> AbstractExtensionField<AF> for BinomialExtensionField<AF, D>
const D: usize = D
fn from_base(b: AF) -> Self
Source§fn from_base_slice(bs: &[AF]) -> Self
fn from_base_slice(bs: &[AF]) -> 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 takes a slice bs
of
length at exactly D, and constructs the field element
\sum_i bs[i] * X^i. Read moreSource§fn from_base_fn<F: FnMut(usize) -> AF>(f: F) -> Self
fn from_base_fn<F: FnMut(usize) -> AF>(f: F) -> Self
Similar to
core:array::from_fn
, with the same caveats as
from_base_slice
.fn from_base_iter<I: Iterator<Item = AF>>(iter: I) -> Self
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<AF, const D: usize> AbstractField for BinomialExtensionField<AF, D>
impl<AF, const D: usize> AbstractField for BinomialExtensionField<AF, D>
const ZERO: Self = _
const ONE: Self = _
const TWO: Self = _
const NEG_ONE: Self = _
type F = BinomialExtensionField<<AF as AbstractField>::F, D>
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
fn square(&self) -> 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 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: PackedField<Scalar = Self>>(&self) -> PackedPowers<Self, P> ⓘ
fn shifted_powers_packed<P: PackedField<Scalar = Self>>( &self, start: Self, ) -> PackedPowers<Self, P> ⓘ
fn dot_product<const N: usize>(u: &[Self; N], v: &[Self; N]) -> Self
fn try_div<Rhs>(self, rhs: Rhs) -> Option<<Self as Mul<Rhs>>::Output>
Source§impl<AF, const D: usize> Add<AF> for BinomialExtensionField<AF, D>
impl<AF, const D: usize> Add<AF> for BinomialExtensionField<AF, D>
Source§impl<AF, const D: usize> Add for BinomialExtensionField<AF, D>
impl<AF, const D: usize> Add for BinomialExtensionField<AF, D>
Source§impl<AF, const D: usize> AddAssign<AF> for BinomialExtensionField<AF, D>
impl<AF, const D: usize> AddAssign<AF> for BinomialExtensionField<AF, D>
Source§fn add_assign(&mut self, rhs: AF)
fn add_assign(&mut self, rhs: AF)
Performs the
+=
operation. Read moreSource§impl<AF, const D: usize> AddAssign for BinomialExtensionField<AF, D>
impl<AF, const D: usize> AddAssign for BinomialExtensionField<AF, D>
Source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
Performs the
+=
operation. Read moreSource§impl<AF: Clone, const D: usize> Clone for BinomialExtensionField<AF, D>
impl<AF: Clone, const D: usize> Clone for BinomialExtensionField<AF, D>
Source§fn clone(&self) -> BinomialExtensionField<AF, D>
fn clone(&self) -> BinomialExtensionField<AF, D>
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<AF: AbstractField, const D: usize> Default for BinomialExtensionField<AF, D>
impl<AF: AbstractField, const D: usize> Default for BinomialExtensionField<AF, D>
Source§impl<'de, AF, const D: usize> Deserialize<'de> for BinomialExtensionField<AF, D>where
AF: Deserialize<'de>,
impl<'de, AF, const D: usize> Deserialize<'de> for BinomialExtensionField<AF, D>where
AF: Deserialize<'de>,
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<F, const D: usize> Display for BinomialExtensionField<F, D>where
F: BinomiallyExtendable<D>,
impl<F, const D: usize> Display for BinomialExtensionField<F, D>where
F: BinomiallyExtendable<D>,
Source§impl<F: BinomiallyExtendable<D>, const D: usize> Distribution<BinomialExtensionField<F, D>> for Standardwhere
Standard: Distribution<F>,
impl<F: BinomiallyExtendable<D>, const D: usize> Distribution<BinomialExtensionField<F, D>> for Standardwhere
Standard: Distribution<F>,
Source§fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> BinomialExtensionField<F, D>
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> BinomialExtensionField<F, D>
Generate a random value of
T
, using rng
as the source of randomness.Source§fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
Create an iterator that generates random values of
T
, using rng
as
the source of randomness. Read moreSource§impl<F, const D: usize> Div for BinomialExtensionField<F, D>where
F: BinomiallyExtendable<D>,
impl<F, const D: usize> Div for BinomialExtensionField<F, D>where
F: BinomiallyExtendable<D>,
Source§impl<F, const D: usize> DivAssign for BinomialExtensionField<F, D>where
F: BinomiallyExtendable<D>,
impl<F, const D: usize> DivAssign for BinomialExtensionField<F, D>where
F: BinomiallyExtendable<D>,
Source§fn div_assign(&mut self, rhs: Self)
fn div_assign(&mut self, rhs: Self)
Performs the
/=
operation. Read moreSource§impl<F: BinomiallyExtendable<D>, const D: usize> ExtensionField<F> for BinomialExtensionField<F, D>
impl<F: BinomiallyExtendable<D>, const D: usize> ExtensionField<F> for BinomialExtensionField<F, D>
type ExtensionPacking = BinomialExtensionField<<F as Field>::Packing, D>
fn is_in_basefield(&self) -> bool
fn as_base(&self) -> Option<Base>
fn ext_powers_packed(&self) -> impl Iterator<Item = Self::ExtensionPacking>
Source§impl<F: BinomiallyExtendable<D>, const D: usize> Field for BinomialExtensionField<F, D>
impl<F: BinomiallyExtendable<D>, const D: usize> Field for BinomialExtensionField<F, D>
type Packing = BinomialExtensionField<F, D>
Source§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_zero(&self) -> bool
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
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 morefn 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<AF: AbstractField, const D: usize> From<AF> for BinomialExtensionField<AF, D>
impl<AF: AbstractField, const D: usize> From<AF> for BinomialExtensionField<AF, D>
Source§impl<F: BinomiallyExtendable<D>, const D: usize> HasFrobenius<F> for BinomialExtensionField<F, D>
impl<F: BinomiallyExtendable<D>, const D: usize> HasFrobenius<F> for BinomialExtensionField<F, D>
Source§fn frobenius(&self) -> Self
fn frobenius(&self) -> Self
FrobeniusField automorphisms: x -> x^n, where n is the order of BaseField.
Source§fn repeated_frobenius(&self, count: usize) -> Self
fn repeated_frobenius(&self, count: usize) -> Self
Repeated Frobenius automorphisms: x -> x^(n^count).
Follows precomputation suggestion in Section 11.3.3 of the Handbook of Elliptic and Hyperelliptic Curve Cryptography.
Source§fn frobenius_inv(&self) -> Self
fn frobenius_inv(&self) -> Self
Algorithm 11.3.4 in Handbook of Elliptic and Hyperelliptic Curve Cryptography.
fn minimal_poly(self) -> Vec<F>
fn galois_group(self) -> Vec<Self>
Source§impl<AF, const D: usize> Mul<AF> for BinomialExtensionField<AF, D>
impl<AF, const D: usize> Mul<AF> for BinomialExtensionField<AF, D>
Source§impl<AF, const D: usize> Mul for BinomialExtensionField<AF, D>
impl<AF, const D: usize> Mul for BinomialExtensionField<AF, D>
Source§impl<AF, const D: usize> MulAssign<AF> for BinomialExtensionField<AF, D>
impl<AF, const D: usize> MulAssign<AF> for BinomialExtensionField<AF, D>
Source§fn mul_assign(&mut self, rhs: AF)
fn mul_assign(&mut self, rhs: AF)
Performs the
*=
operation. Read moreSource§impl<AF, const D: usize> MulAssign for BinomialExtensionField<AF, D>
impl<AF, const D: usize> MulAssign for BinomialExtensionField<AF, D>
Source§fn mul_assign(&mut self, rhs: Self)
fn mul_assign(&mut self, rhs: Self)
Performs the
*=
operation. Read moreSource§impl<AF, const D: usize> Neg for BinomialExtensionField<AF, D>
impl<AF, const D: usize> Neg for BinomialExtensionField<AF, D>
Source§impl<AF: Ord, const D: usize> Ord for BinomialExtensionField<AF, D>
impl<AF: Ord, const D: usize> Ord for BinomialExtensionField<AF, D>
Source§fn cmp(&self, other: &BinomialExtensionField<AF, D>) -> Ordering
fn cmp(&self, other: &BinomialExtensionField<AF, D>) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<AF: PartialEq, const D: usize> PartialEq for BinomialExtensionField<AF, D>
impl<AF: PartialEq, const D: usize> PartialEq for BinomialExtensionField<AF, D>
Source§fn eq(&self, other: &BinomialExtensionField<AF, D>) -> bool
fn eq(&self, other: &BinomialExtensionField<AF, D>) -> bool
Tests for
self
and other
values to be equal, and is used by ==
.Source§impl<AF: PartialOrd, const D: usize> PartialOrd for BinomialExtensionField<AF, D>
impl<AF: PartialOrd, const D: usize> PartialOrd for BinomialExtensionField<AF, D>
Source§impl<AF, const D: usize> Product for BinomialExtensionField<AF, D>
impl<AF, const D: usize> Product for BinomialExtensionField<AF, D>
Source§impl<AF, const D: usize> Sub<AF> for BinomialExtensionField<AF, D>
impl<AF, const D: usize> Sub<AF> for BinomialExtensionField<AF, D>
Source§impl<AF, const D: usize> Sub for BinomialExtensionField<AF, D>
impl<AF, const D: usize> Sub for BinomialExtensionField<AF, D>
Source§impl<AF, const D: usize> SubAssign<AF> for BinomialExtensionField<AF, D>
impl<AF, const D: usize> SubAssign<AF> for BinomialExtensionField<AF, D>
Source§fn sub_assign(&mut self, rhs: AF)
fn sub_assign(&mut self, rhs: AF)
Performs the
-=
operation. Read moreSource§impl<AF, const D: usize> SubAssign for BinomialExtensionField<AF, D>
impl<AF, const D: usize> SubAssign for BinomialExtensionField<AF, D>
Source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
Performs the
-=
operation. Read moreSource§impl<AF, const D: usize> Sum for BinomialExtensionField<AF, D>
impl<AF, const D: usize> Sum for BinomialExtensionField<AF, D>
Source§impl<F: Field + HasTwoAdicBionmialExtension<D>, const D: usize> TwoAdicField for BinomialExtensionField<F, D>
impl<F: Field + HasTwoAdicBionmialExtension<D>, const D: usize> TwoAdicField for BinomialExtensionField<F, D>
Source§const TWO_ADICITY: usize = F::EXT_TWO_ADICITY
const TWO_ADICITY: usize = F::EXT_TWO_ADICITY
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<AF: Copy, const D: usize> Copy for BinomialExtensionField<AF, D>
impl<AF: Eq, const D: usize> Eq for BinomialExtensionField<AF, D>
impl<F: BinomiallyExtendable<D>, const D: usize> Packable for BinomialExtensionField<F, D>
impl<AF, const D: usize> StructuralPartialEq for BinomialExtensionField<AF, D>
Auto Trait Implementations§
impl<AF, const D: usize> Freeze for BinomialExtensionField<AF, D>where
AF: Freeze,
impl<AF, const D: usize> RefUnwindSafe for BinomialExtensionField<AF, D>where
AF: RefUnwindSafe,
impl<AF, const D: usize> Send for BinomialExtensionField<AF, D>where
AF: Send,
impl<AF, const D: usize> Sync for BinomialExtensionField<AF, D>where
AF: Sync,
impl<AF, const D: usize> Unpin for BinomialExtensionField<AF, D>where
AF: Unpin,
impl<AF, const D: usize> UnwindSafe for BinomialExtensionField<AF, D>where
AF: UnwindSafe,
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