pub struct ConstraintCircuit<II: InputIndicator> {
pub id: usize,
pub ref_count: usize,
pub expression: CircuitExpression<II>,
}
Expand description
A wrapper around a CircuitExpression
that manages additional bookkeeping
information, such as node id and visited counter.
In contrast to ConstraintCircuitMonad
, this struct cannot manage the state
required to insert new nodes.
Fields§
§id: usize
§ref_count: usize
§expression: CircuitExpression<II>
Implementations§
Source§impl<II: InputIndicator> ConstraintCircuit<II>
impl<II: InputIndicator> ConstraintCircuit<II>
Sourcepub fn assert_unique_ids(constraints: &mut [ConstraintCircuit<II>])
pub fn assert_unique_ids(constraints: &mut [ConstraintCircuit<II>])
Assert that a multicircuit has unique IDs.
Also determines how often each node is referenced, updating the respective ref_count
s.
§Panics
Panics if a duplicate ID is found.
Sourcepub fn degree(&self) -> isize
pub fn degree(&self) -> isize
Return degree of the multivariate polynomial represented by this circuit
Sourcepub fn all_ref_counters(&self) -> Vec<usize>
pub fn all_ref_counters(&self) -> Vec<usize>
All unique reference counters in the subtree, sorted.
Sourcepub fn is_zero(&self) -> bool
pub fn is_zero(&self) -> bool
Is the node the constant 0?
Does not catch composite expressions that will always evaluate to zero, like 0·a
.
Sourcepub fn is_one(&self) -> bool
pub fn is_one(&self) -> bool
Is the node the constant 1?
Does not catch composite expressions that will always evaluate to one, like 1·1
.
pub fn is_neg_one(&self) -> bool
Sourcepub fn evaluates_to_base_element(&self) -> bool
pub fn evaluates_to_base_element(&self) -> bool
Recursively check whether this node is composed of only BFieldElements, i.e., only uses
- inputs from main rows,
- constants from the B-field, and
- binary operations on BFieldElements.
pub fn evaluate( &self, main_table: ArrayView2<'_, BFieldElement>, aux_table: ArrayView2<'_, XFieldElement>, challenges: &[XFieldElement], ) -> XFieldElement
Trait Implementations§
Source§impl<II: Clone + InputIndicator> Clone for ConstraintCircuit<II>
impl<II: Clone + InputIndicator> Clone for ConstraintCircuit<II>
Source§fn clone(&self) -> ConstraintCircuit<II>
fn clone(&self) -> ConstraintCircuit<II>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<II: Debug + InputIndicator> Debug for ConstraintCircuit<II>
impl<II: Debug + InputIndicator> Debug for ConstraintCircuit<II>
Source§impl<II: InputIndicator> Display for ConstraintCircuit<II>
impl<II: InputIndicator> Display for ConstraintCircuit<II>
Source§impl<II: InputIndicator> Hash for ConstraintCircuit<II>
impl<II: InputIndicator> Hash for ConstraintCircuit<II>
Source§impl<II: InputIndicator> PartialEq for ConstraintCircuit<II>
impl<II: InputIndicator> PartialEq for ConstraintCircuit<II>
impl<II: InputIndicator> Eq for ConstraintCircuit<II>
Auto Trait Implementations§
impl<II> Freeze for ConstraintCircuit<II>where
II: Freeze,
impl<II> !RefUnwindSafe for ConstraintCircuit<II>
impl<II> !Send for ConstraintCircuit<II>
impl<II> !Sync for ConstraintCircuit<II>
impl<II> Unpin for ConstraintCircuit<II>where
II: Unpin,
impl<II> !UnwindSafe for ConstraintCircuit<II>
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
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)
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>
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>
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