Type Alias Complex

Source
pub type Complex<FA> = BinomialExtensionField<FA, 2>;

Aliased Type§

struct Complex<FA> { /* private fields */ }

Implementations§

Source§

impl<FA: FieldAlgebra> Complex<FA>

Convenience methods for complex extensions

Source

pub const fn new(real: FA, imag: FA) -> Self

Source

pub const fn new_real(real: FA) -> Self

Source

pub const fn new_imag(imag: FA) -> Self

Source

pub fn real(&self) -> FA

Source

pub fn imag(&self) -> FA

Source

pub fn conjugate(&self) -> Self

Source

pub fn norm(&self) -> FA

Source

pub fn to_array(&self) -> [FA; 2]

Source

pub fn rotate<Ext: FieldExtensionAlgebra<FA>>( &self, rhs: Complex<Ext>, ) -> Complex<Ext>

Trait Implementations§

Source§

impl<F, const D: usize> BinomiallyExtendable<D> for Complex<F>

Source§

const W: Self

Source§

const DTH_ROOT: Self

Source§

const EXT_GENERATOR: [Self; D] = F::EXT_GENERATOR

Source§

impl<F, const D: usize> HasTwoAdicBinomialExtension<D> for Complex<F>

Source§

const EXT_TWO_ADICITY: usize = F::COMPLEX_EXT_TWO_ADICITY

Source§

fn ext_two_adic_generator(bits: usize) -> [Self; D]

Assumes the multiplicative group size has at least bits powers of two, otherwise the behavior is undefined.
Source§

impl<FA, const D: usize> Add<FA> for BinomialExtensionField<FA, D>
where FA: FieldAlgebra, FA::F: BinomiallyExtendable<D>,

Source§

type Output = BinomialExtensionField<FA, D>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: FA) -> Self

Performs the + operation. Read more
Source§

impl<FA, const D: usize> Add for BinomialExtensionField<FA, D>
where FA: FieldAlgebra, FA::F: BinomiallyExtendable<D>,

Source§

type Output = BinomialExtensionField<FA, D>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Self) -> Self

Performs the + operation. Read more
Source§

impl<FA, const D: usize> AddAssign<FA> for BinomialExtensionField<FA, D>
where FA: FieldAlgebra, FA::F: BinomiallyExtendable<D>,

Source§

fn add_assign(&mut self, rhs: FA)

Performs the += operation. Read more
Source§

impl<FA, const D: usize> AddAssign for BinomialExtensionField<FA, D>
where FA: FieldAlgebra, FA::F: BinomiallyExtendable<D>,

Source§

fn add_assign(&mut self, rhs: Self)

Performs the += operation. Read more
Source§

impl<FA: Clone, const D: usize> Clone for BinomialExtensionField<FA, D>

Source§

fn clone(&self) -> BinomialExtensionField<FA, D>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<FA: Debug, const D: usize> Debug for BinomialExtensionField<FA, D>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<FA: FieldAlgebra, const D: usize> Default for BinomialExtensionField<FA, D>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de, FA, const D: usize> Deserialize<'de> for BinomialExtensionField<FA, D>
where FA: Deserialize<'de>,

Source§

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>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<F, const D: usize> Div for BinomialExtensionField<F, D>

Source§

type Output = BinomialExtensionField<F, D>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Self) -> Self::Output

Performs the / operation. Read more
Source§

impl<F, const D: usize> DivAssign for BinomialExtensionField<F, D>

Source§

fn div_assign(&mut self, rhs: Self)

Performs the /= operation. Read more
Source§

impl<F: BinomiallyExtendable<D>, const D: usize> ExtensionField<F> for BinomialExtensionField<F, D>

Source§

type ExtensionPacking = BinomialExtensionField<<F as Field>::Packing, D>

Source§

fn is_in_basefield(&self) -> bool

Source§

fn as_base(&self) -> Option<Base>

Source§

fn ext_powers_packed(&self) -> Powers<Self::ExtensionPacking>

Construct an iterator which returns powers of self packed into ExtensionPacking elements. Read more
Source§

impl<F: BinomiallyExtendable<D>, const D: usize> Field for BinomialExtensionField<F, D>

Source§

const GENERATOR: Self

A generator of this field’s entire multiplicative group.
Source§

type Packing = BinomialExtensionField<F, D>

Source§

fn try_inverse(&self) -> Option<Self>

The multiplicative inverse of this field element, if it exists. Read more
Source§

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.
Source§

fn order() -> BigUint

Source§

fn is_zero(&self) -> bool

Source§

fn is_one(&self) -> bool

Source§

fn div_2exp_u64(&self, exp: u64) -> Self

self / 2^exp
Source§

fn exp_u64_generic<FA: FieldAlgebra<F = Self>>(val: FA, power: u64) -> FA

Exponentiation by a u64 power. This is similar to exp_u64, but more general in that it can be used with FieldAlgebras, not just this concrete field. Read more
Source§

fn inverse(&self) -> Self

Source§

fn multiplicative_group_factors() -> Vec<(BigUint, usize)>

A list of (factor, exponent) pairs.
Source§

fn bits() -> usize

Source§

impl<FA, const D: usize> FieldAlgebra for BinomialExtensionField<FA, D>
where FA: FieldAlgebra, FA::F: BinomiallyExtendable<D>,

Source§

const ZERO: Self

The additive identity of the algebra. Read more
Source§

const ONE: Self

The multiplicative identity of the Algebra Read more
Source§

const TWO: Self

The element in the algebra given by ONE + ONE. Read more
Source§

const NEG_ONE: Self

The element in the algebra given by -ONE. Read more
Source§

type F = BinomialExtensionField<<FA as FieldAlgebra>::F, D>

Source§

fn from_f(f: Self::F) -> Self

Interpret a field element as a commutative algebra element. Read more
Source§

fn from_canonical_u8(n: u8) -> Self

Convert from a canonical u8. Read more
Source§

fn from_canonical_u16(n: u16) -> Self

Convert from a canonical u16. Read more
Source§

fn from_canonical_u32(n: u32) -> Self

Convert from a canonical u32. Read more
Source§

fn from_canonical_u64(n: u64) -> Self

Convert from a canonical u64. Read more
Source§

fn from_canonical_usize(n: usize) -> Self

Convert from a canonical usize. Read more
Source§

fn from_wrapped_u32(n: u32) -> Self

Source§

fn from_wrapped_u64(n: u64) -> Self

Source§

fn square(&self) -> Self

The elementary function square(a) = a^2. Read more
Source§

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 more
Source§

fn from_bool(b: bool) -> Self

Convert from a bool.
Source§

fn double(&self) -> Self

The elementary function double(a) = 2*a. Read more
Source§

fn cube(&self) -> Self

The elementary function cube(a) = a^3. Read more
Source§

fn exp_u64(&self, power: u64) -> Self

Exponentiation by a u64 power. Read more
Source§

fn exp_const_u64<const POWER: u64>(&self) -> Self

Exponentiation by a constant power. Read more
Source§

fn exp_power_of_2(&self, power_log: usize) -> Self

Compute self^{2^power_log} by repeated squaring.
Source§

fn mul_2exp_u64(&self, exp: u64) -> Self

self * 2^exp
Source§

fn powers(&self) -> Powers<Self>

Construct an iterator which returns powers of self: self^0, self^1, self^2, ....
Source§

fn shifted_powers(&self, start: Self) -> Powers<Self>

Construct an iterator which returns powers of self shifted by start: start, start*self^1, start*self^2, ....
Source§

fn powers_packed<P: PackedField<Scalar = Self>>(&self) -> Powers<P>

Construct an iterator which returns powers of self packed into PackedField elements. Read more
Source§

fn shifted_powers_packed<P: PackedField<Scalar = Self>>( &self, start: Self, ) -> Powers<P>

Construct an iterator which returns powers of self shifted by start and packed into PackedField elements. Read more
Source§

fn dot_product<const N: usize>(u: &[Self; N], v: &[Self; N]) -> Self

Compute the dot product of two vectors.
Source§

impl<FA, const D: usize> FieldExtensionAlgebra<FA> for BinomialExtensionField<FA, D>
where FA: FieldAlgebra, FA::F: BinomiallyExtendable<D>,

Source§

const D: usize = D

Source§

fn from_base(b: FA) -> Self

Source§

fn from_base_slice(bs: &[FA]) -> 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 more
Source§

fn from_base_fn<F: FnMut(usize) -> FA>(f: F) -> Self

Similar to core:array::from_fn, with the same caveats as from_base_slice.
Source§

fn from_base_iter<I: Iterator<Item = FA>>(iter: I) -> Self

Source§

fn as_base_slice(&self) -> &[FA]

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 more
Source§

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 more
Source§

impl<FA: FieldAlgebra, const D: usize> From<FA> for BinomialExtensionField<FA, D>

Source§

fn from(x: FA) -> Self

Converts to this type from the input type.
Source§

impl<F: BinomiallyExtendable<D>, const D: usize> HasFrobenius<F> for BinomialExtensionField<F, D>

Source§

fn frobenius(&self) -> Self

FrobeniusField automorphisms: x -> x^n, where n is the order of BaseField.

Source§

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

Algorithm 11.3.4 in Handbook of Elliptic and Hyperelliptic Curve Cryptography.

Source§

fn minimal_poly(self) -> Vec<F>

Source§

fn galois_group(self) -> Vec<Self>

Source§

impl<FA: Hash, const D: usize> Hash for BinomialExtensionField<FA, D>

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<FA, const D: usize> Mul<FA> for BinomialExtensionField<FA, D>
where FA: FieldAlgebra, FA::F: BinomiallyExtendable<D>,

Source§

type Output = BinomialExtensionField<FA, D>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: FA) -> Self

Performs the * operation. Read more
Source§

impl<FA, const D: usize> Mul for BinomialExtensionField<FA, D>
where FA: FieldAlgebra, FA::F: BinomiallyExtendable<D>,

Source§

type Output = BinomialExtensionField<FA, D>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Self) -> Self

Performs the * operation. Read more
Source§

impl<FA, const D: usize> MulAssign<FA> for BinomialExtensionField<FA, D>
where FA: FieldAlgebra, FA::F: BinomiallyExtendable<D>,

Source§

fn mul_assign(&mut self, rhs: FA)

Performs the *= operation. Read more
Source§

impl<FA, const D: usize> MulAssign for BinomialExtensionField<FA, D>
where FA: FieldAlgebra, FA::F: BinomiallyExtendable<D>,

Source§

fn mul_assign(&mut self, rhs: Self)

Performs the *= operation. Read more
Source§

impl<FA, const D: usize> Neg for BinomialExtensionField<FA, D>
where FA: FieldAlgebra, FA::F: BinomiallyExtendable<D>,

Source§

type Output = BinomialExtensionField<FA, D>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self

Performs the unary - operation. Read more
Source§

impl<FA: Ord, const D: usize> Ord for BinomialExtensionField<FA, D>

Source§

fn cmp(&self, other: &BinomialExtensionField<FA, D>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<FA: PartialEq, const D: usize> PartialEq for BinomialExtensionField<FA, D>

Source§

fn eq(&self, other: &BinomialExtensionField<FA, D>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<FA: PartialOrd, const D: usize> PartialOrd for BinomialExtensionField<FA, D>

Source§

fn partial_cmp(&self, other: &BinomialExtensionField<FA, D>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<FA, const D: usize> Product for BinomialExtensionField<FA, D>
where FA: FieldAlgebra, FA::F: BinomiallyExtendable<D>,

Source§

fn product<I: Iterator<Item = Self>>(iter: I) -> Self

Takes an iterator and generates Self from the elements by multiplying the items.
Source§

impl<FA, const D: usize> Serialize for BinomialExtensionField<FA, D>
where FA: Serialize,

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<FA, const D: usize> Sub<FA> for BinomialExtensionField<FA, D>
where FA: FieldAlgebra, FA::F: BinomiallyExtendable<D>,

Source§

type Output = BinomialExtensionField<FA, D>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: FA) -> Self

Performs the - operation. Read more
Source§

impl<FA, const D: usize> Sub for BinomialExtensionField<FA, D>
where FA: FieldAlgebra, FA::F: BinomiallyExtendable<D>,

Source§

type Output = BinomialExtensionField<FA, D>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Self) -> Self

Performs the - operation. Read more
Source§

impl<FA, const D: usize> SubAssign<FA> for BinomialExtensionField<FA, D>
where FA: FieldAlgebra, FA::F: BinomiallyExtendable<D>,

Source§

fn sub_assign(&mut self, rhs: FA)

Performs the -= operation. Read more
Source§

impl<FA, const D: usize> SubAssign for BinomialExtensionField<FA, D>
where FA: FieldAlgebra, FA::F: BinomiallyExtendable<D>,

Source§

fn sub_assign(&mut self, rhs: Self)

Performs the -= operation. Read more
Source§

impl<FA, const D: usize> Sum for BinomialExtensionField<FA, D>
where FA: FieldAlgebra, FA::F: BinomiallyExtendable<D>,

Source§

fn sum<I: Iterator<Item = Self>>(iter: I) -> Self

Takes an iterator and generates Self from the elements by “summing up” the items.
Source§

impl<F: Field + HasTwoAdicBinomialExtension<D>, const D: usize> TwoAdicField for BinomialExtensionField<F, D>

Source§

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

Returns a generator of the multiplicative group of order 2^bits. Assumes bits <= TWO_ADICITY, otherwise the result is undefined.
Source§

impl<FA: Copy, const D: usize> Copy for BinomialExtensionField<FA, D>

Source§

impl<FA: Eq, const D: usize> Eq for BinomialExtensionField<FA, D>

Source§

impl<F: BinomiallyExtendable<D>, const D: usize> Packable for BinomialExtensionField<F, D>

Source§

impl<FA, const D: usize> StructuralPartialEq for BinomialExtensionField<FA, D>