mirror of
https://github.com/arnaucube/shockwave-plus.git
synced 2026-01-13 01:21:31 +01:00
chore: cleanup
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
mod polynomial;
|
||||
mod r1cs;
|
||||
mod sumcheck;
|
||||
mod utils;
|
||||
|
||||
use ark_std::{end_timer, start_timer};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
@@ -9,12 +9,14 @@ pub struct MlPoly<F> {
|
||||
}
|
||||
|
||||
impl<F: FieldExt> MlPoly<F> {
|
||||
#[allow(dead_code)]
|
||||
pub fn new(evals: Vec<F>) -> Self {
|
||||
assert!(evals.len().is_power_of_two());
|
||||
let num_vars = (evals.len() as f64).log2() as usize;
|
||||
Self { evals, num_vars }
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn dot_prod(x: &[F], y: &[F]) -> F {
|
||||
assert_eq!(x.len(), y.len());
|
||||
let mut result = F::ZERO;
|
||||
@@ -27,6 +29,7 @@ impl<F: FieldExt> MlPoly<F> {
|
||||
// Evaluate the multilinear extension of the polynomial `a`, at point `t`.
|
||||
// `a` is in evaluation form.
|
||||
// `t` should be in big-endian form.
|
||||
#[allow(dead_code)]
|
||||
pub fn eval(&self, t: &[F]) -> F {
|
||||
let n = self.evals.len();
|
||||
debug_assert_eq!((n as f64).log2() as usize, t.len());
|
||||
|
||||
@@ -256,12 +256,29 @@ mod tests {
|
||||
|
||||
use halo2curves::ff::Field;
|
||||
|
||||
use crate::utils::boolean_hypercube;
|
||||
|
||||
use super::*;
|
||||
type F = halo2curves::secp256k1::Fp;
|
||||
use crate::polynomial::ml_poly::MlPoly;
|
||||
|
||||
// Returns a vector of vectors of length m, where each vector is a boolean vector (big endian)
|
||||
fn boolean_hypercube<F: FieldExt>(m: usize) -> Vec<Vec<F>> {
|
||||
let n = 2usize.pow(m as u32);
|
||||
|
||||
let mut boolean_hypercube = Vec::<Vec<F>>::with_capacity(n);
|
||||
|
||||
for i in 0..n {
|
||||
let mut tmp = Vec::with_capacity(m);
|
||||
for j in 0..m {
|
||||
let i_b = F::from((i >> j & 1) as u64);
|
||||
tmp.push(i_b);
|
||||
}
|
||||
tmp.reverse();
|
||||
boolean_hypercube.push(tmp);
|
||||
}
|
||||
|
||||
boolean_hypercube
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_r1cs() {
|
||||
let num_cons = 10;
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
use crate::FieldExt;
|
||||
|
||||
// Returns a vector of vectors of length m, where each vector is a boolean vector (big endian)
|
||||
pub fn boolean_hypercube<F: FieldExt>(m: usize) -> Vec<Vec<F>> {
|
||||
let n = 2usize.pow(m as u32);
|
||||
|
||||
let mut boolean_hypercube = Vec::<Vec<F>>::with_capacity(n);
|
||||
|
||||
for i in 0..n {
|
||||
let mut tmp = Vec::with_capacity(m);
|
||||
for j in 0..m {
|
||||
let i_b = F::from((i >> j & 1) as u64);
|
||||
tmp.push(i_b);
|
||||
}
|
||||
tmp.reverse();
|
||||
boolean_hypercube.push(tmp);
|
||||
}
|
||||
|
||||
boolean_hypercube
|
||||
}
|
||||
Reference in New Issue
Block a user