snarkvm_algorithms/fft/
mod.rs

1// Copyright 2024 Aleo Network Foundation
2// This file is part of the snarkVM library.
3
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at:
7
8// http://www.apache.org/licenses/LICENSE-2.0
9
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15
16//! This crate implements functions for manipulating polynomials over finite fields,
17//! including FFTs.
18
19pub mod domain;
20pub use domain::EvaluationDomain;
21
22pub mod evaluations;
23pub use evaluations::Evaluations;
24
25pub mod polynomial;
26pub use polynomial::{DensePolynomial, Polynomial, SparsePolynomial};
27
28#[cfg(test)]
29mod tests;
30
31use snarkvm_fields::FftField;
32
33/// Types that can be FFT-ed must implement this trait.
34pub trait DomainCoeff<F: FftField>:
35    Copy
36    + Send
37    + Sync
38    + core::ops::Add<Output = Self>
39    + core::ops::Sub<Output = Self>
40    + core::ops::AddAssign
41    + core::ops::SubAssign
42    + snarkvm_fields::Zero
43    + core::ops::MulAssign<F>
44{
45}
46
47impl<T, F> DomainCoeff<F> for T
48where
49    F: FftField,
50    T: Copy
51        + Send
52        + Sync
53        + snarkvm_fields::Zero
54        + core::ops::AddAssign
55        + core::ops::SubAssign
56        + core::ops::MulAssign<F>
57        + core::ops::Add<Output = Self>
58        + core::ops::Sub<Output = Self>,
59{
60}