pub struct AllocatedNum<E: Engine> { /* private fields */ }Implementations§
Source§impl<E: Engine> AllocatedNum<E>
impl<E: Engine> AllocatedNum<E>
pub fn alloc<CS, F>(cs: CS, value: F) -> Result<Self, SynthesisError>
pub fn inputize<CS>(&self, cs: CS) -> Result<(), SynthesisError>where
CS: ConstraintSystem<E>,
Sourcepub fn into_bits_le_strict<CS>(
&self,
cs: CS,
) -> Result<Vec<Boolean>, SynthesisError>where
CS: ConstraintSystem<E>,
pub fn into_bits_le_strict<CS>(
&self,
cs: CS,
) -> Result<Vec<Boolean>, SynthesisError>where
CS: ConstraintSystem<E>,
Deconstructs this allocated number into its boolean representation in little-endian bit order, requiring that the representation strictly exists “in the field” (i.e., a congruency is not allowed.)
Sourcepub fn into_bits_le<CS>(&self, cs: CS) -> Result<Vec<Boolean>, SynthesisError>where
CS: ConstraintSystem<E>,
pub fn into_bits_le<CS>(&self, cs: CS) -> Result<Vec<Boolean>, SynthesisError>where
CS: ConstraintSystem<E>,
Convert the allocated number into its little-endian representation. Note that this does not strongly enforce that the commitment is “in the field.”
pub fn mul<CS>(&self, cs: CS, other: &Self) -> Result<Self, SynthesisError>where
CS: ConstraintSystem<E>,
pub fn square<CS>(&self, cs: CS) -> Result<Self, SynthesisError>where
CS: ConstraintSystem<E>,
pub fn assert_nonzero<CS>(&self, cs: CS) -> Result<(), SynthesisError>where
CS: ConstraintSystem<E>,
pub fn assert_zero<CS>(&self, cs: CS) -> Result<(), SynthesisError>where
CS: ConstraintSystem<E>,
Sourcepub fn conditionally_reverse<CS>(
cs: CS,
a: &Self,
b: &Self,
condition: &Boolean,
) -> Result<(Self, Self), SynthesisError>where
CS: ConstraintSystem<E>,
pub fn conditionally_reverse<CS>(
cs: CS,
a: &Self,
b: &Self,
condition: &Boolean,
) -> Result<(Self, Self), SynthesisError>where
CS: ConstraintSystem<E>,
Takes two allocated numbers (a, b) and returns (b, a) if the condition is true, and (a, b) otherwise.
Sourcepub fn conditionally_select<CS>(
cs: CS,
a: &Self,
b: &Self,
condition: &Boolean,
) -> Result<Self, SynthesisError>where
CS: ConstraintSystem<E>,
pub fn conditionally_select<CS>(
cs: CS,
a: &Self,
b: &Self,
condition: &Boolean,
) -> Result<Self, SynthesisError>where
CS: ConstraintSystem<E>,
Takes two allocated numbers (a, b) and returns a if the condition is true, and b otherwise. Most often to be used with b = 0
Sourcepub fn limit_number_of_bits<CS>(
&self,
cs: CS,
number_of_bits: usize,
) -> Result<(), SynthesisError>where
CS: ConstraintSystem<E>,
pub fn limit_number_of_bits<CS>(
&self,
cs: CS,
number_of_bits: usize,
) -> Result<(), SynthesisError>where
CS: ConstraintSystem<E>,
Limits number of bits. The easiest example when required is to add or subtract two “small” (with bit length smaller than one of the field) numbers and check for overflow
Sourcepub fn equals<CS>(cs: CS, a: &Self, b: &Self) -> Result<Boolean, SynthesisError>where
E: Engine,
CS: ConstraintSystem<E>,
pub fn equals<CS>(cs: CS, a: &Self, b: &Self) -> Result<Boolean, SynthesisError>where
E: Engine,
CS: ConstraintSystem<E>,
Takes two allocated numbers (a, b) and returns
allocated boolean variable with value true
if the a and b are equal, false otherwise.