Enum ark_relations::r1cs::ConstraintSystemRef [−][src]
A shared reference to a constraint system that can be stored in high level variables.
Variants
Represents the case where we don’t need to allocate variables or enforce constraints. Encountered when operating over constant values.
CS(Rc<RefCell<ConstraintSystem<F>>>)Represents the case where we do allocate variables or enforce constraints.
Implementations
impl<F: Field> ConstraintSystemRef<F>[src]
pub fn or(self, other: Self) -> Self[src]
Returns self if !self.is_none(), otherwise returns other.
pub fn is_none(&self) -> bool[src]
Returns true is self == ConstraintSystemRef::None.
pub fn new(inner: ConstraintSystem<F>) -> Self[src]
Construct a ConstraintSystemRef from a ConstraintSystem.
pub fn borrow(&self) -> Option<Ref<'_, ConstraintSystem<F>>>[src]
Obtain an immutable reference to the underlying ConstraintSystem.
Panics
This method panics if self is already mutably borrowed.
pub fn borrow_mut(&self) -> Option<RefMut<'_, ConstraintSystem<F>>>[src]
Obtain a mutable reference to the underlying ConstraintSystem.
Panics
This method panics if self is already mutably borrowed.
pub fn set_mode(&self, mode: SynthesisMode)[src]
Set self.mode to mode.
pub fn is_in_setup_mode(&self) -> bool[src]
Check whether self.mode == SynthesisMode::Setup.
pub fn num_constraints(&self) -> usize[src]
Returns the number of constraints.
pub fn num_instance_variables(&self) -> usize[src]
Returns the number of instance variables.
pub fn num_witness_variables(&self) -> usize[src]
Returns the number of witness variables.
pub fn optimization_goal(&self) -> OptimizationGoal[src]
Check whether this constraint system aims to optimize weight, number of constraints, or neither.
pub fn set_optimization_goal(&self, goal: OptimizationGoal)[src]
Specify whether this constraint system should aim to optimize weight, number of constraints, or neither.
pub fn should_construct_matrices(&self) -> bool[src]
Check whether or not self will construct matrices.
pub fn new_input_variable<Func>(&self, f: Func) -> Result<Variable> where
Func: FnOnce() -> Result<F>, [src]
Func: FnOnce() -> Result<F>,
Obtain a variable representing a new public instance input.
pub fn new_witness_variable<Func>(&self, f: Func) -> Result<Variable> where
Func: FnOnce() -> Result<F>, [src]
Func: FnOnce() -> Result<F>,
Obtain a variable representing a new private witness input.
pub fn new_lc(&self, lc: LinearCombination<F>) -> Result<Variable>[src]
Obtain a variable representing a linear combination.
pub fn enforce_constraint(
&self,
a: LinearCombination<F>,
b: LinearCombination<F>,
c: LinearCombination<F>
) -> Result<()>[src]
&self,
a: LinearCombination<F>,
b: LinearCombination<F>,
c: LinearCombination<F>
) -> Result<()>
Enforce a R1CS constraint with the name name.
pub fn inline_all_lcs(&self)[src]
Naively inlines symbolic linear combinations into the linear combinations that use them.
Useful for standard pairing-based SNARKs where addition gates are cheap. For example, in the SNARKs such as [Groth16] and [Groth-Maller17], addition gates do not contribute to the size of the multi-scalar multiplication, which is the dominating cost.
pub fn finalize(&self)[src]
Finalize the constraint system (either by outlining or inlining, if an optimization goal is set).
pub fn to_matrices(&self) -> Option<ConstraintMatrices<F>>[src]
This step must be called after constraint generation has completed, and after all symbolic LCs have been inlined into the places that they are used.
pub fn is_satisfied(&self) -> Result<bool>[src]
If self is satisfied, outputs Ok(true).
If self is unsatisfied, outputs Ok(false).
If self.is_in_setup_mode() or if self == None, outputs Err(()).
pub fn which_is_unsatisfied(&self) -> Result<Option<String>>[src]
If self is satisfied, outputs Ok(None).
If self is unsatisfied, outputs Some(i), where i is the index of
the first unsatisfied constraint.
If self.is_in_setup_mode() or self == None, outputs Err(()).
pub fn assigned_value(&self, v: Variable) -> Option<F>[src]
Obtain the assignment corresponding to the Variable v.
pub fn constraint_names(&self) -> Option<Vec<String>>[src]
Get trace information about all constraints in the system
Trait Implementations
impl<F: Clone + Field> Clone for ConstraintSystemRef<F>[src]
fn clone(&self) -> ConstraintSystemRef<F>[src]
pub fn clone_from(&mut self, source: &Self)1.0.0[src]
impl<F: Debug + Field> Debug for ConstraintSystemRef<F>[src]
impl<F: Field> Eq for ConstraintSystemRef<F>[src]
impl<F: Field> From<ConstraintSystemRef<F>> for Namespace<F>[src]
fn from(other: ConstraintSystemRef<F>) -> Self[src]
impl<F: Field> PartialEq<ConstraintSystemRef<F>> for ConstraintSystemRef<F>[src]
Auto Trait Implementations
impl<F> !Send for ConstraintSystemRef<F>
impl<F> !Sync for ConstraintSystemRef<F>
impl<F> Unpin for ConstraintSystemRef<F>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T> Instrument for T[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>[src]
pub fn in_current_span(self) -> Instrumented<Self>[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T[src]
pub fn clone_into(&self, target: &mut T)[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,