pub struct ConstraintSystemBuilder<'arena, U, F>{ /* private fields */ }
Implementations§
Source§impl<'arena, U, F> ConstraintSystemBuilder<'arena, U, F>
impl<'arena, U, F> ConstraintSystemBuilder<'arena, U, F>
pub fn new() -> Self
pub fn new_with_witness(allocator: &'arena Bump) -> Self
pub fn build(self) -> Result<ConstraintSystem<F>, Error>
pub fn witness(&mut self) -> Option<&mut Builder<'arena, U, F>>
pub fn take_witness( &mut self, ) -> Result<MultilinearExtensionIndex<'arena, U, F>, Error>
pub fn flush( &mut self, direction: FlushDirection, channel_id: ChannelId, count: usize, oracle_ids: impl IntoIterator<Item = OracleId>, )
pub fn flush_with_multiplicity( &mut self, direction: FlushDirection, channel_id: ChannelId, count: usize, oracle_ids: impl IntoIterator<Item = OracleId>, multiplicity: u64, )
pub fn send( &mut self, channel_id: ChannelId, count: usize, oracle_ids: impl IntoIterator<Item = OracleId>, )
pub fn receive( &mut self, channel_id: ChannelId, count: usize, oracle_ids: impl IntoIterator<Item = OracleId>, )
pub fn assert_zero( &mut self, oracle_ids: impl IntoIterator<Item = OracleId>, composition: ArithExpr<F>, )
pub fn assert_not_zero(&mut self, oracle_id: OracleId)
pub fn add_channel(&mut self) -> ChannelId
pub fn add_committed( &mut self, name: impl ToString, n_vars: usize, tower_level: usize, ) -> OracleId
pub fn add_committed_multiple<const N: usize>( &mut self, name: impl ToString, n_vars: usize, tower_level: usize, ) -> [OracleId; N]
pub fn add_linear_combination( &mut self, name: impl ToString, n_vars: usize, inner: impl IntoIterator<Item = (OracleId, F)>, ) -> Result<OracleId, OracleError>
pub fn add_linear_combination_with_offset( &mut self, name: impl ToString, n_vars: usize, offset: F, inner: impl IntoIterator<Item = (OracleId, F)>, ) -> Result<OracleId, OracleError>
pub fn add_packed( &mut self, name: impl ToString, id: OracleId, log_degree: usize, ) -> Result<OracleId, OracleError>
pub fn add_projected( &mut self, name: impl ToString, id: OracleId, values: Vec<F>, variant: ProjectionVariant, ) -> Result<usize, OracleError>
pub fn add_repeating( &mut self, name: impl ToString, id: OracleId, log_count: usize, ) -> Result<OracleId, OracleError>
pub fn add_shifted( &mut self, name: impl ToString, id: OracleId, offset: usize, block_bits: usize, variant: ShiftVariant, ) -> Result<OracleId, OracleError>
pub fn add_transparent( &mut self, name: impl ToString, poly: impl MultivariatePoly<F> + 'static, ) -> Result<OracleId, OracleError>
pub fn add_zero_padded( &mut self, name: impl ToString, id: OracleId, n_vars: usize, ) -> Result<OracleId, OracleError>
Sourcepub fn push_namespace(&mut self, name: impl ToString)
pub fn push_namespace(&mut self, name: impl ToString)
Anything pushed to the namespace will become part of oracle name, which is useful for debugging.
Use pop_namespace(&mut self)
to remove the latest name.
Example
use binius_circuits::builder::ConstraintSystemBuilder;
use binius_field::{TowerField, BinaryField128b, BinaryField1b, arch::OptimalUnderlier};
let log_size = 14;
let mut builder = ConstraintSystemBuilder::<OptimalUnderlier, BinaryField128b>::new();
builder.push_namespace("a");
let x = builder.add_committed("x", log_size, BinaryField1b::TOWER_LEVEL);
builder.push_namespace("b");
let y = builder.add_committed("y", log_size, BinaryField1b::TOWER_LEVEL);
builder.pop_namespace();
builder.pop_namespace();
let z = builder.add_committed("z", log_size, BinaryField1b::TOWER_LEVEL);
let system = builder.build().unwrap();
assert_eq!(system.oracles.oracle(x).name().unwrap(), "a::x");
assert_eq!(system.oracles.oracle(y).name().unwrap(), "a::b::y");
assert_eq!(system.oracles.oracle(z).name().unwrap(), "z");
pub fn pop_namespace(&mut self)
Sourcepub fn log_rows(
&self,
oracle_ids: impl IntoIterator<Item = OracleId>,
) -> Result<usize, Error>
pub fn log_rows( &self, oracle_ids: impl IntoIterator<Item = OracleId>, ) -> Result<usize, Error>
Returns the number of rows shared by a set of columns.
Fails if no columns are provided, or not all columns have the same number of rows.
This is useful for writing circuits with internal columns that depend on the height of input columns.
Trait Implementations§
Source§impl<'arena, U, F> Default for ConstraintSystemBuilder<'arena, U, F>
impl<'arena, U, F> Default for ConstraintSystemBuilder<'arena, U, F>
Source§fn default() -> ConstraintSystemBuilder<'arena, U, F>
fn default() -> ConstraintSystemBuilder<'arena, U, F>
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl<'arena, U, F> Freeze for ConstraintSystemBuilder<'arena, U, F>
impl<'arena, U, F> !RefUnwindSafe for ConstraintSystemBuilder<'arena, U, F>
impl<'arena, U, F> !Send for ConstraintSystemBuilder<'arena, U, F>
impl<'arena, U, F> !Sync for ConstraintSystemBuilder<'arena, U, F>
impl<'arena, U, F> Unpin for ConstraintSystemBuilder<'arena, U, F>
impl<'arena, U, F> !UnwindSafe for ConstraintSystemBuilder<'arena, U, F>
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
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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 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>
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