Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
tcoratger committed Nov 26, 2024
1 parent 1d9cbcf commit 7a3f208
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 15 deletions.
16 changes: 15 additions & 1 deletion poly/src/evaluations/multivariate/multilinear/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,21 @@ type DefaultHasher = fnv::FnvHasher;
/// Index represents a point, which is a vector in {0,1}^`num_vars` in little
/// endian form. For example, `0b1011` represents `P(1,1,0,1)`
pub trait MultilinearExtension<F: Field>:
Sized + Clone + Debug + Hash + PartialEq + Eq + Add + Neg + Zero + CanonicalSerialize + CanonicalDeserialize + for<'a> AddAssign<&'a Self> + for<'a> SubAssign<&'a Self> + Index<usize> + Polynomial<F, Point = Vec<F>>
Sized
+ Clone
+ Debug
+ Hash
+ PartialEq
+ Eq
+ Add
+ Neg
+ Zero
+ CanonicalSerialize
+ CanonicalDeserialize
+ for<'a> AddAssign<&'a Self>
+ for<'a> SubAssign<&'a Self>
+ Index<usize>
+ Polynomial<F, Point = Vec<F>>
{
/// Returns the number of variables in `self`
fn num_vars(&self) -> usize;
Expand Down
12 changes: 3 additions & 9 deletions poly/src/evaluations/univariate/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,7 @@ impl<'a, F: FftField, D: EvaluationDomain<F>> Mul<&'a Evaluations<F, D>> for &Ev
}
}

impl<'a, F: FftField, D: EvaluationDomain<F>> MulAssign<&'a Self>
for Evaluations<F, D>
{
impl<'a, F: FftField, D: EvaluationDomain<F>> MulAssign<&'a Self> for Evaluations<F, D> {
#[inline]
fn mul_assign(&mut self, other: &'a Self) {
assert_eq!(self.domain, other.domain, "domains are unequal");
Expand Down Expand Up @@ -109,9 +107,7 @@ impl<'a, F: FftField, D: EvaluationDomain<F>> Add<&'a Evaluations<F, D>> for &Ev
}
}

impl<'a, F: FftField, D: EvaluationDomain<F>> AddAssign<&'a Self>
for Evaluations<F, D>
{
impl<'a, F: FftField, D: EvaluationDomain<F>> AddAssign<&'a Self> for Evaluations<F, D> {
#[inline]
fn add_assign(&mut self, other: &'a Self) {
assert_eq!(self.domain, other.domain, "domains are unequal");
Expand All @@ -132,9 +128,7 @@ impl<'a, F: FftField, D: EvaluationDomain<F>> Sub<&'a Evaluations<F, D>> for &Ev
}
}

impl<'a, F: FftField, D: EvaluationDomain<F>> SubAssign<&'a Self>
for Evaluations<F, D>
{
impl<'a, F: FftField, D: EvaluationDomain<F>> SubAssign<&'a Self> for Evaluations<F, D> {
#[inline]
fn sub_assign(&mut self, other: &'a Self) {
assert_eq!(self.domain, other.domain, "domains are unequal");
Expand Down
14 changes: 13 additions & 1 deletion poly/src/polynomial/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,19 @@ pub mod univariate;

/// Describes the common interface for univariate and multivariate polynomials
pub trait Polynomial<F: Field>:
Sized + Clone + Debug + Hash + PartialEq + Eq + Add + Neg + Zero + CanonicalSerialize + CanonicalDeserialize + for<'a> AddAssign<&'a Self> + for<'a> SubAssign<&'a Self>
Sized
+ Clone
+ Debug
+ Hash
+ PartialEq
+ Eq
+ Add
+ Neg
+ Zero
+ CanonicalSerialize
+ CanonicalDeserialize
+ for<'a> AddAssign<&'a Self>
+ for<'a> SubAssign<&'a Self>
{
/// The type of evaluation points for this polynomial.
type Point: Sized + Clone + Ord + Debug + Sync + Hash;
Expand Down
5 changes: 1 addition & 4 deletions poly/src/polynomial/univariate/dense.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,7 @@ impl<F: FftField> DensePolynomial<F> {

/// Divide `self` by the vanishing polynomial for the domain `domain`.
/// Returns the quotient and remainder of the division.
pub fn divide_by_vanishing_poly<D: EvaluationDomain<F>>(
&self,
domain: D,
) -> (Self, Self) {
pub fn divide_by_vanishing_poly<D: EvaluationDomain<F>>(&self, domain: D) -> (Self, Self) {
let domain_size = domain.size();

if self.coeffs.len() < domain_size {
Expand Down

0 comments on commit 7a3f208

Please sign in to comment.