/// Take a `Num` that should be input, if the conditional value equals 1. If the selection value
/// equals 0 , the input is set to one (since it does not lie in this Jubjub curve).
Take a `Num` that should be input, if the conditional value equals 1. If the selection value
equals 0 , the input is set to one (since it does not lie in this Jubjub curve).
Take a ` Num ` that should be input if the conditional value equals 1 . If the selection value equals 0 the input is set to one ( since it does not lie in this Jubjub curve ) .
pub fn conditional_inputise<Scalar: PrimeField, CS: ConstraintSystem<Scalar>>(
    mut cs: CS,
    num: &AllocatedNum<Scalar>,
    conditional_bit: &AllocatedBit,
) -> Result<(), SynthesisError> {
    let input = cs.alloc_input(
        || "input",
        || match conditional_bit.get_value().get()? {
            true => num.get_value().get().map(|x| *x),
            false => Ok(Scalar::one()),
        },
    )?;
    cs.enforce(
        || "selection constraint",
        |lc| lc + num.get_variable() - CS::one(),
        |lc| lc + conditional_bit.get_variable(),
        |lc| lc + input - CS::one(),
    );
    Ok(())
}
pub fn conditional_inputise < Scalar : PrimeField , CS : ConstraintSystem < Scalar > > ( mut cs : CS , num : & AllocatedNum < Scalar > , conditional_bit : & AllocatedBit , ) -> Result < ( ) , SynthesisError > { let input = cs . alloc_input ( | | " " , | | match conditional_bit . get_value ( ) . get ( ) ? { true => num . get_value ( ) . get ( ) . map ( | x | * x ) , false => Ok ( Scalar :: one ( ) ) , } , ) ? ; cs . enforce ( | | " " , | lc | lc + num . get_variable ( ) - CS :: one ( ) , | lc | lc + conditional_bit . get_variable ( ) , | lc | lc + input - CS :: one ( ) , ) ; Ok ( ( ) ) }
Take a `Num` that should be input, if the conditional value equals 1.
Take a ` Num ` that should be input if the conditional value equals 1 .
cs
CS
num
&AllocatedNum<Scalar>
conditional_bit
&AllocatedBit