Don't precompute deltaomega; inline its computation.

This commit is contained in:
Sean Bowe 2020-09-05 14:44:13 -06:00
parent 937861c0b8
commit 965362c1f5
No known key found for this signature in database
GPG key ID: 95684257D8F8B031
3 changed files with 6 additions and 10 deletions

View file

@ -29,7 +29,6 @@ use domain::EvaluationDomain;
#[derive(Debug)] #[derive(Debug)]
pub struct SRS<C: CurveAffine> { pub struct SRS<C: CurveAffine> {
domain: EvaluationDomain<C::Scalar>, domain: EvaluationDomain<C::Scalar>,
deltaomega: Vec<Vec<C::Scalar>>,
l0: Vec<C::Scalar>, l0: Vec<C::Scalar>,
fixed_commitments: Vec<C>, fixed_commitments: Vec<C>,
fixed_polys: Vec<Vec<C::Scalar>>, fixed_polys: Vec<Vec<C::Scalar>>,

View file

@ -170,25 +170,23 @@ impl<C: CurveAffine> Proof<C> {
// Iterate over each wire again, this time finishing the computation // Iterate over each wire again, this time finishing the computation
// of the entire fraction by computing the numerators // of the entire fraction by computing the numerators
for ((wire, modified_advice), deltaomega) in wires let mut deltaomega = C::Scalar::one();
.iter() for (wire, modified_advice) in wires.iter().zip(modified_advice.iter_mut()) {
.zip(modified_advice.iter_mut())
.zip(srs.deltaomega.iter())
{
// For each row i, we compute // For each row i, we compute
// p_j(\omega^i) + \delta^j \omega^i \beta + \gamma // p_j(\omega^i) + \delta^j \omega^i \beta + \gamma
// for the jth wire of the permutation // for the jth wire of the permutation
for ((advice_value, modified_advice), deltaomega) in witness.advice[wire.0] for (advice_value, modified_advice) in witness.advice[wire.0]
.iter_mut() .iter_mut()
.zip(modified_advice.iter_mut()) .zip(modified_advice.iter_mut())
.zip(deltaomega.iter())
{ {
let mut tmp = *deltaomega; // \delta^j \omega^i let mut tmp = deltaomega; // \delta^j \omega^i
tmp *= &x_0; // \delta^j \omega^i \beta tmp *= &x_0; // \delta^j \omega^i \beta
tmp += &x_1; // \delta^j \omega^i \beta + \gamma tmp += &x_1; // \delta^j \omega^i \beta + \gamma
tmp += advice_value; // p_j(\omega^i) + \delta^j \omega^i \beta + \gamma tmp += advice_value; // p_j(\omega^i) + \delta^j \omega^i \beta + \gamma
*modified_advice *= &tmp; *modified_advice *= &tmp;
deltaomega *= &domain.get_omega();
} }
deltaomega *= &C::Scalar::DELTA;
} }
// The modified_advice vector is a vector of vectors of fractions of // The modified_advice vector is a vector of vectors of fractions of

View file

@ -243,7 +243,6 @@ impl<C: CurveAffine> SRS<C> {
Ok(SRS { Ok(SRS {
domain, domain,
deltaomega,
l0, l0,
fixed_commitments, fixed_commitments,
fixed_polys, fixed_polys,