pub struct AllocatedNum<E: Engine> { /* private fields */ }
Implementations§
Source§impl<E: Engine> AllocatedNum<E>
impl<E: Engine> AllocatedNum<E>
pub fn get_variable(&self) -> Variable
pub fn get_value(&self) -> Option<E::Fr>
pub fn alloc<CS, F>(cs: &mut CS, value: F) -> Result<Self, SynthesisError>
pub fn alloc_input<CS, F>(cs: &mut CS, value: F) -> Result<Self, SynthesisError>
pub fn from_boolean_is(boolean: Boolean) -> Self
pub fn alloc_cnst<CS>(cs: &mut CS, fr: E::Fr) -> Result<Self, SynthesisError>where
CS: ConstraintSystem<E>,
pub fn inputize<CS: ConstraintSystem<E>>( &self, cs: &mut CS, ) -> Result<(), SynthesisError>
pub fn one<CS: ConstraintSystem<E>>(cs: &mut CS) -> Self
pub fn zero<CS: ConstraintSystem<E>>(cs: &mut CS) -> Self
pub fn enforce_equal<CS>(
&self,
cs: &mut CS,
other: &Self,
) -> Result<(), SynthesisError>where
CS: ConstraintSystem<E>,
pub fn inverse<CS: ConstraintSystem<E>>( &self, cs: &mut CS, ) -> Result<Self, SynthesisError>
pub fn assert_not_zero<CS>(&self, cs: &mut CS) -> Result<(), SynthesisError>where
CS: ConstraintSystem<E>,
pub fn assert_is_zero<CS>(&self, cs: &mut CS) -> Result<(), SynthesisError>where
CS: ConstraintSystem<E>,
pub fn assert_equal_to_constant<CS>(
&self,
cs: &mut CS,
constant: E::Fr,
) -> Result<(), SynthesisError>where
CS: ConstraintSystem<E>,
pub fn is_zero<CS>(&self, cs: &mut CS) -> Result<Boolean, SynthesisError>where
CS: ConstraintSystem<E>,
Sourcepub fn conditionally_reverse<CS>(
cs: &mut CS,
a: &Self,
b: &Self,
condition: &Boolean,
) -> Result<(Self, Self), SynthesisError>where
CS: ConstraintSystem<E>,
pub fn conditionally_reverse<CS>(
cs: &mut 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.
pub fn equals<CS: ConstraintSystem<E>>( cs: &mut CS, a: &Self, b: &Self, ) -> Result<Boolean, SynthesisError>
pub fn add<CS>(&self, cs: &mut CS, other: &Self) -> Result<Self, SynthesisError>where
CS: ConstraintSystem<E>,
pub fn sub<CS>(&self, cs: &mut CS, other: &Self) -> Result<Self, SynthesisError>where
CS: ConstraintSystem<E>,
pub fn add_constant<CS>(
&self,
cs: &mut CS,
constant: E::Fr,
) -> Result<Self, SynthesisError>where
CS: ConstraintSystem<E>,
pub fn sub_constant<CS>(
&self,
cs: &mut CS,
constant: E::Fr,
) -> Result<Self, SynthesisError>where
CS: ConstraintSystem<E>,
pub fn fma<CS: ConstraintSystem<E>>( &self, cs: &mut CS, b: Self, c: Self, ) -> Result<Self, SynthesisError>
pub fn fma_with_coefficients<CS: ConstraintSystem<E>>( &self, cs: &mut CS, b: (E::Fr, Self), c: (E::Fr, Self), ) -> Result<Self, SynthesisError>
pub fn mask_by_boolean_into_accumulator<CS: ConstraintSystem<E>>( &self, cs: &mut CS, boolean: &Boolean, accumulator: &Self, ) -> Result<Self, SynthesisError>
pub fn add_two<CS: ConstraintSystem<E>>( &self, cs: &mut CS, x: Self, y: Self, ) -> Result<Self, SynthesisError>
pub fn mul_constant<CS>(
&self,
cs: &mut CS,
constant: E::Fr,
) -> Result<Self, SynthesisError>where
CS: ConstraintSystem<E>,
pub fn mul<CS>(&self, cs: &mut CS, other: &Self) -> Result<Self, SynthesisError>where
CS: ConstraintSystem<E>,
pub fn square<CS>(&self, cs: &mut CS) -> Result<Self, SynthesisError>where
CS: ConstraintSystem<E>,
Sourcepub fn conditionally_select<CS>(
cs: &mut CS,
a: &Self,
b: &Self,
condition: &Boolean,
) -> Result<Self, SynthesisError>where
CS: ConstraintSystem<E>,
pub fn conditionally_select<CS>(
cs: &mut 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 mask<CS>(
cs: &mut CS,
a: &Self,
condition: &Boolean,
) -> Result<Self, SynthesisError>where
CS: ConstraintSystem<E>,
pub fn mask<CS>(
cs: &mut CS,
a: &Self,
condition: &Boolean,
) -> Result<Self, SynthesisError>where
CS: ConstraintSystem<E>,
Masks a value with a Boolean
pub fn div<CS>(&self, cs: &mut CS, other: &Self) -> Result<Self, SynthesisError>where
CS: ConstraintSystem<E>,
pub fn pow<CS, F>( cs: &mut CS, base: &Self, d: F, ) -> Result<Self, SynthesisError>
Sourcepub fn into_bits_le<CS>(
&self,
cs: &mut CS,
bit_length: Option<usize>,
) -> Result<Vec<Boolean>, SynthesisError>where
CS: ConstraintSystem<E>,
pub fn into_bits_le<CS>(
&self,
cs: &mut CS,
bit_length: Option<usize>,
) -> Result<Vec<Boolean>, SynthesisError>where
CS: ConstraintSystem<E>,
Return (fixed) amount of bits of the allocated number. Can be used when there is a priori knowledge of bit length of the number
Trait Implementations§
Source§impl<E: Engine> Clone for AllocatedNum<E>
impl<E: Engine> Clone for AllocatedNum<E>
Source§impl<E: Engine> From<AllocatedNum<E>> for AmplifiedLinearCombination<E>
impl<E: Engine> From<AllocatedNum<E>> for AmplifiedLinearCombination<E>
Source§fn from(num: AllocatedNum<E>) -> AmplifiedLinearCombination<E>
fn from(num: AllocatedNum<E>) -> AmplifiedLinearCombination<E>
Converts to this type from the input type.
Source§impl<E: Engine> From<AllocatedNum<E>> for LinearCombination<E>
impl<E: Engine> From<AllocatedNum<E>> for LinearCombination<E>
Source§fn from(num: AllocatedNum<E>) -> LinearCombination<E>
fn from(num: AllocatedNum<E>) -> LinearCombination<E>
Converts to this type from the input type.
impl<E: Engine> Copy for AllocatedNum<E>
Auto Trait Implementations§
impl<E> Freeze for AllocatedNum<E>
impl<E> RefUnwindSafe for AllocatedNum<E>
impl<E> Send for AllocatedNum<E>
impl<E> Sync for AllocatedNum<E>
impl<E> Unpin for AllocatedNum<E>
impl<E> UnwindSafe for AllocatedNum<E>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more