triton_constraint_circuit

Struct ConstraintCircuit

Source
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>

Source

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_counts.

§Panics

Panics if a duplicate ID is found.

Source

pub fn degree(&self) -> isize

Return degree of the multivariate polynomial represented by this circuit

Source

pub fn all_ref_counters(&self) -> Vec<usize>

All unique reference counters in the subtree, sorted.

Source

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.

Source

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.

Source

pub fn is_neg_one(&self) -> bool

Source

pub fn evaluates_to_base_element(&self) -> bool

Recursively check whether this node is composed of only BFieldElements, i.e., only uses

  1. inputs from main rows,
  2. constants from the B-field, and
  3. binary operations on BFieldElements.
Source

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>

Source§

fn clone(&self) -> ConstraintCircuit<II>

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<II: Debug + InputIndicator> Debug for ConstraintCircuit<II>

Source§

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

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

impl<II: InputIndicator> Display for ConstraintCircuit<II>

Source§

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

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

impl<II: InputIndicator> Hash for ConstraintCircuit<II>

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<II: InputIndicator> PartialEq for ConstraintCircuit<II>

Source§

fn eq(&self, other: &Self) -> bool

Calculate equality of circuits. In particular, this function does not attempt to simplify or reduce neutral terms or products. So this comparison will return false for a == a + 0. It will also return false for XFieldElement(7) == BFieldElement(7)

1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

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