pub struct EvaluationDomain<F: FftField> {
    pub size: u64,
    pub log_size_of_group: u32,
    pub size_as_field_element: F,
    pub size_inv: F,
    pub group_gen: F,
    pub group_gen_inv: F,
    pub generator_inv: F,
}
Expand description

Defines a domain over which finite field (I)FFTs can be performed. Works only for fields that have a large multiplicative subgroup of size that is a power-of-2.

Fields§

§size: u64

The size of the domain.

§log_size_of_group: u32

log_2(self.size).

§size_as_field_element: F

Size of the domain as a field element.

§size_inv: F

Inverse of the size in the field.

§group_gen: F

A generator of the subgroup.

§group_gen_inv: F

Inverse of the generator of the subgroup.

§generator_inv: F

Multiplicative generator of the finite field.

Implementations§

source§

impl<F: FftField> EvaluationDomain<F>

source

pub fn sample_element_outside_domain<R: Rng>(&self, rng: &mut R) -> F

Sample an element that is not in the domain.

source

pub fn new(num_coeffs: usize) -> Option<Self>

Construct a domain that is large enough for evaluations of a polynomial having num_coeffs coefficients.

source

pub fn compute_size_of_domain(num_coeffs: usize) -> Option<usize>

Return the size of a domain that is large enough for evaluations of a polynomial having num_coeffs coefficients.

source

pub fn size(&self) -> usize

Return the size of self.

source

pub fn fft<T: DomainCoeff<F>>(&self, coeffs: &[T]) -> Vec<T>

Compute an FFT.

source

pub fn fft_in_place<T: DomainCoeff<F>>(&self, coeffs: &mut Vec<T>)

Compute an FFT, modifying the vector in place.

source

pub fn ifft<T: DomainCoeff<F>>(&self, evals: &[T]) -> Vec<T>

Compute an IFFT.

source

pub fn ifft_in_place<T: DomainCoeff<F>>(&self, evals: &mut Vec<T>)

Compute an IFFT, modifying the vector in place.

source

pub fn coset_fft<T: DomainCoeff<F>>(&self, coeffs: &[T]) -> Vec<T>

Compute an FFT over a coset of the domain.

source

pub fn coset_fft_in_place<T: DomainCoeff<F>>(&self, coeffs: &mut Vec<T>)

Compute an FFT over a coset of the domain, modifying the input vector in place.

source

pub fn coset_ifft<T: DomainCoeff<F>>(&self, evals: &[T]) -> Vec<T>

Compute an IFFT over a coset of the domain.

source

pub fn coset_ifft_in_place<T: DomainCoeff<F>>(&self, evals: &mut Vec<T>)

Compute an IFFT over a coset of the domain, modifying the input vector in place.

source

pub fn evaluate_all_lagrange_coefficients(&self, tau: F) -> Vec<F>

Evaluate all the lagrange polynomials defined by this domain at the point tau.

source

pub fn vanishing_polynomial(&self) -> SparsePolynomial<F>

Return the sparse vanishing polynomial.

source

pub fn evaluate_vanishing_polynomial(&self, tau: F) -> F

This evaluates the vanishing polynomial for this domain at tau. For multiplicative subgroups, this polynomial is z(X) = X^self.size - 1.

source

pub fn elements(&self) -> Elements<F>

Return an iterator over the elements of the domain.

source

pub fn divide_by_vanishing_poly_on_coset_in_place(&self, evals: &mut [F])

The target polynomial is the zero polynomial in our evaluation domain, so we must perform division over a coset.

source

pub fn reindex_by_subdomain(&self, other: &Self, index: usize) -> usize

Given an index which assumes the first elements of this domain are the elements of another (sub)domain with size size_s, this returns the actual index into this domain.

source

pub fn mul_polynomials_in_evaluation_domain( &self, self_evals: Vec<F>, other_evals: &[F] ) -> Vec<F>

Perform O(n) multiplication of two polynomials that are presented by their evaluations in the domain. Returns the evaluations of the product over the domain.

source§

impl<F: FftField> EvaluationDomain<F>

source

pub fn precompute_fft(&self) -> FFTPrecomputation<F>

source

pub fn precompute_ifft(&self) -> IFFTPrecomputation<F>

source

pub fn in_order_fft_with_pc<T: DomainCoeff<F>>( &self, x_s: &[T], pc: &FFTPrecomputation<F> ) -> Vec<T>

source

pub fn roots_of_unity(&self, root: F) -> Vec<F>

Computes the first self.size / 2 roots of unity.

Trait Implementations§

source§

impl<F: FftField> CanonicalDeserialize for EvaluationDomain<F>

source§

impl<F: FftField> CanonicalSerialize for EvaluationDomain<F>

source§

impl<F: Clone + FftField> Clone for EvaluationDomain<F>

source§

fn clone(&self) -> EvaluationDomain<F>

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<F: FftField> Debug for EvaluationDomain<F>

source§

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

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

impl<F: Hash + FftField> Hash for EvaluationDomain<F>

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<F: PartialEq + FftField> PartialEq<EvaluationDomain<F>> for EvaluationDomain<F>

source§

fn eq(&self, other: &EvaluationDomain<F>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<F: PrimeField> SelectorPolynomial<F> for EvaluationDomain<F>

source§

fn evaluate_selector_polynomial( &self, other: EvaluationDomain<F>, point: F ) -> F

source§

impl<F: PrimeField> UnnormalizedBivariateLagrangePoly<F> for EvaluationDomain<F>

source§

fn eval_unnormalized_bivariate_lagrange_poly(&self, x: F, y: F) -> F

Evaluate the polynomial
source§

fn batch_eval_unnormalized_bivariate_lagrange_poly_with_diff_inputs_over_domain( &self, x: F, domain: &EvaluationDomain<F> ) -> Vec<F>

source§

fn batch_eval_unnormalized_bivariate_lagrange_poly_with_diff_inputs( &self, x: F ) -> Vec<F>

Evaluate over a batch of inputs
source§

fn batch_eval_unnormalized_bivariate_lagrange_poly_with_same_inputs( &self ) -> Vec<F>

Evaluate the magic polynomial over self
source§

impl<F: FftField> Valid for EvaluationDomain<F>

source§

fn check(&self) -> Result<(), SerializationError>

source§

fn batch_check<'a>( batch: impl Iterator<Item = &'a Self> + Send ) -> Result<(), SerializationError>where Self: 'a,

source§

impl<F: Copy + FftField> Copy for EvaluationDomain<F>

source§

impl<F: Eq + FftField> Eq for EvaluationDomain<F>

source§

impl<F: FftField> StructuralEq for EvaluationDomain<F>

source§

impl<F: FftField> StructuralPartialEq for EvaluationDomain<F>

Auto Trait Implementations§

§

impl<F> RefUnwindSafe for EvaluationDomain<F>where F: RefUnwindSafe,

§

impl<F> Send for EvaluationDomain<F>

§

impl<F> Sync for EvaluationDomain<F>

§

impl<F> Unpin for EvaluationDomain<F>where F: Unpin,

§

impl<F> UnwindSafe for EvaluationDomain<F>where F: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V