franklin_crypto::plonk::circuit::allocated_num

Struct AllocatedNum

Source
pub struct AllocatedNum<E: Engine> { /* private fields */ }

Implementations§

Source§

impl<E: Engine> AllocatedNum<E>

Source

pub fn get_variable(&self) -> Variable

Source

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

Source

pub fn alloc<CS, F>(cs: &mut CS, value: F) -> Result<Self, SynthesisError>
where CS: ConstraintSystem<E>, F: FnOnce() -> Result<E::Fr, SynthesisError>,

Source

pub fn alloc_input<CS, F>(cs: &mut CS, value: F) -> Result<Self, SynthesisError>
where CS: ConstraintSystem<E>, F: FnOnce() -> Result<E::Fr, SynthesisError>,

Source

pub fn from_boolean_is(boolean: Boolean) -> Self

Source

pub fn alloc_cnst<CS>(cs: &mut CS, fr: E::Fr) -> Result<Self, SynthesisError>
where CS: ConstraintSystem<E>,

Source

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

Source

pub fn one<CS: ConstraintSystem<E>>(cs: &mut CS) -> Self

Source

pub fn zero<CS: ConstraintSystem<E>>(cs: &mut CS) -> Self

Source

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

Source

pub fn inverse<CS: ConstraintSystem<E>>( &self, cs: &mut CS, ) -> 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 assert_equal_to_constant<CS>( &self, cs: &mut CS, constant: E::Fr, ) -> Result<(), SynthesisError>
where CS: ConstraintSystem<E>,

Source

pub fn is_zero<CS>(&self, cs: &mut CS) -> Result<Boolean, 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>(&self, cs: &mut CS, other: &Self) -> Result<Self, SynthesisError>
where CS: ConstraintSystem<E>,

Source

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

Source

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

Source

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

Source

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

Source

pub fn fma_with_coefficients<CS: ConstraintSystem<E>>( &self, cs: &mut CS, b: (E::Fr, Self), c: (E::Fr, 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, x: Self, y: Self, ) -> Result<Self, SynthesisError>

Source

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

Source

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

Source

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

Source

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

Source

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

Masks a value with a Boolean

Source

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

Source

pub fn pow<CS, F>( cs: &mut CS, base: &Self, d: F, ) -> Result<Self, SynthesisError>
where CS: ConstraintSystem<E>, F: AsRef<[Boolean]>,

Source

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>

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 AllocatedNum<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> From<AllocatedNum<E>> for AmplifiedLinearCombination<E>

Source§

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>

Source§

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

Converts to this type from the input type.
Source§

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

Auto Trait Implementations§

§

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

§

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

§

impl<E> Send for AllocatedNum<E>

§

impl<E> Sync for AllocatedNum<E>

§

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

§

impl<E> UnwindSafe for AllocatedNum<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 u8)

🔬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, 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