Struct snarkvm_algorithms::fft::domain::EvaluationDomain
source · 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.
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: PartialEq + FftField> PartialEq for EvaluationDomain<F>
impl<F: PartialEq + FftField> PartialEq for EvaluationDomain<F>
source§fn eq(&self, other: &EvaluationDomain<F>) -> bool
fn eq(&self, other: &EvaluationDomain<F>) -> bool
self
and other
values to be equal, and is used
by ==
.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> 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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.