Skip to content

Commit

Permalink
Merge pull request #2541 from o1-labs/tests/mvpoly-generic-trait
Browse files Browse the repository at this point in the history
MVPoly tests generalization based on example.
  • Loading branch information
dannywillems authored Sep 9, 2024
2 parents 590ec1b + 465ef3b commit 1a72f3f
Show file tree
Hide file tree
Showing 6 changed files with 473 additions and 438 deletions.
4 changes: 4 additions & 0 deletions mvpoly/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use kimchi::circuits::expr::{ConstantExpr, Expr};
use rand::RngCore;

pub mod monomials;
pub mod pbt;
pub mod prime;
pub mod utils;

Expand All @@ -17,6 +18,7 @@ pub trait MVPoly<F: PrimeField, const N: usize, const D: usize>:
+ ark_ff::One
+ ark_ff::Zero
+ std::fmt::Debug
+ Clone
// Comparison operators
+ PartialEq
+ Eq
Expand Down Expand Up @@ -106,4 +108,6 @@ pub trait MVPoly<F: PrimeField, const N: usize, const D: usize>:
u1: F,
u2: F,
) -> HashMap<usize, F>;

fn modify_monomial_with_scalar(&mut self, scalar: F);
}
4 changes: 4 additions & 0 deletions mvpoly/src/monomials.rs
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,10 @@ impl<const N: usize, const D: usize, F: PrimeField> MVPoly<F, N, D> for Sparse<F
});
cross_terms_by_powers_of_r
}

fn modify_monomial_with_scalar(&mut self, scalar: F) {
self.modify_monomial([0; N], scalar);
}
}

impl<const N: usize, const D: usize, F: PrimeField> From<prime::Dense<F, N, D>>
Expand Down
Loading

0 comments on commit 1a72f3f

Please sign in to comment.