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
Inverse of the multiplicative generator of the finite field.
Implementations§
Source§impl<F: FftField> EvaluationDomain<F>
impl<F: FftField> EvaluationDomain<F>
Sourcepub fn sample_element_outside_domain<R: Rng>(&self, rng: &mut R) -> F
pub fn sample_element_outside_domain<R: Rng>(&self, rng: &mut R) -> F
Sample an element that is not in the domain.
Sourcepub fn new(num_coeffs: usize) -> Option<Self>
pub fn new(num_coeffs: usize) -> Option<Self>
Construct a domain that is large enough for evaluations of a polynomial
having num_coeffs
coefficients.
Sourcepub fn compute_size_of_domain(num_coeffs: usize) -> Option<usize>
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.
Sourcepub fn fft<T: DomainCoeff<F>>(&self, coeffs: &[T]) -> Vec<T>
pub fn fft<T: DomainCoeff<F>>(&self, coeffs: &[T]) -> Vec<T>
Compute an FFT.
Sourcepub fn fft_in_place<T: DomainCoeff<F>>(&self, coeffs: &mut Vec<T>)
pub fn fft_in_place<T: DomainCoeff<F>>(&self, coeffs: &mut Vec<T>)
Compute an FFT, modifying the vector in place.
Sourcepub fn ifft<T: DomainCoeff<F>>(&self, evals: &[T]) -> Vec<T>
pub fn ifft<T: DomainCoeff<F>>(&self, evals: &[T]) -> Vec<T>
Compute an IFFT.
Sourcepub fn ifft_in_place<T: DomainCoeff<F>>(&self, evals: &mut Vec<T>)
pub fn ifft_in_place<T: DomainCoeff<F>>(&self, evals: &mut Vec<T>)
Compute an IFFT, modifying the vector in place.
Sourcepub fn coset_fft<T: DomainCoeff<F>>(&self, coeffs: &[T]) -> Vec<T>
pub fn coset_fft<T: DomainCoeff<F>>(&self, coeffs: &[T]) -> Vec<T>
Compute an FFT over a coset of the domain.
Sourcepub fn coset_fft_in_place<T: DomainCoeff<F>>(&self, coeffs: &mut Vec<T>)
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.
Sourcepub fn coset_ifft<T: DomainCoeff<F>>(&self, evals: &[T]) -> Vec<T>
pub fn coset_ifft<T: DomainCoeff<F>>(&self, evals: &[T]) -> Vec<T>
Compute an IFFT over a coset of the domain.
Sourcepub fn coset_ifft_in_place<T: DomainCoeff<F>>(&self, evals: &mut Vec<T>)
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.
Sourcepub fn evaluate_all_lagrange_coefficients(&self, tau: F) -> Vec<F>
pub fn evaluate_all_lagrange_coefficients(&self, tau: F) -> Vec<F>
Evaluate all the lagrange polynomials defined by this domain at the point
tau
.
Sourcepub fn vanishing_polynomial(&self) -> SparsePolynomial<F>
pub fn vanishing_polynomial(&self) -> SparsePolynomial<F>
Return the sparse vanishing polynomial.
Sourcepub fn evaluate_vanishing_polynomial(&self, tau: F) -> F
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
.
Sourcepub fn divide_by_vanishing_poly_on_coset_in_place(&self, evals: &mut [F])
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.
Sourcepub fn reindex_by_subdomain(&self, other: &Self, index: usize) -> Result<usize>
pub fn reindex_by_subdomain(&self, other: &Self, index: usize) -> Result<usize>
Given an index in the other
subdomain, return an index into this domain self
This assumes the other
’s elements are also self
’s first elements
Source§impl<F: FftField> EvaluationDomain<F>
impl<F: FftField> EvaluationDomain<F>
pub fn precompute_fft(&self) -> FFTPrecomputation<F>
pub fn precompute_ifft(&self) -> IFFTPrecomputation<F>
pub fn in_order_fft_with_pc<T: DomainCoeff<F>>( &self, x_s: &[T], pc: &FFTPrecomputation<F>, ) -> Vec<T>
Sourcepub fn roots_of_unity(&self, root: F) -> Vec<F>
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>
impl<F: FftField> CanonicalDeserialize for EvaluationDomain<F>
fn deserialize_with_mode<R: Read>( reader: R, compress: Compress, validate: Validate, ) -> Result<Self, SerializationError>
fn deserialize_compressed<R>(reader: R) -> Result<Self, SerializationError>where
R: Read,
fn deserialize_compressed_unchecked<R>(
reader: R,
) -> Result<Self, SerializationError>where
R: Read,
fn deserialize_uncompressed<R>(reader: R) -> Result<Self, SerializationError>where
R: Read,
fn deserialize_uncompressed_unchecked<R>(
reader: R,
) -> Result<Self, SerializationError>where
R: Read,
Source§impl<F: FftField> CanonicalSerialize for EvaluationDomain<F>
impl<F: FftField> CanonicalSerialize for EvaluationDomain<F>
fn serialize_with_mode<W: Write>( &self, writer: W, compress: Compress, ) -> Result<(), SerializationError>
fn serialized_size(&self, compress: Compress) -> usize
fn serialize_compressed<W>(&self, writer: W) -> Result<(), SerializationError>where
W: Write,
fn compressed_size(&self) -> usize
fn serialize_uncompressed<W>(&self, writer: W) -> Result<(), SerializationError>where
W: Write,
fn uncompressed_size(&self) -> usize
Source§impl<F: Clone + FftField> Clone for EvaluationDomain<F>
impl<F: Clone + FftField> Clone for EvaluationDomain<F>
Source§fn clone(&self) -> EvaluationDomain<F>
fn clone(&self) -> EvaluationDomain<F>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<F: FftField> Debug for EvaluationDomain<F>
impl<F: FftField> Debug for EvaluationDomain<F>
Source§impl<F: FftField> Valid for EvaluationDomain<F>
impl<F: FftField> Valid for EvaluationDomain<F>
fn check(&self) -> Result<(), SerializationError>
fn batch_check<'a>(
batch: impl Iterator<Item = &'a Self> + Send,
) -> Result<(), SerializationError>where
Self: 'a,
impl<F: Copy + FftField> Copy for EvaluationDomain<F>
impl<F: Eq + FftField> Eq for EvaluationDomain<F>
impl<F: FftField> StructuralPartialEq for EvaluationDomain<F>
Auto Trait Implementations§
impl<F> Freeze for EvaluationDomain<F>where
F: Freeze,
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> 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,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.