pub fn alloc<CS: ConstraintSystem<<G as Group>::Base>>(
    mut cs: CS,
    inst: Option<RelaxedR1CSInstance<G>>,
    limb_width: usize,
    n_limbs: usize,
  ) -> Result<Self, SynthesisError> {
    let W = AllocatedPoint::alloc(
      cs.namespace(|| "allocate W"),
      inst
        .get()
        .map_or(None, |inst| Some(inst.comm_W.comm.to_coordinates())),
    )?;

    let E = AllocatedPoint::alloc(
      cs.namespace(|| "allocate E"),
      inst
        .get()
        .map_or(None, |inst| Some(inst.comm_E.comm.to_coordinates())),
    )?;

    // u << |G::Base| despite the fact that u is a scalar.
    // So we parse all of its bytes as a G::Base element
    let u = alloc_scalar_as_base::<G, _>(
      cs.namespace(|| "allocate u"),
      inst.get().map_or(None, |inst| Some(inst.u)),
    )?;

    // Allocate X0 and X1. If the input instance is None, then allocate default values 0.
    let X0 = BigNat::alloc_from_nat(
      cs.namespace(|| "allocate X[0]"),
      || {
        Ok(f_to_nat(
          &inst.clone().map_or(G::Scalar::zero(), |inst| inst.X[0]),
        ))
      },
      limb_width,
      n_limbs,
    )?;

    let X1 = BigNat::alloc_from_nat(
      cs.namespace(|| "allocate X[1]"),
      || {
        Ok(f_to_nat(
          &inst.clone().map_or(G::Scalar::zero(), |inst| inst.X[1]),
        ))
      },
      limb_width,
      n_limbs,
    )?;

    Ok(AllocatedRelaxedR1CSInstance { W, E, u, X0, X1 })
  }
/// Allocates the given RelaxedR1CSInstance as a witness of the circuit
Allocates the given RelaxedR1CSInstance as a witness of the circuit
Allocates the given RelaxedR1CSInstance as a witness of the circuit
pub fn alloc<CS: ConstraintSystem<<G as Group>::Base>>(
    mut cs: CS,
    inst: Option<RelaxedR1CSInstance<G>>,
    limb_width: usize,
    n_limbs: usize,
  ) -> Result<Self, SynthesisError> {
    let W = AllocatedPoint::alloc(
      cs.namespace(|| "allocate W"),
      inst
        .get()
        .map_or(None, |inst| Some(inst.comm_W.comm.to_coordinates())),
    )?;
    let E = AllocatedPoint::alloc(
      cs.namespace(|| "allocate E"),
      inst
        .get()
        .map_or(None, |inst| Some(inst.comm_E.comm.to_coordinates())),
    )?;
    // u << |G::Base| despite the fact that u is a scalar.
    // So we parse all of its bytes as a G::Base element
    let u = alloc_scalar_as_base::<G, _>(
      cs.namespace(|| "allocate u"),
      inst.get().map_or(None, |inst| Some(inst.u)),
    )?;
    // Allocate X0 and X1. If the input instance is None, then allocate default values 0.
    let X0 = BigNat::alloc_from_nat(
      cs.namespace(|| "allocate X[0]"),
      || {
        Ok(f_to_nat(
          &inst.clone().map_or(G::Scalar::zero(), |inst| inst.X[0]),
        ))
      },
      limb_width,
      n_limbs,
    )?;
    let X1 = BigNat::alloc_from_nat(
      cs.namespace(|| "allocate X[1]"),
      || {
        Ok(f_to_nat(
          &inst.clone().map_or(G::Scalar::zero(), |inst| inst.X[1]),
        ))
      },
      limb_width,
      n_limbs,
    )?;
    Ok(AllocatedRelaxedR1CSInstance { W, E, u, X0, X1 })
  }
pub fn alloc < CS : ConstraintSystem < < G as Group > :: Base > > ( mut cs : CS , inst : Option < RelaxedR1CSInstance < G > > , limb_width : usize , n_limbs : usize , ) -> Result < Self , SynthesisError > { let W = AllocatedPoint :: alloc ( cs . namespace ( | | " " ) , inst . get ( ) . map_or ( None , | inst | Some ( inst . comm_W . comm . to_coordinates ( ) ) ) , ) ? ; let E = AllocatedPoint :: alloc ( cs . namespace ( | | " " ) , inst . get ( ) . map_or ( None , | inst | Some ( inst . comm_E . comm . to_coordinates ( ) ) ) , ) ? ; // u << |G::Base| despite the fact that u is a scalar. // So we parse all of its bytes as a G::Base element let u = alloc_scalar_as_base :: < G , _ > ( cs . namespace ( | | " " ) , inst . get ( ) . map_or ( None , | inst | Some ( inst . u ) ) , ) ? ; // Allocate X0 and X1. If the input instance is None, then allocate default values 0. let X0 = BigNat :: alloc_from_nat ( cs . namespace ( | | " " ) , | | { Ok ( f_to_nat ( & inst . clone ( ) . map_or ( G :: Scalar :: zero ( ) , | inst | inst . X [ 0 ] ) , ) ) } , limb_width , n_limbs , ) ? ; let X1 = BigNat :: alloc_from_nat ( cs . namespace ( | | " " ) , | | { Ok ( f_to_nat ( & inst . clone ( ) . map_or ( G :: Scalar :: zero ( ) , | inst | inst . X [ 1 ] ) , ) ) } , limb_width , n_limbs , ) ? ; Ok ( AllocatedRelaxedR1CSInstance { W , E , u , X0 , X1 } ) }
Allocates the given RelaxedR1CSInstance as a witness of the circuit
Allocates the given RelaxedR1CSInstance as a witness of the circuit
cs
CS
inst
Option<RelaxedR1CSInstance<G>>
limb_width
usize
n_limbs
usize
cs
CS
inst
Option<RelaxedR1CSInstance<G>>
limb_width
usize
n_limbs
usize