pub struct Chip<F: Field, A> {
pub air: A,
pub sends: Vec<Interaction<F>>,
pub receives: Vec<Interaction<F>>,
pub log_quotient_degree: usize,
}
Expand description
An Air that encodes lookups based on interactions.
Fields§
§air: A
The underlying AIR of the chip for constraint evaluation.
sends: Vec<Interaction<F>>
The interactions that the chip sends.
receives: Vec<Interaction<F>>
The interactions that the chip receives.
log_quotient_degree: usize
The relative log degree of the quotient polynomial, i.e. log2(max_constraint_degree - 1)
.
Implementations§
Source§impl<F: Field, A> Chip<F, A>
impl<F: Field, A> Chip<F, A>
Sourcepub fn sends(&self) -> &[Interaction<F>]
pub fn sends(&self) -> &[Interaction<F>]
The send interactions of the chip.
Sourcepub fn receives(&self) -> &[Interaction<F>]
pub fn receives(&self) -> &[Interaction<F>]
The receive interactions of the chip.
Sourcepub const fn log_quotient_degree(&self) -> usize
pub const fn log_quotient_degree(&self) -> usize
The relative log degree of the quotient polynomial, i.e. log2(max_constraint_degree - 1)
.
Sourcepub fn into_inner(self) -> A
pub fn into_inner(self) -> A
Consumes the chip and returns the underlying air.
Source§impl<F: PrimeField32, A: MachineAir<F>> Chip<F, A>
impl<F: PrimeField32, A: MachineAir<F>> Chip<F, A>
Source§impl<F, A> Chip<F, A>
impl<F, A> Chip<F, A>
Sourcepub fn new(air: A) -> Self
pub fn new(air: A) -> Self
Records the interactions and constraint degree from the air and crates a new chip.
Sourcepub fn num_interactions(&self) -> usize
pub fn num_interactions(&self) -> usize
Returns the number of interactions in the chip.
Sourcepub fn num_sent_byte_lookups(&self) -> usize
pub fn num_sent_byte_lookups(&self) -> usize
Returns the number of sent byte lookups in the chip.
Sourcepub fn num_sends_by_kind(&self, kind: InteractionKind) -> usize
pub fn num_sends_by_kind(&self, kind: InteractionKind) -> usize
Returns the number of sends of the given kind.
Sourcepub fn num_receives_by_kind(&self, kind: InteractionKind) -> usize
pub fn num_receives_by_kind(&self, kind: InteractionKind) -> usize
Returns the number of receives of the given kind.
Sourcepub fn generate_permutation_trace<EF: ExtensionField<F>>(
&self,
preprocessed: Option<&RowMajorMatrix<F>>,
main: &RowMajorMatrix<F>,
random_elements: &[EF],
) -> (RowMajorMatrix<EF>, EF)where
F: PrimeField,
A: MachineAir<F>,
pub fn generate_permutation_trace<EF: ExtensionField<F>>(
&self,
preprocessed: Option<&RowMajorMatrix<F>>,
main: &RowMajorMatrix<F>,
random_elements: &[EF],
) -> (RowMajorMatrix<EF>, EF)where
F: PrimeField,
A: MachineAir<F>,
Generates a permutation trace for the given matrix.
Sourcepub fn permutation_width(&self) -> usize
pub fn permutation_width(&self) -> usize
Returns the width of the permutation trace.
Sourcepub fn cost(&self) -> u64where
A: MachineAir<F>,
pub fn cost(&self) -> u64where
A: MachineAir<F>,
Returns the cost of a row in the chip.
Sourcepub const fn quotient_width(&self) -> usize
pub const fn quotient_width(&self) -> usize
Returns the width of the quotient polynomial.
Sourcepub const fn logup_batch_size(&self) -> usize
pub const fn logup_batch_size(&self) -> usize
Returns the log2 of the batch size.
Trait Implementations§
Source§impl<'a, F, A, AB> Air<AB> for Chip<F, A>where
F: Field,
A: Air<AB> + MachineAir<F>,
AB: SP1AirBuilder<F = F> + MultiTableAirBuilder<'a> + PairBuilder + 'a,
impl<'a, F, A, AB> Air<AB> for Chip<F, A>where
F: Field,
A: Air<AB> + MachineAir<F>,
AB: SP1AirBuilder<F = F> + MultiTableAirBuilder<'a> + PairBuilder + 'a,
Source§impl<F, A> BaseAir<F> for Chip<F, A>
impl<F, A> BaseAir<F> for Chip<F, A>
fn preprocessed_trace(&self) -> Option<RowMajorMatrix<F>>
Source§impl<F, A> MachineAir<F> for Chip<F, A>where
F: Field,
A: MachineAir<F>,
impl<F, A> MachineAir<F> for Chip<F, A>where
F: Field,
A: MachineAir<F>,
Source§type Record = <A as MachineAir<F>>::Record
type Record = <A as MachineAir<F>>::Record
Source§type Program = <A as MachineAir<F>>::Program
type Program = <A as MachineAir<F>>::Program
Source§fn preprocessed_width(&self) -> usize
fn preprocessed_width(&self) -> usize
Source§fn preprocessed_num_rows(
&self,
program: &Self::Program,
instrs_len: usize,
) -> Option<usize>
fn preprocessed_num_rows( &self, program: &Self::Program, instrs_len: usize, ) -> Option<usize>
Source§fn generate_preprocessed_trace(
&self,
program: &A::Program,
) -> Option<RowMajorMatrix<F>>
fn generate_preprocessed_trace( &self, program: &A::Program, ) -> Option<RowMajorMatrix<F>>
Source§fn generate_trace(
&self,
input: &A::Record,
output: &mut A::Record,
) -> RowMajorMatrix<F>
fn generate_trace( &self, input: &A::Record, output: &mut A::Record, ) -> RowMajorMatrix<F>
Source§fn generate_dependencies(&self, input: &A::Record, output: &mut A::Record)
fn generate_dependencies(&self, input: &A::Record, output: &mut A::Record)
Source§fn included(&self, shard: &Self::Record) -> bool
fn included(&self, shard: &Self::Record) -> bool
Source§fn commit_scope(&self) -> InteractionScope
fn commit_scope(&self) -> InteractionScope
Source§fn local_only(&self) -> bool
fn local_only(&self) -> bool
impl<F, A: Eq> Eq for Chip<F, A>
Auto Trait Implementations§
impl<F, A> Freeze for Chip<F, A>where
A: Freeze,
impl<F, A> RefUnwindSafe for Chip<F, A>where
A: RefUnwindSafe,
F: RefUnwindSafe,
impl<F, A> Send for Chip<F, A>where
A: Send,
impl<F, A> Sync for Chip<F, A>where
A: Sync,
impl<F, A> Unpin for Chip<F, A>
impl<F, A> UnwindSafe for Chip<F, A>where
A: UnwindSafe,
F: UnwindSafe,
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
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