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>

source

pub fn zero() -> Self

source

pub fn one() -> Self

source

pub fn alloc<CS: ConstraintSystem<E>>( cs: &mut CS, witness: Option<E::Fr>, ) -> Result<Self, SynthesisError>

source

pub fn get_value(&self) -> Option<E::Fr>

source

pub fn is_zero<CS: ConstraintSystem<E>>( &self, cs: &mut CS, ) -> Result<Boolean, SynthesisError>

source

pub fn is_constant(&self) -> bool

source

pub fn get_constant_value(&self) -> E::Fr

source

pub fn get_variable(&self) -> AllocatedNum<E>

source

pub fn from_boolean_is(boolean: Boolean) -> Self

source

pub fn enforce_equal<CS: ConstraintSystem<E>>( &self, cs: &mut CS, b: &Self, ) -> Result<(), SynthesisError>

source

pub fn conditionally_enforce_equal<CS>( cs: &mut CS, cond: &Boolean, a: &Self, b: &Self, ) -> Result<(), SynthesisError>
where CS: ConstraintSystem<E>,

source

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.

source

pub fn equals<CS: ConstraintSystem<E>>( cs: &mut CS, a: &Self, b: &Self, ) -> Result<Boolean, SynthesisError>

source

pub fn add<CS: ConstraintSystem<E>>( &self, cs: &mut CS, other: &Self, ) -> Result<Self, SynthesisError>

source

pub fn sub<CS: ConstraintSystem<E>>( &self, cs: &mut CS, other: &Self, ) -> Result<Self, SynthesisError>

source

pub fn mask_by_boolean_into_accumulator<CS: ConstraintSystem<E>>( &self, cs: &mut CS, boolean: &Boolean, accumulator: &Self, ) -> Result<Self, SynthesisError>

source

pub fn add_two<CS: ConstraintSystem<E>>( &self, cs: &mut CS, first: &Self, second: &Self, ) -> Result<Self, SynthesisError>

source

pub fn negate<CS: ConstraintSystem<E>>( &self, cs: &mut CS, ) -> Result<Self, SynthesisError>

source

pub fn mul<CS: ConstraintSystem<E>>( &self, cs: &mut CS, other: &Self, ) -> Result<Self, SynthesisError>

source

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>

source

pub fn assert_not_zero<CS>(&self, cs: &mut CS) -> Result<(), SynthesisError>
where CS: ConstraintSystem<E>,

source

pub fn assert_is_zero<CS>(&self, cs: &mut CS) -> Result<(), SynthesisError>
where CS: ConstraintSystem<E>,

source

pub fn inverse<CS: ConstraintSystem<E>>( &self, cs: &mut CS, ) -> Result<Self, SynthesisError>

source

pub fn div<CS>(&self, cs: &mut CS, other: &Self) -> Result<Self, SynthesisError>
where CS: ConstraintSystem<E>,

source

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

source

pub fn conditionally_select<CS: ConstraintSystem<E>>( cs: &mut CS, condition_flag: &Boolean, a: &Self, b: &Self, ) -> Result<Self, SynthesisError>

source

pub fn alloc_multiple<CS: ConstraintSystem<E>, const N: usize>( cs: &mut CS, witness: Option<[E::Fr; N]>, ) -> Result<[Self; N], SynthesisError>

source

pub fn get_value_multiple<const N: usize>(els: &[Self; N]) -> Option<[E::Fr; N]>

source

pub fn get_value_for_slice(els: &[Self]) -> Option<Vec<E::Fr>>

source

pub fn into_bits_le<CS>( &self, cs: &mut CS, bit_length: Option<usize>, ) -> Result<Vec<Boolean>, SynthesisError>
where CS: ConstraintSystem<E>,

source

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> Clone for Num<E>

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<E: Debug + Engine> Debug for Num<E>
where E::Fr: Debug,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<E: Engine> Default for Num<E>

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<E: Engine> Display for Num<E>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<E: Engine> From<Boolean> for Num<E>

source§

fn from(b: Boolean) -> Num<E>

Converts to this type from the input type.
source§

impl<E: Engine> From<Num<E>> for AmplifiedLinearCombination<E>

source§

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>

source§

fn from(num: Num<E>) -> LinearCombination<E>

Converts to this type from the input type.
source§

impl<E: Engine> From<Num<E>> for NumWithTracker<E>

source§

fn from(num: Num<E>) -> Self

Converts to this type from the input type.
source§

impl<E: Engine> IntoBytes<E> for Num<E>

source§

impl<E: Engine> Copy for Num<E>

Auto Trait Implementations§

§

impl<E> Freeze for Num<E>
where <E as ScalarEngine>::Fr: Freeze,

§

impl<E> RefUnwindSafe for Num<E>
where <E as ScalarEngine>::Fr: RefUnwindSafe,

§

impl<E> Send for Num<E>

§

impl<E> Sync for Num<E>

§

impl<E> Unpin for Num<E>
where <E as ScalarEngine>::Fr: Unpin,

§

impl<E> UnwindSafe for Num<E>
where <E as ScalarEngine>::Fr: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
source§

impl<T> PipeOp<T> for T

source§

fn to<F, U>(self, f: F) -> U
where F: FnOnce(T) -> U,

source§

fn op<F>(self, f: F) -> T
where F: FnOnce(&mut T),

source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
source§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

source§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V