mirror of
https://github.com/arnaucube/sonobe.git
synced 2026-01-23 20:43:52 +01:00
Circuit compute_c reduce constraints (#97)
* migrate from CurveGroup to PrimeField in hypernova & ccs when curve whas not needed to simplify the code * refactor test of compute_c circuit to use multiple lcccs&cccs instances * refactor hypernova's compute_c circuit to reduce from `110635` to `553` constraints * apply review nits * fix clippy lints after rust-toolchain v1.76.0
This commit is contained in:
@@ -140,7 +140,6 @@ impl<C: CurveGroup> SumCheckVerifier<C> for IOPVerifierState<C> {
|
||||
let eval_at_zero: C::ScalarField = poly.coeffs[0];
|
||||
let eval = eval_at_one + eval_at_zero;
|
||||
|
||||
println!("evaluations: {:?}, expected: {:?}", eval, expected);
|
||||
// the deferred check during the interactive phase:
|
||||
// 1. check if the received 'P(0) + P(1) = expected`.
|
||||
if eval != expected {
|
||||
|
||||
@@ -34,26 +34,26 @@ pub fn matrix_to_mle<F: PrimeField>(matrix: SparseMatrix<F>) -> DenseMultilinear
|
||||
}
|
||||
|
||||
/// Takes the n_vars and a dense vector and returns its dense MLE.
|
||||
pub fn vec_to_mle<F: PrimeField>(n_vars: usize, v: &Vec<F>) -> DenseMultilinearExtension<F> {
|
||||
pub fn vec_to_mle<F: PrimeField>(n_vars: usize, v: &[F]) -> DenseMultilinearExtension<F> {
|
||||
let v_padded: Vec<F> = if v.len() != (1 << n_vars) {
|
||||
// pad to 2^n_vars
|
||||
[
|
||||
v.clone(),
|
||||
v.to_owned(),
|
||||
std::iter::repeat(F::zero())
|
||||
.take((1 << n_vars) - v.len())
|
||||
.collect(),
|
||||
]
|
||||
.concat()
|
||||
} else {
|
||||
v.clone()
|
||||
v.to_owned()
|
||||
};
|
||||
DenseMultilinearExtension::<F>::from_evaluations_vec(n_vars, v_padded)
|
||||
}
|
||||
|
||||
pub fn dense_vec_to_mle<F: PrimeField>(n_vars: usize, v: &Vec<F>) -> DenseMultilinearExtension<F> {
|
||||
pub fn dense_vec_to_mle<F: PrimeField>(n_vars: usize, v: &[F]) -> DenseMultilinearExtension<F> {
|
||||
// Pad to 2^n_vars
|
||||
let v_padded: Vec<F> = [
|
||||
v.clone(),
|
||||
v.to_owned(),
|
||||
std::iter::repeat(F::zero())
|
||||
.take((1 << n_vars) - v.len())
|
||||
.collect(),
|
||||
|
||||
@@ -79,7 +79,7 @@ pub fn is_zero_vec<F: PrimeField>(vec: &[F]) -> bool {
|
||||
vec.iter().all(|a| a.is_zero())
|
||||
}
|
||||
|
||||
pub fn mat_vec_mul<F: PrimeField>(M: &Vec<Vec<F>>, z: &[F]) -> Result<Vec<F>, Error> {
|
||||
pub fn mat_vec_mul<F: PrimeField>(M: &[Vec<F>], z: &[F]) -> Result<Vec<F>, Error> {
|
||||
if M.is_empty() {
|
||||
return Err(Error::Empty);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user