pub fn scalar_mul<CS: ConstraintSystem<Fp>>(
    &self,
    mut cs: CS,
    scalar: Vec<AllocatedBit>,
  ) -> Result<Self, SynthesisError> {
    let mut res = Self::default(cs.namespace(|| "res"))?;
    for i in (0..scalar.len()).rev() {
      /*************************************************************/
      //  res = res.double();
      /*************************************************************/

      res = res.double(cs.namespace(|| format!("{}: double", i)))?;

      /*************************************************************/
      //  if scalar[i] {
      //    res = self.add(&res);
      //  }
      /*************************************************************/

      let self_and_res = self.add(cs.namespace(|| format!("{}: add", i)), &res)?;
      res = Self::conditionally_select(
        cs.namespace(|| format!("{}: Update res", i)),
        &self_and_res,
        &res,
        &Boolean::from(scalar[i].clone()),
      )?;
    }
    Ok(res)
  }
/// A gadget for scalar multiplication.
A gadget for scalar multiplication.
A gadget for scalar multiplication .
pub fn scalar_mul<CS: ConstraintSystem<Fp>>(
    &self,
    mut cs: CS,
    scalar: Vec<AllocatedBit>,
  ) -> Result<Self, SynthesisError> {
    let mut res = Self::default(cs.namespace(|| "res"))?;
    for i in (0..scalar.len()).rev() {
      /*************************************************************/
      //  res = res.double();
      /*************************************************************/
      res = res.double(cs.namespace(|| format!("{}: double", i)))?;
      /*************************************************************/
      //  if scalar[i] {
      //    res = self.add(&res);
      //  }
      /*************************************************************/
      let self_and_res = self.add(cs.namespace(|| format!("{}: add", i)), &res)?;
      res = Self::conditionally_select(
        cs.namespace(|| format!("{}: Update res", i)),
        &self_and_res,
        &res,
        &Boolean::from(scalar[i].clone()),
      )?;
    }
    Ok(res)
  }
pub fn scalar_mul < CS : ConstraintSystem < Fp > > ( & self , mut cs : CS , scalar : Vec < AllocatedBit > , ) -> Result < Self , SynthesisError > { let mut res = Self :: default ( cs . namespace ( | | " " ) ) ? ; for i in ( 0 .. scalar . len ( ) ) . rev ( ) { /*************************************************************/ //  res = res.double(); /*************************************************************/ res = res . double ( cs . namespace ( | | format ! ( " " i ) ) ) ? ; /*************************************************************/ //  if scalar[i] { //    res = self.add(&res); //  } /*************************************************************/ let self_and_res = self . add ( cs . namespace ( | | format ! ( " " i ) ) , & res ) ? ; res = Self :: conditionally_select ( cs . namespace ( | | format ! ( " " i ) ) , & self_and_res , & res , & Boolean :: from ( scalar [ i ] . clone ( ) ) , ) ? ; } Ok ( res ) }
A gadget for scalar multiplication.
A gadget for scalar multiplication .
&self
cs
CS
scalar
Vec<AllocatedBit>
&self
cs
CS
scalar
Vec<AllocatedBit>