pub fn fold(
    &self,
    U2: &R1CSInstance<G>,
    comm_T: &Commitment<G>,
    r: &G::Scalar,
  ) -> Result<RelaxedR1CSInstance<G>, NovaError> {
    let (X1, u1, comm_W_1, comm_E_1) =
      (&self.X, &self.u, &self.comm_W.clone(), &self.comm_E.clone());
    let (X2, comm_W_2) = (&U2.X, &U2.comm_W);

    // weighted sum of X, comm_W, comm_E, and u
    let X = X1
      .par_iter()
      .zip(X2)
      .map(|(a, b)| *a + *r * *b)
      .collect::<Vec<G::Scalar>>();
    let comm_W = comm_W_1 + comm_W_2 * r;
    let comm_E = *comm_E_1 + *comm_T * *r;
    let u = *u1 + *r;

    Ok(RelaxedR1CSInstance {
      comm_W,
      comm_E,
      X,
      u,
    })
  }
/// Folds an incoming RelaxedR1CSInstance into the current one
Folds an incoming RelaxedR1CSInstance into the current one
Folds an incoming RelaxedR1CSInstance into the current one
pub fn fold(
    &self,
    U2: &R1CSInstance<G>,
    comm_T: &Commitment<G>,
    r: &G::Scalar,
  ) -> Result<RelaxedR1CSInstance<G>, NovaError> {
    let (X1, u1, comm_W_1, comm_E_1) =
      (&self.X, &self.u, &self.comm_W.clone(), &self.comm_E.clone());
    let (X2, comm_W_2) = (&U2.X, &U2.comm_W);
    // weighted sum of X, comm_W, comm_E, and u
    let X = X1
      .par_iter()
      .zip(X2)
      .map(|(a, b)| *a + *r * *b)
      .collect::<Vec<G::Scalar>>();
    let comm_W = comm_W_1 + comm_W_2 * r;
    let comm_E = *comm_E_1 + *comm_T * *r;
    let u = *u1 + *r;
    Ok(RelaxedR1CSInstance {
      comm_W,
      comm_E,
      X,
      u,
    })
  }
pub fn fold ( & self , U2 : & R1CSInstance < G > , comm_T : & Commitment < G > , r : & G :: Scalar , ) -> Result < RelaxedR1CSInstance < G > , NovaError > { let ( X1 , u1 , comm_W_1 , comm_E_1 ) = ( & self . X , & self . u , & self . comm_W . clone ( ) , & self . comm_E . clone ( ) ) ; let ( X2 , comm_W_2 ) = ( & U2 . X , & U2 . comm_W ) ; // weighted sum of X, comm_W, comm_E, and u let X = X1 . par_iter ( ) . zip ( X2 ) . map ( | ( a , b ) | * a + * r * * b ) . collect :: < Vec < G :: Scalar > > ( ) ; let comm_W = comm_W_1 + comm_W_2 * r ; let comm_E = * comm_E_1 + * comm_T * * r ; let u = * u1 + * r ; Ok ( RelaxedR1CSInstance { comm_W , comm_E , X , u , } ) }
Folds an incoming RelaxedR1CSInstance into the current one
Folds an incoming RelaxedR1CSInstance into the current one
&self
U2
&R1CSInstance<G>
comm_T
&Commitment<G>
r
&G::Scalar
&self
U2
&R1CSInstance<G>
comm_T
&Commitment<G>
r
&G::Scalar