Enum franklin_crypto::plonk::circuit::allocated_num::Num
source · pub enum Num<E: Engine> {
Variable(AllocatedNum<E>),
Constant(E::Fr),
}
Variants§
Variable(AllocatedNum<E>)
Constant(E::Fr)
Implementations§
source§impl<E: Engine> Num<E>
impl<E: Engine> Num<E>
pub fn zero() -> Self
pub fn one() -> Self
pub fn alloc<CS: ConstraintSystem<E>>( cs: &mut CS, witness: Option<E::Fr>, ) -> Result<Self, SynthesisError>
pub fn get_value(&self) -> Option<E::Fr>
pub fn is_zero<CS: ConstraintSystem<E>>( &self, cs: &mut CS, ) -> Result<Boolean, SynthesisError>
pub fn is_constant(&self) -> bool
pub fn get_constant_value(&self) -> E::Fr
pub fn get_variable(&self) -> AllocatedNum<E>
pub fn from_boolean_is(boolean: Boolean) -> Self
pub fn enforce_equal<CS: ConstraintSystem<E>>( &self, cs: &mut CS, b: &Self, ) -> Result<(), SynthesisError>
pub fn conditionally_enforce_equal<CS>(
cs: &mut CS,
cond: &Boolean,
a: &Self,
b: &Self,
) -> Result<(), 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: ConstraintSystem<E>>( &self, cs: &mut CS, other: &Self, ) -> Result<Self, SynthesisError>
pub fn sub<CS: ConstraintSystem<E>>( &self, cs: &mut CS, other: &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, first: &Self, second: &Self, ) -> Result<Self, SynthesisError>
pub fn negate<CS: ConstraintSystem<E>>( &self, cs: &mut CS, ) -> Result<Self, SynthesisError>
pub fn mul<CS: ConstraintSystem<E>>( &self, cs: &mut CS, other: &Self, ) -> Result<Self, SynthesisError>
pub fn fma_with_coefficients<CS: ConstraintSystem<E>>( cs: &mut CS, a: &Self, b: &Self, c: &Self, ab_coeff: E::Fr, c_coeff: E::Fr, ) -> 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 inverse<CS: ConstraintSystem<E>>( &self, cs: &mut CS, ) -> Result<Self, SynthesisError>
pub fn div<CS>(&self, cs: &mut CS, other: &Self) -> Result<Self, SynthesisError>where
CS: ConstraintSystem<E>,
sourcepub fn mask<CS: ConstraintSystem<E>>(
cs: &mut CS,
a: &Self,
condition: &Boolean,
) -> Result<Self, SynthesisError>
pub fn mask<CS: ConstraintSystem<E>>( cs: &mut CS, a: &Self, condition: &Boolean, ) -> Result<Self, SynthesisError>
returns 0 if condition == false
and a
if condition == true
pub fn conditionally_select<CS: ConstraintSystem<E>>( cs: &mut CS, condition_flag: &Boolean, a: &Self, b: &Self, ) -> Result<Self, SynthesisError>
pub fn alloc_multiple<CS: ConstraintSystem<E>, const N: usize>( cs: &mut CS, witness: Option<[E::Fr; N]>, ) -> Result<[Self; N], SynthesisError>
pub fn get_value_multiple<const N: usize>(els: &[Self; N]) -> Option<[E::Fr; N]>
pub fn get_value_for_slice(els: &[Self]) -> Option<Vec<E::Fr>>
pub fn into_bits_le<CS>(
&self,
cs: &mut CS,
bit_length: Option<usize>,
) -> Result<Vec<Boolean>, SynthesisError>where
CS: ConstraintSystem<E>,
pub fn conditionally_select_multiple<CS: ConstraintSystem<E>, const N: usize>( cs: &mut CS, flag: &Boolean, a: &[Self; N], b: &[Self; N], ) -> Result<[Self; N], SynthesisError>
Trait Implementations§
source§impl<E: Engine> From<Num<E>> for AmplifiedLinearCombination<E>
impl<E: Engine> From<Num<E>> for AmplifiedLinearCombination<E>
source§fn from(num: Num<E>) -> AmplifiedLinearCombination<E>
fn from(num: Num<E>) -> AmplifiedLinearCombination<E>
Converts to this type from the input type.
source§impl<E: Engine> From<Num<E>> for LinearCombination<E>
impl<E: Engine> From<Num<E>> for LinearCombination<E>
source§fn from(num: Num<E>) -> LinearCombination<E>
fn from(num: Num<E>) -> LinearCombination<E>
Converts to this type from the input type.
source§impl<E: Engine> IntoBytes<E> for Num<E>
impl<E: Engine> IntoBytes<E> for Num<E>
fn into_le_bytes<CS: ConstraintSystem<E>>( &self, cs: &mut CS, ) -> Result<Vec<Byte<E>>, SynthesisError>
fn into_be_bytes<CS: ConstraintSystem<E>>( &self, cs: &mut CS, ) -> Result<Vec<Byte<E>>, SynthesisError>
fn encoding_len() -> usize
impl<E: Engine> Copy for Num<E>
Auto Trait Implementations§
impl<E> Freeze for Num<E>
impl<E> RefUnwindSafe for Num<E>
impl<E> Send for Num<E>
impl<E> Sync for Num<E>
impl<E> Unpin for Num<E>
impl<E> UnwindSafe for Num<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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)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