pub fn alloc<CS>(mut cs: CS, coords: Option<(Fp, Fp, bool)>) -> Result<Self, SynthesisError>
  where
    CS: ConstraintSystem<Fp>,
  {
    let x = AllocatedNum::alloc(cs.namespace(|| "x"), || {
      Ok(coords.map_or(Fp::zero(), |c| c.0))
    })?;
    let y = AllocatedNum::alloc(cs.namespace(|| "y"), || {
      Ok(coords.map_or(Fp::zero(), |c| c.1))
    })?;
    let is_infinity = AllocatedNum::alloc(cs.namespace(|| "is_infinity"), || {
      Ok(if coords.map_or(true, |c| c.2) {
        Fp::one()
      } else {
        Fp::zero()
      })
    })?;
    cs.enforce(
      || "is_infinity is bit",
      |lc| lc + is_infinity.get_variable(),
      |lc| lc + CS::one() - is_infinity.get_variable(),
      |lc| lc,
    );

    Ok(AllocatedPoint { x, y, is_infinity })
  }
/// Allocates a new point on the curve using coordinates provided by `coords`.
/// If coords = None, it allocates the default infinity point
Allocates a new point on the curve using coordinates provided by `coords`.
If coords = None, it allocates the default infinity point
Allocates a new point on the curve using coordinates provided by ` coords ` . If coords = None it allocates the default infinity point
pub fn alloc<CS>(mut cs: CS, coords: Option<(Fp, Fp, bool)>) -> Result<Self, SynthesisError>
  where
    CS: ConstraintSystem<Fp>,
  {
    let x = AllocatedNum::alloc(cs.namespace(|| "x"), || {
      Ok(coords.map_or(Fp::zero(), |c| c.0))
    })?;
    let y = AllocatedNum::alloc(cs.namespace(|| "y"), || {
      Ok(coords.map_or(Fp::zero(), |c| c.1))
    })?;
    let is_infinity = AllocatedNum::alloc(cs.namespace(|| "is_infinity"), || {
      Ok(if coords.map_or(true, |c| c.2) {
        Fp::one()
      } else {
        Fp::zero()
      })
    })?;
    cs.enforce(
      || "is_infinity is bit",
      |lc| lc + is_infinity.get_variable(),
      |lc| lc + CS::one() - is_infinity.get_variable(),
      |lc| lc,
    );
    Ok(AllocatedPoint { x, y, is_infinity })
  }
pub fn alloc < CS > ( mut cs : CS , coords : Option < ( Fp , Fp , bool ) > ) -> Result < Self , SynthesisError > where CS : ConstraintSystem < Fp > , { let x = AllocatedNum :: alloc ( cs . namespace ( | | " " ) , | | { Ok ( coords . map_or ( Fp :: zero ( ) , | c | c . 0 ) ) } ) ? ; let y = AllocatedNum :: alloc ( cs . namespace ( | | " " ) , | | { Ok ( coords . map_or ( Fp :: zero ( ) , | c | c . 1 ) ) } ) ? ; let is_infinity = AllocatedNum :: alloc ( cs . namespace ( | | " " ) , | | { Ok ( if coords . map_or ( true , | c | c . 2 ) { Fp :: one ( ) } else { Fp :: zero ( ) } ) } ) ? ; cs . enforce ( | | " " , | lc | lc + is_infinity . get_variable ( ) , | lc | lc + CS :: one ( ) - is_infinity . get_variable ( ) , | lc | lc , ) ; Ok ( AllocatedPoint { x , y , is_infinity } ) }
Allocates a new point on the curve using coordinates provided by `coords`.
Allocates a new point on the curve using coordinates provided by ` coords ` .
cs
CS
coords
Option<(Fp, Fp, bool)>
cs
CS
coords
Option<(Fp, Fp, bool)>