1pub mod mle;
2pub mod univariate;
3pub mod utils;
4pub mod zero_degree;
5
6use thiserror::Error;
7
8pub trait Polynomial<C>: Clone {
11 const DEGREE_BOUND: usize;
12}
13
14pub trait EvaluatablePolynomial<C, Out>: Polynomial<C> {
15 type EvaluationPoint: ?Sized;
19
20 fn evaluate_at_point(&self, point: &Self::EvaluationPoint) -> Result<Out, EvaluationError>;
22}
23
24pub trait ConstCoeffBitWidth {
25 const COEFF_BIT_WIDTH: usize;
26}
27
28#[derive(Clone, Debug, PartialEq, Error)]
29pub enum EvaluationError {
30 #[error("Wrong number of points provided for evaluation: expected {expected}, got {actual}")]
31 WrongPointWidth { expected: usize, actual: usize },
32 #[error("Evaluation failed due to overflow")]
33 Overflow,
34 #[error("Empty polynomials are not allowed to be evaluate")]
35 EmptyPolynomial,
36 #[error("Unsupported constraint degrees: {degrees:?}")]
37 UnsupportedConstraintDegrees { degrees: Vec<usize> },
38}